Best Practice: creating 30+ levels for 2D platformer

0 favourites
  • 12 posts
From the Asset Store
30 high-quality 2D monsters. This asset is perfect for a side scrolling game, or even a turn based RPG type game.
  • so i'm pretty much done with my 2D platformer (8 levels so far) and i want to use the existing assets in new variations/combinations and create over 30 levels.

    what is the best way of doing that?

    shall i continue creating a new layout for each level? Is that how you guys do it? I've seen 2D platformers games that have over 100 levels, do they really have 100 pre-made layouts in the game? does that increase the download size, or loading size?

    is there a more efficient way of creating 30 levels without creating 30 separate layouts? i don't have the skill set to create 2D levels via procedural generated algorithm, but was wondering if there was something short of that technique that allowed you to reuse existing layouts.

    I'm stuck, the only thing I've come up with is this:

    ---use random generation technique to change platform size, platform angle, platform type (jump thru or not, conveyor belt or traditional platform) and also use randomly generation to place other assets (swinging vines, spring boards, etc) ...

    but leaving all that to a random generator ends up creating some retarded levels...so something better is needed.

    i have no problem hand crafting the 30+ layouts, one for each level....but my only concern is this: increase the download size, or forcing the player to wait forever while the giant game is loading.

    any advice, and past experience you can share is GREATLY appreciated.

    Thank you in advance for all of your help.

  • hyem As long as you're using the same objects in each layout (i.e. not create lots of new art assets for new sprites etc) I don't think creating more levels should heavily impact the download size, but you can test this for yourself by duplicating your existing level layout in your project (right click on the layout name in the project tab and select "duplicate"), making a build and comparing the filesize to your original.

    Alternatively you could use an array to store the positions of objects for each level and then call each level from the array, but this becomes a real headache as you can't easily call an object name directly from an array (in C2 at least, C3 allows it - yay!) and fixing bugs can be a pain without a visual reference.

    Another approach is to have a single large layout with multiple levels on it and then scroll the camera between them, but it is then harder to reset and pause individual levels and if you have a load of levels on one layout then it will take a while for that layout to load up.

    Generally it's much easier to balance, modify and debug levels from separate layouts, saving you plenty of time in the long run.

  • mekonbekon, thanks a million for your feedback. I'll do as you suggested and create the pre-made layouts and test along the way. btw, there are no new no additional art nor assets....just the existing ones being used in different combinations...so I'm hoping that, in and of itself, should not impact the game download size.

    thanks a lot for your help.

  • hyem You're welcome

  • Alternatively you could use an array to store the positions of objects for each level and then call each level from the array, but this becomes a real headache as you can't easily call an object name directly from an array (in C2 at least, C3 allows it - yay!)

    +1. I have like 3 games in Limbo because I haven't mastered spawning by array yet.

    C3 allows it - yay!)

    That has to be the

    FIRST

    good thing I've ever read about C3.

  • MPPlantOfficial

    Yeah, spawning by name is going to be a real game-changer (literally!) - it's already enabled in the C3 beta if you wanted to give a spin.

    For C2, I believe that Rex Rainbow's "Nickname" plugin and behaviour allow a workaround for calling objects from arrays:

    I haven't tried it though, so I'm not sure how much of a hassle it is to implement.

  • How I make levels in my games is I make each layout from scratch. (I also copy and paste the player movement events and stuff like that)

  • MPPlantOfficial

    For C2, I believe that Rex Rainbow's "Nickname" plugin and behaviour allow a workaround for calling objects from arrays:

    With that plugin can you sort of give objects sort of like a class. I want to know because this might make my game way easier.

  • > MPPlantOfficial

    >

    > For C2, I believe that Rex Rainbow's "Nickname" plugin and behaviour allow a workaround for calling objects from arrays:

    >

    > viewtopic.php?t=74522&start=0

    >

    >

    With that plugin can you sort of give objects sort of like a class. I want to know because this might make my game way easier.

    Let's try it then.

  • Ultimately, you would want to create a save/load system for levels, using an array or dictionary (I personally find dictionary much easier to use for this type of data handling).

    If you can do this, that means you can make your own level-editor (and maybe include that with the game itself) and just export the levels you build so that your game will simply load all data relevant to the level design. Use your different layouts as a way to control the tile-sets used if you like - but learning to use a dictionary to save and load can be super handy in the long run. It's actually easier than it seems (hey, I managed to do it, so it's gotta be easy!) to get a system working like that.

    PseudoCode:

    On SAVE

    -> loop through objects or family type for object.count times

    ---> write to dictionary at line (loopindex) data.width, data.height, data.x, data.y, yoda.mmmyes

    Loading is basically the same thing, but I find loading the data string into a global variable can be handy for a lot of stuff... but sometimes you will simply loop through the number of entries present to create objects from (again, using loopindex or dictionary line counts) to create the object and set it's data.

    There's NOTHING WRONG with doing it the way you're doing it though... it just means that if there's any expansion to the game, you have to hand craft each and every layout. Sometimes it's faster to do it that way, but with enough levels and tile-sets... it can be worth spending the time to create a level editor and save/load feature for your levels. Ultimately it can SAVE time, depending how far you're gonna go with content.

    ~Sol

  • SoldjahBoy

    thanks a million for your reply. i've used dictionaries and arrays a lot before; it never occurred to me that i can do as you suggested. thanks a million for your advice.

    my only question is this: suppose i create the level editor and save 30 levels in a dictionary. now, how do i save that from the level editor as a stand alone file that can be "imported" from the actual game. also, does that mean that an extra file must be distributed/installed by the user to play the entire game?

    can you please explain how to get the data "out of" the level editor and "into" the game during run time and how to address the file distribution?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • No problem at all mate.

    I guess there's a few ways you could go about it... if you save to a dictionary for example, and save a file from it (essentially an XML file) then you can include these files with your game and simply read from them at runtime (basically "loading" the data into your game and creating the tiles from it). If you are going with a mobile platform then honestly I'm not sure how that would work (since I think you can only access browser storage?) - I don't make anything for mobile as you can probably tell.

    You could also export these XML "saves" from your editor on your computer... then create global variables in your game hat correspond to each level, and then literally copy and paste the entire save file contents into a global variable, then load THAT into a dictionary at runtime (so you can reference the various lines of data or call up whatever else you need).

    If you are going to do a PC release though, then yeah... totally just include your dictionary generated "save files" and load them up at runtime.

    I have made some stuff with dictionaries that combine several dictionaries into a single one... for example, Dict1 is used to save the level tiles, Dict2 is used to save the entities (player/enemies), Dict3 is used to save stats for the game (lives, score, etc), then Dict4 is used to combine Dict1,2,and 3 into a single "save file". When loading the file, it is then "unpacked" back into the 3 individual dictionaries so I can re-create the objects simply using linecount, loopindex, and a single global variable that grabs each dictionary for distribution to the object(s).

    Hopefully that makes sense.

    ~Sol

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)