Skip to main content
GameDev.net gamedev.net
🔒 Locked

Java games

Started by Sighmaster Mar 16, 2005 at 6:39 PM 2 replies 1.2k views
Original Post
Sighmaster
Sighmaster
Erk. I have a slight problem. I'm working on putting people in this room that can move around and stuff, in Java, my native language :D. But I don't know how to get everything working. My code has always been to solve one problem or another, all math based. I can't seem to get the game going with no idea how :S Please help!
Palidine
Palidine
The biggest stumbling block for me was figuring out the basic algorithm. the general structure for the contents of a game's main function is something like:

while (isRunning){    updateEverything();    drawEverything();    if (userWantsToQuit())        isRunning = false;}


outside of that you have data structures (classes, vectors of classes, etc) that hold your "people that can move around and stuff". so your update would look somthing like:

void updateEverything(){    for (int i = 0; i < peopleVec.size(); ++i )    {        updateThisPerson( peopleVec[0] );    }}


-me
JTippetts
JTippetts
I wrote up a short little explanation of the game loop code put forward by Javier Arevalo several years ago on Flipcode. You can find the write-up here. It's in C++, but with a little thought you should be able to adapt it to pretty much any language.

In short, the loop does pretty much what Palidine stated. It gathers input, it renders the view, and it performs logic updating.
snufer
snufer
Hi there

I might be able to help you to get you started.
I wrote a real-time strategy engine in Java so you might benefit
from some concepts that I developed...

goto: http://www.nullpointer.ch/publications/index.php and check out
the pdf...

Feedback to me if it was any help...

It's also posted on the For beginners forum: Topic: Real-Time-Strategy Games Development

Regards

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.