Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

right now in my game I generate all my objects at the start of the game off screen, then move them down the screen to give a "side scroller" effect, then once they hit the bottom of the screen move them to the top again.

I want to change this as I want more control over these objects and want it to be done procedurally, so done at runtime.

My understanding of it would be to create and destroy the objects whilst the game is running, say there are 5 different objects would you recommend maybe having a random number counter and if said number == 1 then spawn type 1 object?

There are some factors I need to bring into the algorithm though, obviously I will handle speed and different textures within the objects classes, but how would I go about say object 1 being more likely to fall down the screen than object 2? how would I implement my gameSpeed variable into this, so the higher the game speed the faster they fall and more frequently they fall. Most of all how can I be assure that there is always a path through the objects, how do I define what path these objects will fall down?

I'm sure there is already an algorithm I can adapt to this problem, an article that I would find useful or a user on here that has an insight that will be more than helpful.

Cheers

share|improve this question

put on hold as too broad by congusbongus, Krom Stern, bummzack, Josh Petrie 17 hours ago

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Procedurally does not necessarily mean that it’s done actively during the game. Everything generated at the “start of the game off screen” is still procedural if it is based on an algorithm as opposed to being manually defined. –  Matthew R Jul 28 '12 at 16:49
    
Assuming that you’re currently using manually defined “game objects” then the exact kind of procedural generation is going to depend extensively on the style/rules of your game. The question of “most of all how can I be assure that there is always a path through the objects” question makes me think that the game design you’re working on would benefit more from a manual “map based” design with at most limited procedural/random elements. Purely procedural/random level design / gameplay is usually only utilized in more abstract puzzle games. –  Matthew R Jul 28 '12 at 16:50
    
If you can give more details on the game you’re designing I might be able to be more helpful. –  Matthew R Jul 28 '12 at 16:50
    
Thanks for your comments, its a never ending vertical scrolling game. The character has to avoid falling objects, the objects falling give the illusion that the character is moving forwards. Whats the best approach here do you think? –  Lewis Jul 28 '12 at 17:00
    
Are the object locations grid aligned or positioned based on arbitrary x,y locations? –  Matthew R Jul 29 '12 at 0:44