My first open world: How do I draw tiles outside a room?

Hello wonderful people!

I've decided I want to try making my 16bit Top Down 2.5D game infinitely open world, to see how possible it is.
I understand there will be complications and world gen will require constant manipulation, but I wanted to see if I can cope with it, and just how possible it is to do in gamemaker.
So I started a new room, and started writing steps for expanding the map and generating when the camera gets near a world border, I realised that sure I can resize the room_width and room_height to the right and down, but how would I go about expanding left and up, like minus coordinates (world spawn being 0, 0). How would I go past the 0 on the x axis, and 0 on the y axis? I know it's possible in minecraft with -x and -y coordiinates being infinite if you accidently pass 0 on either axis.

This is where I started thinking, what if I just forget about resizing rooms for a moment and check what's possible. Let's say my room size will be constantly 0x0 (or 1x1 if that latter is impossible), and I know it's possible to create instances outside of rooms, but how would I go about drawing tiles outside of the room? Will I need to create primitives for this or are there other methods? Should I change the x and y of all instances to always fit inside the room, (i.e moving left generates more land but shifts everything x+16 per tile), and set all tiles to the same thing but x+16? - I just worry how performance taxing this process could be on a large scale map. Not just instances, but looping through the entire map's tiles to shift them.

Also, if you've tried this before, in your opinion, how succesful were you? What tips would you give for a (possibly infinite) open world beginner?
 
Last edited:

Mr Magnus

Viking King
Here's a dirty secret: The room size doesn't really matter all that much. It's essentially just a guideline. You can create, draw, and interact with any instance or layer in the room no matter if it's inside or outside the arbitrary boundary you've set. You'll have to handle some things like the camera differently, but there is no reason why you can't operate things at negative coordinates.

my main tip is to try to be very careful what you are and aren't drawing and what is and isn't active. You need to pay close attention what is "alive" in your room if it's infinite, and try to only have things around the player active at any given time. It's very easy to get a turtle for a game otherwise.
 
Here's a dirty secret: The room size doesn't really matter all that much. It's essentially just a guideline. You can create, draw, and interact with any instance or layer in the room no matter if it's inside or outside the arbitrary boundary you've set. You'll have to handle some things like the camera differently, but there is no reason why you can't operate things at negative coordinates.

my main tip is to try to be very careful what you are and aren't drawing and what is and isn't active. You need to pay close attention what is "alive" in your room if it's infinite, and try to only have things around the player active at any given time. It's very easy to get a turtle for a game otherwise.
Yeah I like this idea, but how do I use tiles and tilemaps outside of the room. Will it just work and I havent tried it yet?
 

TheouAegis

Member
In GMS1, yes; in GMS2, no. You would have to draw them yourself. Tilemaps are bound to the room. You can move them around, possibly even outside the room, but your tilemap's size is still restricted by the room size. Unless they have fixed this in 2.3 already.
 

Mr Magnus

Viking King
In GMS1, yes; in GMS2, no. You would have to draw them yourself. Tilemaps are bound to the room. You can move them around, possibly even outside the room, but your tilemap's size is still restricted by the room size. Unless they have fixed this in 2.3 already.
Don't think they have. At least my very rudimentary test didn't do much useful.

So yeah, you can't manually place them outside of the room. I'd suggest you have your room size at least the size of your camera, and then as you create the surroundings when the player approaches draw them to screen or add to the room using gml.
 

Vusur

Member
I'd suggest you have your room size at least the size of your camera, and then as you create the surroundings when the player approaches draw them to screen or add to the room using gml.
So we "invert" the movement? Instead of the player moving around in the room, everything else moves and player+camera is fixed?
I think you added another thing to my "to-do" list.
Creating tiles in a procedual way when "moving" in a direction, with invisible tiles for spawing objects. Oh boy, this is a nice data structure exercise... storing the information, so you can recreate already visited places.
 

Mr Magnus

Viking King
So we "invert" the movement?
Game maker can create tiles and tilesets outside of the room using code. If you want to do inverted movement that is a valid solution, but I was more thinking that player and camera movement is normal. It's the same exercise in either case given you will need to programmatically generate the area around the player if you're aiming for an infinite world. There is no functional difference between moving the player and moving the environment around the player if you're dynamically loading areas around them anyhow.
 
So we "invert" the movement? Instead of the player moving around in the room, everything else moves and player+camera is fixed?
I think you added another thing to my "to-do" list.
Creating tiles in a procedual way when "moving" in a direction, with invisible tiles for spawing objects. Oh boy, this is a nice data structure exercise... storing the information, so you can recreate already visited places.
I agree this is a nice exercise. If you're also giving it a shot, I suggest having a data structure for every individual chunk, so you can save far away chunks to disk, in an effort to save memory.
Another big peformance "secret" is instance_deactivate.

So yeah, you can't manually place them outside of the room. I'd suggest you have your room size at least the size of your camera, and then as you create the surroundings when the player approaches draw them to screen or add to the room using gml.
I may just go ahead and try to achieve this using surfaces instead of tile layers.

I've come up with two other possible solutions to get tiles working so I'm checking how plausible they are.
One of which I stumbled across on youtube, although I have no idea how bad of a performance impact it is. So I'd love some other opinions on this if anyone is willing to input:

1. Abandon tile layers. Use surfaces to draw tiles, along with sprite_draw_part() for every individual tile in this surface.
2. Still use tile layers and I make everything in the room suddenly jump along the x or y axis a whole 10 tiles to recentre the tile layer with the camera.
3. Apparently there's a way to visually connect rooms and make them appear as one, allowing me to treat each room as a chunk and still allowing use of tile layers infinitely but I worry about performance and what if an instance scales bigger than it's original chunk / room. - Will it still order correctly along the z axis? There has to be some consiquence.


Thank you all for showing an interest and sparing your wisdom :]
 
Top