Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shooting game made in Java. It's based on time, i.e you have to shoot the objects before the time runs out. Everything is working fine, except that I'm trying to implement an algorithm to generate levels. I implemented one that increases the number of game objects and increase their speed, but I don't know how to give the player an appropriate time based on these factors to provide an appropriate challenge for the player.

share|improve this question
You won't get usable code snippets until you mention the programming language you're using. – ashes999 Jan 21 '12 at 13:10
i use java but if you have an answer post it with any programming language or seducode you can answer – Nammari Jan 21 '12 at 13:12
up vote 1 down vote accepted

Part of the increase in challenge will come from reducing the reaction and aiming/firing time that you allow the player to take.

What I would suggest starting with is assuming a large amount of time per object. Let's say 5 seconds or something like that. You probably also want some initial buffer time.

So if there are 20 objects in the scene, and you start with a 5 second per-object allocation of time, and a 5 second initial buffer, your level ends up being (20 * 5) + 5 = 105 seconds.

To increase the challenge, reduce the amount of time. Since the game will get significantly harder you probably want to slow down the reduction in time over time instead of using something like a straight linear function. Something like amount of time per object = f(x) = 5 - ln(x) would be a place to start.

You can also start staggering your levels. Say, a set of 5 levels uses the same reaction time, but increases the speed. Then the next block resets the speed but uses a lesser reaction time.

share|improve this answer

I think the main thing is to make your own algorithm and tweak it. Consider first a high-level; how do you want the speed, number of objects, etc. to grow? Is it a linear curve? Exponential curve? etc.

Start with something basic like that (eg. number of enemies = level ^ 2), and tweak coefficients until you feel that it's suitable.

share|improve this answer
i understand what u are saying and i will do that but could you tell me where can i find this topic and read more about it i want to see examples – Nammari Jan 21 '12 at 13:15

lets say it takes x seconds to shoot down a game object is a specific level, where x should be calculated based on the object speed / hit points / etc., in that particular level.

let n be the number of game objects in a particular level. then you give n*x + bonus seconds.

hope it helps...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.