Let’s Make a Video Game!
I’m sure you’re like me and you’ve probably thought making video games would be the ideal dream job since as long as you can remember. So what does it take to make one? Let’s do a simple one.
We will be using Windows 7 for this, but if you are using Windows 8 or 10 there is various ways to get to the same settings.
Disclaimer: This is a deep dive into a native program. If you are 100% new to programming this MAY go over your head but stick with me.
How Do I Start?
So typically people who want to start somewhere often agonize over the actual starting of the project. There so many options! What programming language? 2D or 3D? So many options!
Let’s keep it simple and start with a classic. We’re going to do Space Invaders in Java.
Defining Game Mechanics
First, let’s talk about defining the mechanics of our game. To start with, we’ve got a couple of specifications that we can talk about that will keep us busy for at least a few posts.
We need to have 3 kinds of basic actor entities: an alien, a player, and a blaster-laser-bullet-thingy. There’s more but we can add those in later.
The alien is going to move side to side and down based on time intervals.
The alien is removed from the game if it collides with a blaster shot entity.
The alien will increase its speed whenever another alien is removed from the game.
The player supplies input to move side to side.
The player initiates/creates a blaster shot upon inputting a fire event
The Blaster Shot:
The Blaster shot travels directly vertical from its point of creation.
The Blaster shot is removed from the game if it collides with an alien entity.
The Blaster shot is removed from the game if it travels beyond the game’s boundaries.
Setting up Our Dev Environment
Now we’ve got to set up our dev tools. First we’ll need the Java Development Kit from Oracle(JDK). Don’t confuse this with the Java Runtime Environment(JRE). The JRE only contains the minimums to run a Java program, not develop it.
Once you’ve installed it, hold the Window Key and the Pause key this will open up Control Panel -> System and Security -> System
Click Advanced system settings
Click Environment Variables and create a new variable in the lower window called JAVA_HOME
and point it to your install location
Edit the Path variable and append %JAVA_HOME%\bin
Path Entries are separated by semicolons (;) so you may need to put one in front of JAVA_HOME to separate it from the previous element.
To test your Java install, pull up your console window by pressing Window key + r
type: echo %JAVA_HOME%⏎
then: type java -version⏎
You should see the above result.
Next we’ll need an IDE(Integrated Development Environment). You have 3 to choose from in Java. Netbeans from Oracle, Eclipse from Eclipse foundation and IntelliJ from JetBrains. We’re going to go with Netbeans since it requires the least amount of configuration of the 3 and will get us started quickly. If you prefer to use one of the others by all means go for it.
Ok, now we have everything we need for some Java programming!