Archive for March, 2006

GameHack 3/2006 Postmortem

Tuesday, March 14th, 2006

About a month ago, CipherXor and I were talking scripting languages, we’re both fans of Lua and he had just picked up Ruby, when we decided we needed to have spend a day getting together with others alchemists cut of our cloth and see what vile concoctions we could create in a day. The idea was to create a basic game using a scripting language. It came as no surprise when I chose Lua and he chose Ruby.

All in all, the day was successful. We spent about 12 hours, from 3pm to 3am working on this and by the time we each had something to be proud of. CipherXor and Neo worked together to create a tactical space wargame called Gspace, where my goal was to create a multiplayer “party” game where people moved around the screen shooting each other for points using as many Xbox 360 controllers as you can plug into your PC. I called that game “Asswhoopin’”.

There are some pictures of the event here.  And don’t forget to check CipherXor’s page for his postmortem.
In true postmortem fashion, here’s what went right and wrong

What went right…

  1. Using Lua and LuaCheia. Lua is a very simple language to learn that can also be deceptively powerful and fast. It is the concept of the Lua tables that make the language as flexible as it is. LuaCheia adds additional functionality to Lua such as the ability to use SDL for graphics. With this combination, I was able to set up a simple generic “game engine” really quickly. Code iteration and bug fix turnaround was really fast. I believe it was much faster than doing this whole thing in C++.
  2. Using Xbox 360 Controllers. It is possible to use wired Xbox 360 controllers on your PC after downloading a driver. To Windows, it’s just another joystick and therefore I could get its input from SDL. Since Windows XP doesn’t put a limit on the number of joysticks plugged into it, I decided to use joystick input exclusively for the game. The number of players spawned in the game is controlled by the number of 360 controllers plugged into the system :P , yes it’s lazy, but it works :)
  3. Being incommunicado for the day. This is going to sound funny, but resisting the temptation to turn on any instant messaging client or check email increased productivity by an incalculable ammount. Incalculable because a name has not yet been given to such a number. This ensured that I spend all my time focused on the game and allowed me to get into the “zone.”

What went wrong…

  1. Using LuaCheia. Unfortunately LuaCheia’s SDL bindings leave a bit to be desired. Some of the SDL functionality is simply omitted, such as the ability to access the surface pixels, while others were just buggy such their binding to SDL_BlitSurface… possibly one of the most important and used functions in the library. This lead to a lot of time wasted getting around LuaCheia’s limitations and after wasting yet more time figuring out if I was just doing something wrong. Other than writing my own bindings, LuaCheia is the only solution that used SDL so I was stuck. In the future, I might try the Lua bindings to OpenGL, or do something akin to what CipherXor did which was to create an executable that exposes higher level functionality to Lua.
  2. Fighting with the joysticks. As it turns out, Windows will recognize any number of joysticks, but either SDL or LuaCheia had problems recognizing more than 2. This effectively took the “party” out of my party game since it could only be two players, and while still fun, not nearly as cool… especially since I managed to hunt down six controllers and a USB hub…
  3. Lack of good debugging tools for Lua. Maybe I’m spoiled by Visual Studio 2005, but having a debugger is quite handy for sure. There is a Lua debugger out there, LuaEdit, and other than the fact that it’s impossible for me to use it properly unless I change my desktop color scheme (what? I like my customized scheme, and LuaEdit only half obeys it, so the menu text changes to a light gray/white color, but the menu background stays the normal white color, making them impossible to read unless you highlight each item) AND it uses a build in lua interpreter, making it inpossible to use with LuaCheia, since it is a different Lua interpreter. There are lots of editors, just few debuggers.

So, in all, it was a great experience.  We each finished what we set out to do and it was great.  I definitely am looking forward to another one.