• Advertisement
Sign in to follow this  

Java games

This topic is 4716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement