Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

877107 Posts in 32847 Topics- by 24287 Members - Latest Member: huntingbird3.0

May 18, 2013, 02:35:18 PM
TIGSource ForumsDeveloperCreativeDesignHelp on how to develop a game like this...
Pages: [1]
Print
Author Topic: Help on how to develop a game like this...  (Read 500 times)
liamzebedee
Level 0
*


View Profile
« on: January 30, 2011, 09:36:12 PM »

Ok so I'm new the game development world. I have had previous experience in programming before and understand the Java language structure. I am now attempting to develop a game with my friend Jack. I understand the basic game loop of a game-
  • check the game hasnt ended
  • if it hasnt do this..move sprites etc
What I am wondering is how is a Java game structured. I have already written some initial code for my game for, starting the form, setting its size and title. Is there a library I could use for this?
Logged
liamzebedee
Level 0
*


View Profile
« Reply #1 on: January 30, 2011, 09:38:54 PM »

I forgot to add in Java
Logged
Triplefox
Level 9
****



View Profile WWW Email
« Reply #2 on: January 30, 2011, 11:11:15 PM »

This should probably get moved to Technical but I'll answer anyway.

The game loop has to handle approximately four major things(more if you start thinking about audio, networking, etc.) - first timing and rendering, then input and gameplay events.

For timing, rendering, and input you can use a library such as Slick. It provides a framework for these things, and a starting point(an update() callback that you program) for the last.

For events, it depends on what the needs of the game are. You have to define the "fundamental rules" of the game space(how things collide or otherwise interact, spawning and despawning of entities, etc.), and the order in which these events occur during the course of the update; a well-coded update will produce a transparent, "instantaneous" result to the player, while bad ones will introduce bugs or additional frames of latency before events register.

An easy way to get started is to create a data structure that is used to render something on the screen, and then add a hook from player input into the data structure, so that it can move around over time(optionally, with physical properties like velocity and gravity). Later, as you start to introduce more onscreen objects and want to have each of them interact with each other, you can break down the process into more detailed "stages" and "subsystems" of interaction.

It's important to recognize that when designing the loop, you usually want to batch process each category of event - i.e. do all collisions at once, and only afterwards handle the resulting spawns/despawns - so that the entire system remains stable. Disturbing the game state in more than one way at one time will cause a combinatorial explosion of complexity and edge cases.
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic