I have three projects this semester. Due on the 15th of December is a group project where we’re attempting to make a highly emergent game in the Unity engine. For December 8, I need to create a game level for Gamewords as Fields of Expression – I’ve decided to use the UDK because it has good CSG tools so I can produce something relatively good-looking without doing any real modelling. Also for December 8, I’m working on a game prototype with my mother as a target audience for User Experience and Prototyping. This, I’ve chosen to use XNA for, because I’m a masochist.
There are two reasons I chose to go with XNA. The weak reason is that my target audience (mom) prefers to play games on her Xbox 360 than on her PC, primarily because the gamepad is more ergonomic and its buttons are better structured semantically. XNA already has all the gamepad stuff taken care of so I can concentrate on translating the input into useful output rather than figuring out what the input is in the first place. However, the real reason for choosing XNA is that I’ve been wanting to learn C# for ages.
C# is a proper programming language, unlike eg. LUA or Uscript or NWscript (which is the language that taught me about programming), but at the same time it’s a very tidy and approachable language. Everything I’ve heard about C++ indicates that it will destroy your soul if it’s the first language you attempt to learn, which is why I didn’t opt for that despite it being far more popular for game programming. I’d heard C# was supposed to be a lot easier, and since it’s derived from Java the same way NWscript was, I’m more or less familiar with the syntax already.
It’s not been easy to pick it up though. I tried going by some Internet tutorials first, and while I did manage to set up a game with a movable avatar, it didn’t really help me understand what I was doing or how it worked. I took out a couple of XNA books from the university library and one of them (Grootjans, Riemer: XNA 3.0 Game Programming Recipes) proved incredibly useful for setting up the basics of a 2D game and writing a general-purpose menu system.
Ultimately I’ve learned the most from my friends. My class mate Prakash was generous enough to give me a whole day’s worth of his time to walk me through setting up a hex grid with some code I’d found on the Internet and figuring out the player movement scheme. Shane, Jim, Mads, Mike, and Nick have all been tremendous help in answering specific questions, mostly pertaining to where I should put certain code or what particular errors mean. I’m very grateful that I know so many skilful programmers.
Yesterday I experienced a bit of a personal triumph when I managed to set up a follower selection menu for the player to choose which people to have in her expedition when the game starts. It involved two lists that the player needed to be able to scroll through and switch between at will, and it was quite complicated for me as an absolute newbie programmer to set up, but I managed it almost without help (mainly needed Shane to tell me if I had to add a certain variable to keep track of the current scroll progress or if I could infer it from the existing variables – he told me to just add the new variable). It’s nothing even close to the most impressive code ever, but the fact that I managed it shows that I actually understand how my menu system works, which is good because I’ll be using it a lot.
I’m sure any real programmer unfortunate enough to look at my code would, depending on their inclination, either cry tears of blood or just start laughing and never stop. For one thing, I know there are lots of more advanced functions I don’t really know about – I bet a lot of the more laborious if’s and switches I have could be replaced with arrays or other far more elegant solutions for example, but I’m sticking to what I understand for now. Make it work, then make it fast, as they say. Another thing is that I don’t understand encapsulation and I only half-understand inheritance. I have a feeling 90% of my public variables ought to be private or protected, but I don’t know how to move the necessary information between game objects in the proper way so I use whatever ill-advised shortcuts will get me the results I need.
So that was a bit about my troubles with getting into programming. Diving head-first into it with a fairly complicated system-based game project is not the least painful way to learn to program, but it’s the only way I can stay motivated (knowing I’ll have an awesome product to show for it when I’m done). Now the skill and expedition selection menus are done, the next hurdle is to set up a system for reading tile properties from a CSV file and apply them to the grid, and a system for calling individual event scripts when the player lands on certain tiles. Once that’s done, it should be downhill the rest of the way towards the hand-in date.
Once I have a bit more of the game to show off, I’ll probably post again with more information about the actual game, and eventually there will be an installer for you to download so you can try it out yourself. It’s going to be fun! I promise.