As many of those reading may be aware (at least those on our games sites), I work offsite. Probably less known though is where; I'm currently studying programming at university, with hopes to move on into Stardock's game development team after I finish my degree.
So anyway, this semester I'm studying C#. As part of this, we're going to have an open project at the end of semester, in which we will make pretty much anything we want, so long as it demonstrates a sufficient skill and knowledge in the language. While the professor is a command-line die-hard, referring to anything with a GUI as "dog and pony show", we have the option to make our projects as fancy as we like.
Toward that end, I had some time this past weekend and figured I'd better try and get a handle on at least getting 2D graphics on-screen in windows programs, beyond the simple form elements that you can drag and drop in Visual Studio. First I looked around for some tutorials on GDI or DirectDraw, but couldn't find anything all that helpful. So I then looked around for some stuff on XNA, and came across this pong clone tutorial.
|
|
Pong main menu. |
Pong, with tweaks. |
An hour or two of typing and copypasta later, it was done, with at least some portion of it having sunk in. It wasn't without incident, at least, as it seems the tutorial's author (despite best efforts to get it perfected) had left a number of mistakes which I had to correct along the way. Mostly small things, like using one variable name in one section or in the class description, but in the actual code he provided, he used another. Some bugs were significantly less minor though, like reversing the width and height in the part where the maximum "table" dimensions (the area where the ball can roam), such that the poor computer player could never hit the ball, because it disappeared 200 pixels before it reached his paddle.
To ensure that I understood the mechanics of the pong game, I made a few changes and tweaks, such as adding walls and obstacles to the table. Also, I made the player paddle larger and faster
Overall though, I came away from it with one major thought: XNA makes basic game development brutally simple (as programming goes). I had expected to have to deal with more nitty-gritty API stuff, setting up a main loop, dealing with timing, etc. (and will, when I get around to trying and figuring out how do to all this in C++ and DirectX), but XNA completely obscures all of that and any need for more than a general understanding of C# and object-oriented programming. All the "hard" stuff is nicely tucked away in the base classes, which yours can inherit from, and you can literally toss together a (very) simple 2D game in less than a day, from scratch.
Certainly, things will get more complex when you bring 3D into the picture, but short of that, it seems that pretty much any aspiring programmer should be able to get right into XNA with ease.
Back to the development: after finishing the pong tutorial and tinkering around with it for a while, I decided to see if I could put all the pieces to use with making a 2D scrolling shooter, following the same general structure and class hierarchy as used in the pong game (but making improvements and boosting efficiency along the way). That's for another journal, but here are some preview screens to cap this one off:
|
|
Main menu--look familiar? |
A lone Drengin fights for his life... |