Writing a Video Game in Java (Part 1) – Planning and Preparation

Geometry Wars

It’s finally Spring Break and since I haven’t written any significant non-school programs in a while, I’ve decided to write a game. My first significant program was an abstract 2d shooter that I wrote in the first semester of my sophomore year of high school. Needless to say, I wasn’t much of a programmer then and my code was horrible and inefficient. But, it was really cool to be able to write a game and watch other people have fun playing it. I’ll be writing a similar game and trust me, it’ll be leaps and bounds above my first attempt years ago. So, I thought I might as well document the process of designing and coding the game. By Friday, I should have a fun little playable game in the vein of Geometry Wars and Everyday Shooter.

I’ve had ideas to incorporate into this game for months now. But, I still haven’t chosen which subset of those game mechanics and features to incorporate. I can’t just put everything in there. They need to consistent. I’m going to sidestep the issue for now. Initially, I’ll focus on the engine and the core game mechanics. This involves setting up the graphics, game controls, and the basic game environment. In a day or two, you should be able to move the ship around and shoot and destroy enemies. All of the other ideas build on top of this core.

Planning is very important to building a game. You want to have a base that can give you a lot of flexibility in the future. I thought of a number of optimizations I can put in the game engine, but I won’t be adding them in the first version. I might not even need to if the game runs as well as I want it to. However, I’ll make sure to build the game so that it won’t be much trouble to add them in later. For example, I’ll initially implement a particle system class that is simple, but inefficient. When I get around to making it more efficient, I can just plug in a different class. I shouldn’t need to change anything else if I designed its interface well. I think I have a pretty good idea of what components I need to create to have a game running. This time around, I’ll split functionality a lot more. I don’t want huge monolithic classes like I had in previous projects.

A key component of planning is choosing the tools to use. I considered using PyGame, but I didn’t want to deal with making sure my audience had Python on their computers. Even converting the game to an executable via Py2exe would have limited my audience to Windows users. Plus, I’ve never used PyGame. Yes, I should be trying new things, but PyGame’s disadvantages are great. I considered using Processing, but I felt like I didn’t need it. It’s meant for people to get started really quickly without having to know much of the technical detail. I’ve coded simple engines in the past and even have the code for all of those projects, so I though Processing would hamper me more than help me. I considered using a Processing plugin for Android, but it wasn’t completely mature, so I didn’t bother. So, I’ll be sticking to what I know: Java. It allows me to reach any platform with minimal effort. I’ll just be using the standard libraries. Sure, I can use JOGL or other libraries, but they are just not needed for this game. My IDE will, of course, be Eclipse.

So, there: I’ll be updating this blog every day or so. The next post should be about how the engine is set up and the basic design decisions I had to make in creating it.

  1. Today’s video games are becoming just as complex and realistic as feature films – with the latest hardware allowing developers to push their character models, vehicles, and landscapes to new levels. And as the possibilities continue to evolve, the need for talented artists in video game production is more important than ever.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: