Tag Archives: programming

GDC Day 1: Math for Games Programmers

GDC '13 logo

For the second year in a row, I attended the Math for Games Programmers tutorial at GDC today. As expected, there was a fair amount of review, but I also learned some cool new things!

The earlier talks on splines, blending, matrices, etc. were basically review for me, but it was nice to have that refresher. That said, one tip came up that really stood out to me for matrix math. Matrices are multiplied in a sort of “reverse” order, for example:

Rotation * Translation = translate-then-rotate

Incidentally, this is actually the same order you’d write functions while programming:

rotate( translate( point ) ) = translate-then-rotate( point )

Nifty!

Jim van Verth’s talk on quaternions was absolutely fantastic. He spent the talk discussing how quaternions work rather than why we use them. Questions like “why four values?,” “why do we input theta over 2 instead of the entire angle?,” “how can we visualize 4D space?” and more are covered. As a bonus, the tutorial will actually make it to the GDC vault this year, so definitely check out the talk if you can! If you don’t have vault access, you should be able to pick up the slides at http://essentialmath.com/tutorial.htm once they’re posted.

Dual numbers sound useful, but I’m not sure how often I’ll use the content of the lecture. That said, “you can basically get the derivative for free” is a pretty awesome thing to keep in mind. They’re pretty interesting from a mathematical standpoint.

The talk on Orthogonal Matching Pursuit and K-SVD for Sparse Encoding went way over my head, but I still pulled a good deal of information from it. I think I have a rough idea of how compression works now. I have some research to do!

The talk on Computational Geometry was pretty interesting, though it seemed more or less the same as last year. Still, it was good to get the review – I had forgotten a lot of it. I also learned about higher order surfaces on the GPU (i.e. tesselation, etc.), which was new to me!

Finally, the talk on Interaction With 3D Geometry by Stan Melax was amazing. It was a super-fast-paced crash-course on a huge number of subjects that left me really inspired to start writing some tech demos to learn how all of the concepts work. I’ll definitely be watching it on the vault.

Tomorrow: Physics!

Welcome!

Greetings!

This website hosts my blog about games, programming, and related topics, along with my portfolio and resume. I’ve always had a passion for breaking things down and analyzing them, and my father introduced me to programming via a few books when I was younger. I find programming fascinating, and decided to pursue it in college. I am enrolled in the Game Design & Development program at Rochester Institute of Technology, and I couldn’t be happier!

Cheers!

Zachary Hoefler

Learning Assembly through Gameboy Programming

My current on-and-off pet project is teaching myself to program Z80 Assembly for the original Gameboy. Though I have some experience with MIPS 2000 Assembly Language, I thought Gameboy programming might be fun after seeing the following video:

As I thought more about it, I realized that the Gameboy has a number of distinct advantages:

  1. They’re cheap. An original Gameboy (DMG-01) cost me only about $20 on eBay.
  2. They’re a full set of hardware all in one. The Gameboy has its display, processor, input, etc. all in one incredibly inexpensive unit.
  3. Flash carts are easy to acquire. In layman’s terms, a flash cart is a cartridge that can be written to and read from easily. To make it even more convenient, I can connect the cartridge to my computer with a USB cable. Essentially, this means I can easily run my code on the actual hardware with almost no hassle. The cartridge I purchased cost only $38.
  4. High-quality emulators are readily available. Though running code on the actual hardware is very cool, there are advantages to running it in an emulator. The BGB gameboy emulator has a powerful debugger built in, for example, which makes development a lot easier.
  5. You can develop for the Gameboy on many platforms. Whether you’re running Windows, Mac, or Linux, the proper tools to get the job done are available.

Of course, the primary motivation was that the project just sounds like fun! As-is, I’ve picked up all of the appropriate hardware and got a “hello world” program up and running:

(What? It was much more fun to display than “Hello World”)

Anyway, I plan to post more about this pet project as time goes on. As far as what game(s) I end up making… well, I’m not entirely sure! A schmupp sounds like it’d be a fun idea, but I’m open to suggestions.

Cheers!
Zach

Project uploaded – Peg Solitaire (MIPS R2000 Assembly)

Just uploaded my peg solitaire game from this past quarter, put it in my portfolio, and added it into my resume. It’s coded in MIPS R2000 Assembly Language!

Assembly’s definitely a lot of fun to experiment with, and you can learn a lot from it. That being said, it makes me really appreciate high-level languages.

Books!

Because I’m a bit of a programming fanatic, I picked up a two books recently: Game Programming Gems and Effective C++: 55 Specific Ways to Improve Your Programs and Designs.

Effective C++ was recommended to me by one of my professors. Although I’ve only gotten through the first chapter thus far, this book is definitely an excellent resource! Effective C++ looks like a solid way to go from just knowing C++’s syntax and how it works at a basic level, to understanding how to use C++. The first few items alone have already caused me to look differently at how I program; pulling that off in a couple dozen pages is rather impressive.

Game Programming Gems is a book I’ve been meaning to pick up for a while now. Though I’d heard of the series before, I never thought too much about it until I sat down and looked at someone’s copy of the first book in the series. After reading a section or two, I was sold immediately. I’ve only looked at a small few bits and pieces thus far, but I can already tell this book–and, likely, the entire series–is something I’ll come back to again and again.

Personal Goals Update

My first post on this blog was about my current goals, and thus far I’ve stuck to them. Not only that, though, but I have a clearer view of how I want to go about things!

1. Learn Lua

