How do I manage multiple room layout

Get help using Construct 2

Post » Tue Oct 18, 2016 3:30 pm

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?
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Tue Oct 18, 2016 4:08 pm

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.
B
21
S
3
Posts: 73
Reputation: 1,488

Post » Tue Oct 18, 2016 7:36 pm

hobibit wrote: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.
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Tue Oct 18, 2016 11:13 pm

Just have 1 invisible box. On collision go to 'next layout'.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Wed Oct 19, 2016 5:39 am

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
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Wed Oct 19, 2016 8:21 am

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.

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

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. :lol:
Image
B
10
S
3
G
2
Posts: 68
Reputation: 1,696

Post » Wed Oct 19, 2016 1:00 pm

jeffige wrote: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.
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Wed Oct 19, 2016 1:03 pm

Gearworkdragon wrote: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).
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Wed Oct 19, 2016 1:41 pm

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! :D
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Wed Oct 19, 2016 2:27 pm

Smileh wrote:
jeffige wrote: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.
English is not my native language. Sorry for any mistakes and feel free to correct me if needed.
B
14
S
5
G
3
Posts: 113
Reputation: 3,231

Next

Return to How do I....?

Who is online

Users browsing this forum: mrkaio, Zav and 1 guest