Spawn Random Obstacles in Endless Runner

app_sauceapp_sauce Member, PRO Posts: 206
Hey Everyone,

I am new to gamesalad and mobile dev. I am loving gamesalad and reading through the forums to try to learn as much as possible.

I was able to create a ground platform that moves and recycles, but now I want to add some obstacles. My goal is to create about 50 "scenarios" that randomly spawn one after another. For Example a lake with plateforms over it, ground with boulders to jump over, etc.... The Scenarios need to be made up of different actors some that if the player runs into he dies, while others allow him to jump on. So my question is how do I link actors together to form a scenario and then randomly spawn the scenario.

Any help would be appreciated, I tried looking on forum but wasn't really sure what to look for.

Thanks
Brent

Comments

  • app_sauceapp_sauce Member, PRO Posts: 206
    I think I found a post that leads me in the right direction! It said to create sequences off screen and then to have them randomly come into camera view (based on random numbers). And have triggers somewhere at the end of each sequence that call up a random number (i.e change the sequence).

    I have created 10 sequences off screen and am in need of guidance or a tutorial that can teach me how to set up the sequences to come into camera view and set up random numbers and triggers to get my game to appear endless.

    I'd appreciate any help
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    First, Welcome to GameSalad! Second, we always appreciate it when people show initiative instead of just asking for someone else to do the hard work for them. So thank you for showing that.

    You say that you want the scenarios to spawn randomly. As a point of clarification, are the scenarios themselves random? That is, the lake scenario... is it always the same as far as platform size and location are concerned, or are those things randomized each time?

    If they are the same, you can use a table to predetermine the sizes and locations and populate the scenarios based on that data. You can also use a table to hold possible values and then spawn them randomly but that will depend a bit on your answer to my question.
  • -Timo--Timo- Member Posts: 2,313
  • app_sauceapp_sauce Member, PRO Posts: 206
    Hey tatiang,

    Thanks for the warm welcome. To answer your question, the scenarios are always the same, later I might want to vary enemies and "coins" etc. But, the platform placement will always be the same for the given scenario. I want to have enough of them that it is still engaging and difficult.

    Since all scenarios are in the same scene, how do I go about labeling a given scenario (between point A and B) to call it up randomly?

    Also, do you know any good tutorials, templates that I could look at to learn from?

    Thanks
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited November 2013
    I don't know of any specific tutorials but check GSHelper.com and DeepBlueApps.com as they have a wealth of resources related to GameSalad.

    You'll need to come up with a system that uses tables to populate the scenes, so also look for tables demos and videos. There's also a Spare Code thread with great demos available.

    I might have a demo that uses similar concepts and I'll see if I can dig it up for you.
  • app_sauceapp_sauce Member, PRO Posts: 206
    Ok, I'm having some progress but I'm running into a roadblock. I found a good demo on gshelper that teaches how to put all levels in one scene.

    So, I put all my actors on screen and built each scenario or sequence and mapped out the x and y points and entered them into corresponding tables. The demo includes a trigger in the form of a button. When I press button each scenario pops up. Obviously this is not what I want but I am unsure on how to get the scenarios to move to the left to give the endless runner look. Also, how would I set up a trigger system to make the seamless transition from one sequence to the next random sequence.

    Any help would be awesome
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @bktennis12 I don't have a lot of experience with making endless runners. Okay, zero experience. So for a first try perhaps this isn't terrible. Hope it's at least a little helpful (attached).

    Tables, however, I understand extremely well. I made these other two (included in the .zip file) a while back but they demonstrated how to pull table information in order to place actors on a scene (not randomly).

    I'm not sure about triggers... I'd have to think more about that. Others here will undoubtedly have more to say. :)
  • app_sauceapp_sauce Member, PRO Posts: 206
    @tatiang Thanks for sharing your work! I'm starting to put the pieces together on this endless runner! Tables seem to be the answer, just need to figure out how to spawn a random sequence and then have the entire sequence move to the left.
  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2013
    @bktennis12
    @tatiang Thanks for sharing your work! I'm starting to put the pieces together on this endless runner! Tables seem to be the answer, just need to figure out how to spawn a random sequence and then have the entire sequence move to the left.

    Depending on how your scene is set up . . . I would just spawn your elements and have them move through the scene . . . . . . like in tatiang's demo above.
  • app_sauceapp_sauce Member, PRO Posts: 206
    I downloaded the gshelper demo on all levels on same scene. This probably isn't made for endless runners but it has been the closest demo I have found for my game needs. I create a barrier off screen out of the way, and store all of my actors in it. I then create a table for each actor. Then I arrange actors in place to create the sequence I want. I enter the x and y points into the table. The x and y points I select are always located directly to the right off the screen. I then have them move to the left with a locked y axis at the same speed as the ground platform which loops continuously. Right now I am using the next button that was used in the gs helper demo to call the next sequence into position ( I eventually want to have in automatically spawn a sequence I have built randomly from table cell values.

    The two main problems I'm having is that If an actor is on screen and I call next sequence it disappears off screen to go to plotted location if that actor is in both sequences. How would I fix this. Also, how could I get next sequence to spawn without a next level button.

    Thanks for help.
  • tahakitantahakitan Member Posts: 102
    that's an interesting way of doing it. I went about my endless runner game differently.
  • tahakitantahakitan Member Posts: 102
    the reason it is moving back to the plotted location is because you are changing the x y location of the actor. you should be spawning a new actor instead on the right side (off the screen) and destroying it on the left side (off the screen).
  • app_sauceapp_sauce Member, PRO Posts: 206
    @tahakitan is there a way to spawn a sequence of actors to the right side. I want to have about 20 sequences, each sequence made up of several strategically places actors. These sequences should spawn off screen randomly, then move to the left, triggering another spawn of a sequence.

    It seems like it shouldn't be too difficult but I am new to this so I'm tearing my hear out trying to figure it out, but also having a great time!

    Thanks
  • app_sauceapp_sauce Member, PRO Posts: 206
    @tahakitan or put another way can i spawn the x y location of the actors instead of changing them?
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    I have an intro to endless runner tutorial here, it might help.

    http://www.jamie-cross.net/?portfolio=gamesalad-endless-runner-overview
  • app_sauceapp_sauce Member, PRO Posts: 206
    @jamie_c Hey Jamie, your tutorial helped, I used it for a ground platform. But, I want to create sequences of multiple actors and then have them spawn randomly. I'm having trouble figuring that out.

    Thanks
  • tahakitantahakitan Member Posts: 102
    edited December 2013
    here is a screenshot to my spawn box. it has 16 sequences. I used it for my game. Kamikaze ninja. it spawns on a time base. i tried to spawn when colliding with an invisible actor when it collides but it bugged sometimes and spawned multiple so i would not recommend it. make a destroy box for when it gets off the screen. make sure the screen has space for it to exit on the left side and space on the right side to spawn or else it might get deleted to early.
  • tahakitantahakitan Member Posts: 102
    runner games seem simple but can be very complicated to do sometimes. good luck.
  • -Timo--Timo- Member Posts: 2,313
    edited December 2013
    lol double comment? *removed*
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    @bktennis12, if you wanted to add a pick-up to the endless runner sample you would create that just like the platforms from the video. Start one off screen on the right side and let that first pick-up spawn the next just like the platforms do. You can adjust the placement on screen top to bottom using the Y offset of the spawn behavior and adjust the spacing between each pick-up by using a Timer Behavior to delay the spawning of each consecutive pick-up. You could use this method, the same as the platforms, to spawn and run any kind of object you want across the screen.
  • app_sauceapp_sauce Member, PRO Posts: 206
    @ jamie_c, yea I get what your saying. But, I want to spawn and run several actors in a sequence that I have created not random. For example, a 1000 wide area with 6 floating platforms over top of water, with 3 trampolines sitting right above the water, is one "sequence" the trampolines and floating platforms will always be in the same position when that sequence is spawned and runs across the screen. I want to have 20 or so more sequences that are spawned randomly, one after the other. I tried using "all levels on one scene" demo by gshelper. But, I don't want all actors in scene as I will have a lot of actors. Is there a way to spawn a sequence like I'm describing using tables? Your vid helped!
  • tahakitantahakitan Member Posts: 102
    my post shows how to do that. you don't need tables though but you can use them.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    @bktennis12, check out the attached file. I used the sample file from my previous tutorial and edited it so it runs a specific order of platforms at the same spot on screen each time in a continuous cycle. Is that what you are looking for?

    After you get done with one cycle, you can have the last platform in that cycle spawn the first platform of the new cycle and so on...
  • app_sauceapp_sauce Member, PRO Posts: 206
    @tahakitan Thanks a lot !! I'm trying to incorporate your spawner. Also I played some Kamikaze Ninja, sweet game that is the sequenced effect I'm going for. Random yet controlled! I'll see what I can do.

    Thanks again
  • tahakitantahakitan Member Posts: 102
    becareful on how much you spawn at once. if you spawn to much it can lag. I spawned my sequence in chuncks every .01 seconds. it reduces the lag if your png are large files.
Sign In or Register to comment.