I want to make video games.

Started by
2 comments, last by !Null 11 years, 8 months ago
So, I want to learn how to make video games. I do have knowledge of Java. You know, classes, methods, if statements, etc. But, I want to learn how to make the code be for a game. I've made some simple text applications, but I want to make a game. Not the-best-thing-in-the-world, just a simple game, like a Tetris Clone, or a platformer.
Advertisement
1) Open the java documentation.
2) Look up how to display images on screen, grab input using a KeyboardListener and get the current system time in milliseconds.
3) Write a fairly basic gameloop


timestep = 20; //20ms between each frame.
lastFrameTime = currentTime = GetTheSystemTimeinMilliseconds();
while (theGame.isRunning()) {
currentTime = GetTheSystemTimeinMilliseconds();
while (currentTime+timestep > lastFrameTime) {
checkInputAndUpdateFlagsAsNeeded();
theGame.update(timeStep); //timeStep might be a property of theGame instead.
lastFrameTime+=timeStep;
}
renderer.drawStuff(theGame.getRenderableObjects);
renderer.drawGUIStuff();
}


There you go, a basic game loop, all thats left to do is to insert proper Java methods for input, timing and rendering and create a game class that has an update method that brings the simulation one step forward each time its called.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
It seems that you want to focus on programming. If you already know the basics, then I would focus on getting as much practice in and really enforcing your software architecture skills. You should learn new paradigms and work on creating modular, reusable, simple, and clean code that works. Start small, and build on top of what you've previously created.

Search for things like the subscriber/observer patterns, MVC architecture, entity system architectures, and so on... This should point you in the right direction.

Try the "Thinking in Patterns with Java" by Bruce Eckel.
you mentioned making a Tetris clone.

I was once in the same position as you and with Java I stared with Slick2d.

Here is the slick site
http://slick.cokeandcode.com/

you will need slick2d and Light weight java game library (lwjgl)

There are many tutorials on there site but one for tetris is.
http://slick.cokeandcode.com/wiki/doku.php?id=02_-_slickblocks

It sounds like you know all the basics as french_hustler says. But at first I would say follow tutorials and read what they say, and type it out (even if you don't understand whats going on)
after the game is working, try to work out bits of code you don't get, things like commenting out the code to see what's going on, or try changing code to mess about with it.

Once you understand what's going on, try to make your own really simple basic game. Slick is good because it handles the game loop for you and you don't have to worry too much about double buffering or flipping.

If you do decide to take this approach and want some help. I'm happy to assist if you have any questions.
/********************************************************************************\
/**********************He Who Dares, Wins**********************************\
/********************************************************************************\

This topic is closed to new replies.

Advertisement