How do I manage multiple room layout

0 favourites
  • 12 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • When making a sidescrolling game, all I can think of is everytime you leave the screen go to another layout. For a few levels that's alright but when you start to going further this becomes a nightmare.

    I've seen in the metroidvania gamekit from the scirra store a way to do this with 9patch and roomzones but that is way out of my league. I'm a total beginner and that's too advance for me.

    Are these the only two options?

  • Whats wrong with multiple layouts? What kind of problem you have?

    Just remember that you can set some layers as constans. For example hud. So you dont have to copy past them.

  • Whats wrong with multiple layouts? What kind of problem you have?

    Just remember that you can set some layers as constans. For example hud. So you dont have to copy past them.

    Is not easy to organize the go to layout gates for each room, and I will end up having way too many rooms, which means way too many layouts. It's not really practical and I'm scared to run into some performance issues.

  • Just have 1 invisible box. On collision go to 'next layout'.

  • If you are worried about management in the event to keep control of which is what. I did find out that if you can do a function here with a call back. If you name your room to a number or a name. (at this point id keep a journal to write down which room goes where.)

    Such as this place a variable on that invisible sprite label it to the room that you want to go to. Next create an event like this if player is overlapping the sprite have the action to be call function With parameter 0 to be the sprite's variable

    Next create a function go to layout by name (function.param(0))

    now you only have one event one function and one sprite to manage thousands of rooms (layout) transition.

    Now real way of how metrovania did their game was through tileset and array loading. and pretty much only a few layout.

    Such as this when they do the scene change they had you go through a portal of some sort and they would just rebuild the room using array and ID each number to the tilemap.

    Back then they were true genius they could morph a 1 gb game down to like 20 MB due to array being able to compact data building very efficient.

    i could go on for days how they built every stupid level with arrays alone lol

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I tried something like this once. To put it simply, I used "camera landmarks", that allowed me to control the camera considering the relative player's position. Here is some sketch to illustrate the concept.

    The red area represent the OriginalWindowWidth. It is clearly NOT wide enough but... well. Let's forget about that.

    We consider the player comes from the left.

    Red blocks are camera landmarks. When the player is out of the red area, the camera is following the player. When the player enters the red area which begins at cameraLandmarks.X - cameraScreenWidth / 2, the camera stops (to indicate the end of this layout part has been reached). Then, when the player cross the green line (go to another part of the layout), the camera moves to cameraLandmarks.X + cameraScreenWidth / 2. Etc...

    That was kind of messy actually, but the fact that you point out the problem make me think I should try to make it properly.

    Hope that gave you some inspiration at least.

  • Just have 1 invisible box. On collision go to 'next layout'.

    I do that in a way. I have one invisible box with a variable. The variable is the name of the layout, so I use go to invisiblebox.variable layout.

    Once again, that is not the problem. The problem is I will end up having way too many layouts, one for reach room. Like I said my problem is not layout switching, is keeping it efficient.

  • If you are worried about management in the event to keep control of which is what. I did find out that if you can do a function here with a call back. If you name your room to a number or a name. (at this point id keep a journal to write down which room goes where.)

    Such as this place a variable on that invisible sprite label it to the room that you want to go to. Next create an event like this if player is overlapping the sprite have the action to be call function With parameter 0 to be the sprite's variable

    Next create a function go to layout by name (function.param(0))

    now you only have one event one function and one sprite to manage thousands of rooms (layout) transition.

    That's pretty much what I figured out to do. I just have one sprite and one code for everything BUT my question was if there was any way to avoid having one layout for each room (You mentioned the array I mentioned on metroidvanias but that's far too advanced for me).

  • I haven't done this myself as I would use arrays to make a level editor and loader but maybe you can use the save/load function to make a really simple editor.

    If you make an editor where the objects of your game have the same name as in the game itself, you should be able to place the objects anywhere on screen and use the SaveStateJSON expression after On save complete or On load complete to return a string with the contents of your room.

    You can save these strings in a project file which you can place in your game. There you can load that file and the layout will be built up just like it was in the editor (just be sure that every object has the same name as in the editor).

    As I said I'm not sure if this even works but it's an idea.

    I hope this helps!

  • > Just have 1 invisible box. On collision go to 'next layout'.

    >

    I do that in a way. I have one invisible box with a variable. The variable is the name of the layout, so I use go to invisiblebox.variable layout.

    Once again, that is not the problem. The problem is I will end up having way too many layouts, one for reach room. Like I said my problem is not layout switching, is keeping it efficient.

    Hello there,

    If i understood correctly, your main concern would to have for example, 50 "maps" on your game, so meaning 50 layouts (at least), right? Well, i just tought one thing you could do: have a couple layouts big enough to "comport"/"can contain" (cant find a word in english) smaller maps.

    For example, having a window of 500,500 and one layout of 2000,2000 you could easily have 4 independent maps full window sized. You'd need to just spawn your player on the correct map on the layout, and ofc having some walls between the maps making the player unable to walk by.

    If you played Tibia or any other top-down game like this you'll probably understand what i mean. If not: in Tibia you can go to the sewer, under the town. Dependending on the entrance you use, you'll get to one are or another, and can even see the other areas when on the sewer.

    Edit: as your game is sidescrolling (im considering you have a goal on the edge of the layout), one example would be: window size 500,500, map layout 2000, 500, ok? Then if you have 3 maps you can put then one on top of each other having a final size of 2000,1500 for example, or even greater/lesser width.

  • Smileh

    Another way would be to add another layer, or 2...set invisible - set objects collisions on that layer to disabled.

    When your player gets to that exit, create a transition (like you would normally to go to next layout.) And then set the layer he just came from to invisible and destroy all the objects on that layout

    Set that bottom layer to visible - objects collisions to enable.

    It would be a lot of events and actions, but you could do this for a lot of maps.

    If player is on layer "map bottom" destroy objects on "map top".

    Then once your player gets to the exit to go to third map...create objects at their X and Y position. You'd have to put each object in the editor and record their position in the event sheet.

    Event Sheet - Map 3

    Player is on layer bottom - condition - player is overlapping exit box > System - create object > x on layout "map 3" at x and y position.

  • Hello again! I used my day to make a pretty nice template of this problem, that would look like pretty much the Metroidvania template (at least from what I could see on the screenshots). I'll post it on the store pretty soon if you're interested!

    EDIT : Here it is, the demo of my Multiple-Rooms Layout template ! It will soon be available on the store. But once it is, I'll give it to you for free if you're interested

    Item now on store ! I send you a redeem code by PM Smileh!

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