Procedural generation for a dodge game

Discussion in 'Game Development (Technical)' started by Kranker Apfel, Jun 19, 2017.

  1. Kranker Apfel

    Kranker Apfel New Member

    Joined:
    Jun 13, 2017
    Messages:
    2
    Likes Received:
    0
    Hi everyone !

    I'm working on a game where a cube have to dodge wall and collect bonus (see screen capture below). I've created a function called spawn_objetc(type,x,y) where type is equals to "bonus" or "wall" and x,y is the position vector. Walls can appear only on top or on bottom screen (so only two position on y) and bonus can be spawn anywhere in the screen.

    My question is how can I make a generator() function to spawn randomly walls and bonus without it's impossible for the player to collect bonus and dodge the next wall ? My game must be an infinite runner. I've already think about a timer to manage walls spawning but I don't want exactly the same distance between each walls, you understand ?

    SCREEN :
    [​IMG]
     
  2. mz303071

    mz303071 New Member

    Joined:
    Aug 9, 2017
    Messages:
    1
    Likes Received:
    0
    basicaly you would like to make something like audiosurfer

    provided that there are no dead ends and you would like to just not spawn the score item infront/behind of a wall


    you basicaly need a DATASTRUCTURE(a list/circular array/ something more complex) to keep track of wall and score items, and their location on the field: ( add items to it when you spawn them, erace when that item is collected/destroyed/ is beyond visual range)

    You will have to parse the newest additions to them, specifically their locations to avoid bad spawning of the wall or next item

    spawncycle can work with a recursive caller to try several times to spawn the item if it's location is invalid

    when possible to spawn scoreitem
    call try 5 times

    function try int several
    if several=0
    return
    random roll a scoreitem's spawn location
    check it is not infront or behind a wall
    if its ok then
    spawn it
    return
    otherwise try several-1 times
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer