GameMaker Metroidvania Rooms and Map

T

TheTrophieStars

Guest
I'm trying to wrap my head around two issues with creating a Metroidvania game. The first is knowing that it is possible for a player to be "created" in different parts of a room depending on how that room is approached, and the second is understanding how to create a map that represents the relationship and structure of the game's levels. Does anybody have some insight or resources to solve these problems?
 

lolslayer

Member
Yes it's possible, and you need a persistant object for that.

There are multiple ways to approach this problem, but the easiest way is when you go from one room to the other, the persistant object stores the information if you go out left or right in a variable and the y (height) the player was before switching to the other room. On creation of the room, the player object uses that information to spawn at the correct location.
 
T

TheTrophieStars

Guest
Wouldn't that require rooms with the same size? I was thinking about a similar system, but with an exit/destination system. If you go in exit a, you come out placed at destination a in the next room. But how can I communicate this relationship across rooms?
 
D

Deleted member 13992

Guest
What's wrong with just keeping a persistant "database" of your rooms, their various entrances/exits as x/y coords, and what links to where? I don't think different room size is a problem whatsoever.
 

Fabseven

Member
Aren't globals variable in all rooms ?
When accessing a new room you could store your current direction in a global variable and use it in the next room ?
 

CMAllen

Member
Wouldn't that require rooms with the same size? I was thinking about a similar system, but with an exit/destination system. If you go in exit a, you come out placed at destination a in the next room. But how can I communicate this relationship across rooms?
The x/y coordinates are relative. In fact, all coordinates are relative, really. What you're really doing is capturing relative location information of the player in one room and translating it to an equivalent location in another room. If an adjacent room is supposed to be elevated 100 units above the current room, then the relative location of the player object is changed by that amount when the player moves into that adjacent room (using whatever method you've created to handle room transfers). But really, when a room transfer takes place, you can set the player location to anything you want in that same code event, and the player will never know the difference.

Now, if you're asking how to go about creating that same kind of seamless transition between two rooms (one room panning in as the previous room pans out), that's a little more complicated.
 

kburkhart84

Firehammer Games
It is also possible to just have it controlled by objects. You can have "teleporting" objects that you collide with as you go through doors. You can then use the instance variables(which can be set differently even with the same object) to set which room you go to, as well as the x/y and direction(if needed). Then on collision of your player with the teleport, just change to the room based on that variable, setting the x/y as well. Note that if you want some kind of smooth scrolling between the two rooms, this won't work directly, unless you do some sort of fadein/out.
 
T

TheTrophieStars

Guest
I think I figured out a system. I have a persistent object called obj_room_controller. And then I have obj_room_trigger and obj_room_anchor when a player collides with obj room trigger, it sends the player to the next room, and sends an arbitrary number (that I put into the create event) to be stored in the room_controller. When the next room starts, the room_controller looks through all room_anchors there and finds the one that matches the stored id. Then the player is moved to that location.

The next dilemma would be figuring out how to stitch together a map that properly represents these rooms and their relationships to one-another, and have the player know where they are.
 

NightFrost

Member
As already explained above this is basically a connecting door problem, where each exit needs to lead to a specific entry point in another room. I've explained how I manage that in this post.
 
T

TheTrophieStars

Guest
No, I've created a room transition system. What I meant by the second thing I said is how to take all of those rooms and "draw" a map of them.
 

RangerX

Member
On a more technical note, it really depends what you want to achieve.
If you want a grid-like map like Metroid or Castlevania, you will need set up a grid that corresponds to coordinates of your world and then draw some grid cells with different colors for a room, a wall, a visited, room, different room types, etc.
For The Life Ruby I took a totally other approach (far easier one for me at least). I simply take a picture or my world/zone, shrink it by 4 and then I redraw my map on it manually. Once that background is done, I draw it in the game with the icons of the different things I want to appear on it.

 
T

TheTrophieStars

Guest
On a more technical note, it really depends what you want to achieve.
If you want a grid-like map like Metroid or Castlevania, you will need set up a grid that corresponds to coordinates of your world and then draw some grid cells with different colors for a room, a wall, a visited, room, different room types, etc.
For The Life Ruby I took a totally other approach (far easier one for me at least). I simply take a picture or my world/zone, shrink it by 4 and then I redraw my map on it manually. Once that background is done, I draw it in the game with the icons of the different things I want to appear on it.
Your approach sounds like it is restricted to only drawing the current room if I'm understanding you correctly, and by what it appears to be in the screenshot. I would want a map that shows how all rooms connect with one-another. I'm trying to wrap my head around the logic for that.
 
T

TheTrophieStars

Guest
I went into brief detail as to what you can do to track where a room falls in a map in this thread: https://forum.yoyogames.com/index.php?threads/metroid-style-map-with-different-sized-rooms.9937/

I can go into more specific detail if you'd like, but it's a start.
I think I understand most of what you explained in that post, what I'm left wondering is how would that map then be drawn? Also, how would I lay out this 'grid' correctly. How do I deliberate that room_x is to the top-left of room_y and room_z is right below room_x and room_y and has entrances into both of them. Could I just literally draw a map of my game on paper and then pretend the player is "on" that map. But then what are the implications of making that method believable?
 

RangerX

Member
Your approach sounds like it is restricted to only drawing the current room if I'm understanding you correctly, and by what it appears to be in the screenshot. I would want a map that shows how all rooms connect with one-another. I'm trying to wrap my head around the logic for that.
Actually you could put whatever you want since its your drawing the background. I chose to have one zone at a time but you could do anything you want, your whole world if you want.
 
Top