GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Random level generation

MoogusMoogus Posts: 77Member, PRO

Hi guys Moogus here

I'm new to GS and almost finished my first game and starting my second.

I was wondering if there is a way to randomly generate a level ??

To be clear do I have to design all my levels or is there a way to automatically place walls, objects and platforms around ??

Thanks

M

Comments

  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO

    Hi @Moogus, yes there is with random attribute changes for x and y placements within set limits (depending on which object you want placed). This could get a bit "messy" though and produce unexpected results, if overlaps, etc are not accounted for.

    So I'd recommend a more straightforward way (though more time-consuming; based on the principal that once you've imported your graphic elements - walls, objects, platforms, etc - into GameSalad, no matter how many times these are used, it won't add hardly any more to the size of the game.

    So... make all of your different levels, just as you want using your elements, on as many new scenes as you want (not forgetting to duplicate any controls used on each).

    The best way to do this: make your first scene with your walls, objects, etc., in place, as well as any controls, buttons, backgrounds, type and other graphical elements that'll appear on every other level.

    Next, in an actor acting as the button for the next scene (or in a hidden actor from the playing area triggered with a boolean to go to the next scene):

    Rule: When touch is pressed
    Change Attribute WhichScene to random(1,50) -- or how ever many scenes you've got)
    
    Rule: When WhichScene is 1
    Change Scene Scene1
    
    Rule: When WhichScene is 2
    Change Scene Scene2
    
    Rule: When WhichScene is 3
    Change Scene Scene3
    

    etc., up to 50 (in this example)

    Once this is done, duplicate it on the Home page > Scenes by holding down alt-shift and dragging it. do this for as many scenes as you need. Then go into each scene, rearranging the "furniture" as you want.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MoogusMoogus Posts: 77Member, PRO

    Thanks for the reply you can just > Home >Edit-Copy Scene>Paste = new scene, simpler.

    @gryscope thanks for your help, but not quite what I had in mind. I was wondering if GS could generate the level randomly with obstacles in random places when there is a change of scene.

    M

  • CodeMonkeyCodeMonkey Posts: 1,803Head Chef, Member, PRO

    @gyroscope You can change Scene by index instead of large amounts of logic. Mac 0.11 or higher. Coming to Windows soon.

    @Moogus you can generate the level randomly but you need to make up the rules about how things spawn while making a valid level. However, if you have the data about how the level is set up(obstacles and walls in certain positions) then you can have just one play scene and spawn everything you need. The Cyborg Cypher template on Marketplace does this. All the levels are set up by table rows and there is even a level designer that spits out the data you need for the level. However, you also need Mac Creator 0.11 for the text manipulation functions.

  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO

    @CodeMonkey said:
    gyroscope You can change Scene by index instead of large amounts of logic. Mac 0.11 or higher. Coming to Windows soon.

    Excellent, thank you, @CodeMonkey :)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO
    edited September 2014

    @Moogus said:
    Thanks for the reply you can just > Home >Edit-Copy Scene>Paste = new scene, simpler.

    gryscope thanks for your help, but not quite what I had in mind. I was wondering if GS could generate the level randomly with obstacles in random places when there is a change of scene.

    Hi @Moogus yes, I got that... and yes, there is a way, using random function but just using that alone, you'll get overlaps all the time, obstacles that'll completely block in your player, etc if your barriers are relatively large. You'd have to consider quite a few parameters to make sure that doesn't happen.

    Hence my suggestion - a bit more work but at least that way you know what you're getting.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MoogusMoogus Posts: 77Member, PRO

    @gyroscope yes I have come to the same conclusion as you mention. In the end i just made a scene template then moved walls/obstacles about then added actors.
    Game now being beta tested for release to Apple.

    @Codemonkey I'll check out the template, as I haven't used tables yet and sounds like it would help somewhat with other games.

    Thanks guys *thumbs up

Sign In or Register to comment.