I’ve been following along with Programming in Lua, a free book available on the official Lua website. My goal is to get through most of it by the end of the week. I’ve been considering doing a small project to get some practice with the language; I’ll probably make a hangman game. Hangman would allow me to work with a lot of the language’s features, and it’s simple enough where I’d mostly get caught up on language-related errors (which is what I want) rather than messing up algorithms.

Regarding the book, I’m actually pretty impressed by it. I’m strongly considering grabbing a print copy once I get a chance.

2. Get a taste of DirectX

Though I haven’t started this one yet–I’m waiting until after I’ve gotten a grasp of Lua–I’ve got a better idea of what I’d like to do:

  1. Learn Lua
  2. Jump into DirectX using C++ with tutorials
  3. Create a 2D arcade game using C++, DirectX, and Lua scripting.

By doing all of this, not only would I (hopefully!) learn DirectX pretty well, I’d also walk away with a cool game and a solid portfolio piece! Most likely, the arcade game would be based on something simple (Asteroids? Space Invaders?), but jazzed up with particle effects and the like. I’ll probably work toward this a lot over our holiday break from school, and hopefully I’ll be finishing it up before winter courses are done.

Longer term, I’d also like to try creating either a fighting game or strategy game. Also on the list is learning 3D with DirectX.

3. Stay up to date on Games Industry news

I seem to have found the perfect solution with Google Reader. This goal is something I have tried to accomplish a few times, but I just couldn’t get checking news sites into my daily routine; however, being able to get the latest updates of various news sites, comics, etc. all in one location has led me to checking Google Reader regularly. I’m currently subscribed to Gamasutra, The Escapist, GameCareerGuide, and a number of other sites. I really wish I’d discovered RSS readers earlier!

4. Play/analyze new games regularly

I’d like to incorporate this into my daily routine at some point, but for now I’m only pushing towards getting this done every other day. Finding and analyzing games is simple enough–I have a bunch of unplayed games, friends to borrow games from, sites like Kongregate, etc.–but doing write-ups is a bit harder.

Although I’d planned to post a write-up for every game on this blog (and I’ve posted one already), I’m not sure how feasible that will be. I definitely plan to do write-ups now and then, but with the amount of time it takes to do a good write-up (rather than a jumbled list of thoughts from my notes), I don’t think I’ll be doing one for every single game I try. I’ll probably be experimenting a bit with different formats to see if writing up something a little less formal is doable.


 

Finally, I highly recommend the site Remember the Milk, a free to-do list manager. I’ve been using it for the past couple weeks, and not only has it been awesome for keeping track of everything I need to get done, I’ve also been significantly more productive! Between daily reminders and being able to set deadlines that I’ll actually be able to keep track of, it’s been a godsend.

  • Learn Lua – I have heard nothing but good things about Lua, and it seems to come up frequently with games. When one also considers that the first edition of Programming in Lua is legally available for free online, teaching myself the language is definitely something I plan to do in the near future!
  • Get a taste of DirectX – Having worked in XNA, and after getting a brief introduction to OpenGL, introducing myself to DirectX seems like the next logical step. Although I don’t plan on attempting to master it in the immediate future, I would like to learn the basics and reach the point where it does not intimidate me, at the least :)
  • Stay up to date on Games Industry news – I’ve been making a point to read Gamasutra and The Escapist daily to stay on top what’s going on in the Games Industry
  • Play (and analyze) a new game at least every other day – In an effort to both improve my knowledge of what games are out there and to improve my ability to analyze games, I’m going to push myself to play and analyze a new game at least every other day. If I can spare even 15-20 minutes every day or two to trying out a new game, I should definitely be able to pull this one off. I also plan on posting my analysis of the games on this blog!

Learning Lua

Sticking to my plans, I’ve begun teaching myself Lua. Although it’s a bit odd to wrap my head around after just diving head-first into C++, it’s pretty cool!

One lesson I’ve learned (or, rather, had reaffirmed) is how important writing clean code is. Given Lua doesn’t require semicolons to separate statements and doesn’t use braces, you can get away with some really sloppy, hard-to-read stuff. The following are all equivalent:

-- Easy to read factorial function
function fact (n)
   if n == 0 then
      return 1
   else
      return n * fact(n-1)
   end
end
-- Hard to read, but simple enough where you could probably figure it out
function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end
-- Oh boy.
function
fact
(n) if n ==
0 then return
1 else
return n *
fact(n
-1) end

end

Having only really worked with C#, C++, Java, and ActionScript, it’s going to take some effort getting used to the syntax of Lua; however, I’m up for the challenge!

Current Goals

With fall quarter classes coming to an end, I’ve had time to unwind and start thinking about my current short-term goals:

  • Learn Lua – I have heard nothing but good things about Lua, and it seems to come up frequently with games. When one also considers that the first edition of Programming in Lua is legally available for free online, teaching myself the language is definitely something I plan to do in the near future!
  • Get a taste of DirectX – Having worked in XNA, and after getting a brief introduction to OpenGL, introducing myself to DirectX seems like the next logical step. Although I don’t plan on attempting to master it in the immediate future, I would like to learn the basics and reach the point where it does not intimidate me, at the least :)
  • Stay up to date on Games Industry news – I’ve been making a point to read Gamasutra and The Escapist daily to stay on top what’s going on in the Games Industry
  • Play (and analyze) a new game at least every other day – In an effort to both improve my knowledge of what games are out there and to improve my ability to analyze games, I’m going to push myself to play and analyze a new game at least every other day. If I can spare even 15-20 minutes every day or two to trying out a new game, I should definitely be able to pull this one off. I also plan on posting my analysis of the games on this blog!