Idea GMS1.4 Fast way to design and place the contents of isometric room/dungeon

YanBG

Member
I'm populating my game world and i want to fill it with props/objects/furniture. It's more difficult but since i wanted to have more variation(same barrel can be placed on sand, grass, inside a house etc) i decided to have tiles for each piece, rather than a solid background with floor and wall connected. Now how would you go with designing the interior of a simple tavern or a shop?

1) I could hardcode it inside the game, with for loop going through each cell of the room and making a lot of checks to see how big is the room, if there is space for a table etc, how many props of that type. Side rooms should have beds and locked door. Pros: size can vary, better for procedural towns.

2) Handcrafted, i'd need an in-game map editor(better in the long run than the build-in GMS one or third-party), and save into external files(csv). Pros: you can have multiple designers and even players can easily create levels too.

3) Editing directly the csv grid tables, it's fast but hard to read for human eye, also you need to test the results in-game and know how each prop looks like(having the ids listed somewhere). Take this grid, it's the inside of a tavern:
 

YanBG

Member
That seems like a lot of unnecessary data...the same information could be contained in the following two lines:
Code:
chair (4,6) (4,9)
shelf (1,1) (1,2) (1,3) (1,4)
 

YanBG

Member
The room won't be empty like that but sure there will be some free cells.

I'm having more issue with figuring the orientation of objects, since it's isometric some can have 2 or 4(like the chairs). I'll have 4 chairs around all sides of a table.
 
Last edited:

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
I'm writing the csv to a grid with value for each tile.
Spelunky approach is basically having
Code:
strTemp = "0000000000"
        + "0000000000"
        + "0000000000"
        + "0000000000"
        + "0000000000"
        + "0000000000"
        + "0000000000"
        + "0000000000";
or a multi-line file, so that the objects line up when viewing the code
 

YanBG

Member
@YellowAfterlife in your example is the width 10 cells? And each 0 will be replaced with the id of an object? Seems like my table/sheet.
I'll be doing it with code because larger objects will occupy more than 1 tile and it's best to check their sizes from another list(if i fill this chart/csv by hand any changes in the list will make it useless) only using the name/id.
 
Just for completeness sake you can also just use the GM editor for editing the level, export it as JSON and load it back (you can compress, encrypt or do whatever you want to secure the JSON data). You can look at an example of how I did it for my Weekly Game Jam entry (the deserialization is quite generic however the serialization needs to know what to serialize for each object type but you could also generify it by leveraging variable_instance_get_names) do note that there are some assumptions in my code (e.g. the Player instance controls all of the global state so it isn't directly serialized or deleted on deserialization), but you should be able to repurpose it easily if needed. It basically works by storing all of the state needed by the level (including sizes of the objects and such).

The advantage of having an external file is that you could code the editor in any other programming language / toolkit that you wanted (or just have the in-game editor) or you could even try to find some generic editors that you could just repurpose the format from.

EDIT: Note that I store both the tilemap contents as well as the object data. The tilemap is just stored as a simple string since I only need to store the index, but you could repurpose the object format to store more information for the tiles instead or even extend it to store tilemap data per tilemap layer, etc.
 
Last edited:

YanBG

Member
@Rui Rosário my sprites are isometric(the ids are stored in a grid), can't place them in a top-down editor while still noticing how it will look in-game, isn't the GM one like that? Also i'm using 1.4 but the JSON format is a good idea for exporting the levels!
 
@Rui Rosário my sprites are isometric(the ids are stored in a grid), can't place them in a top-down editor, isn't the GM one like that? Also i'm using 1.4 but the JSON format is a good idea for exporting the levels!
Honestly haven't tried to make an isometric game in a while but I know that at least previous versions of GameMaker allowed for an isometric grid when editing the room. You could also just create the room using a top-down view and when storing / loading apply the isometric transformation of both the coordinates and the resources (if they differ), although it might be difficult to get the correct perception of how things should be layered.

EDIT: Looking at the docs for 1.4 it seems like the room editor still allows the grid to be changed into the "diamond isometric shape" (see visualization in the toolbar).
 

YanBG

Member
Honestly haven't tried to make an isometric game in a while but I know that at least previous versions of GameMaker allowed for an isometric grid when editing the room.
Not sure but the last time i tried, it wasn't any good.
You coulod also just create the room using a top-down view and when storing / loading apply the isometric transformation of both the coordinates and the resources (if they differ).
That's what i do but populate the grid with code, honestly saves time and have a small random/procedural feel. My problem right now with placing/designing isometric in top-down is that i can't much figure how it will look in-game until i see the sprites placed in their screen positions.
 
That's what i do but populate the grid with code, honestly saves time and have a small random/procedural feel. My problem right now with placing/designing isometric in top-down is that i don't much figure how it will look in-game with the sprites placed in their screen positions.
Then a custom/in-game editor might be your best alternative if you want the visualization but don't want to use the built-in editor. Or just a generic one (a quick Google search revealed at least one such editor that does export to JSON although obviously I have no clue if it is any good).

EDIT: Apparently it even exports natively to GakeMaker's 1.4 room format!
 
Last edited:

Yal

🐧 *penguin noises*
GMC Elder
Most games combines fully procedural generation with hand-made rooms (called "vaults" in procgen lingo). You can get more natural-looking results when a human designs an area, but you lose a bit of that fun unpredictability that computer generation brings.

Here's one idea: have some objects be "masters" and let them spawn their "slave" objects nearby in unoccupied cells, so you don't need to micromanage everything. For instance, a table would spawn a certain number of chairs (based on its size) in adjacent cells, and make them face the master table. This approach can be extended one step further, where you just designate the room type and it spawns matching props (a bedroom needs a bed, a bathroom needs a bathtub and a toilet, and so on) and picks an appropriate tileset. Just take care that props aren't placed in the way of doors so the player can't traverse the area. This can be solved by adding "this must be left free" cells around all doors, and add them around every non-passable prop you place as well.
 

YanBG

Member
@Rui Rosário thanks man! I'm pretty happy with my setup/pipeline. When i started few years ago, everything was way worse and time-consuming now i render directly in spritesheets/texture pages(so objects are not individual images, i just write the coordinates in a file myself) and can update/replace the game's graphics pretty fast.

Here's one idea: have some objects be "masters" and let them spawn their "slave" objects nearby in unoccupied cells, so you don't need to micromanage everything. For instance, a table would spawn a certain number of chairs (based on its size) in adjacent cells, and make them face the master table.
Ahaa i like that idea. I'll have to make 100 checks, for example some rooms are smaller and should have less stuff(it could be decided before that, so only larger spawned rooms can be taverns and the tiny ones just residential for poor people).
This approach can be extended one step further, where you just designate the room type and it spawns matching props (a bedroom needs a bed, a bathroom needs a bathtub and a toilet, and so on) and picks an appropriate tileset. Just take care that props aren't placed in the way of doors so the player can't traverse the area. This can be solved by adding "this must be left free" cells around all doors, and add them around every non-passable prop you place as well.
Yup i had that in mind, since my NPC have unique jobs, if the owner is scholar the bookcase will spawn in his house. Multi-room houses need more coding(e.g. with bedroom in the back with 1 locked door to the main room), so far i was checking for a rectangle and then randomly added a smaller rectangle to one of it's sides but when i got to advanced roof tiling and it's not working properly, since the roof needs a simple and defined area. I could go with spliting big houses internally with binary tree(use that for dungeons), there will be even hallways :)
Just take care that props aren't placed in the way of doors so the player can't traverse the area. This can be solved by adding "this must be left free" cells around all doors, and add them around every non-passable prop you place as well.
Smart! I just noticed that issue, you can see it in the screen. That's how it looks so far, very weird. Since there will be houses with stone or brick walls, i can have tilesets for each type(with better/sturdier tables/chairs).
 

Joe Ellis

Member
"in-game map editor(better in the long run than the build-in GMS one or third-party), and save into external files(csv). Pros: you can have multiple designers and even players can easily create levels too."
I would do this, I have actually. But the main downside is that it takes about a year to create the engine and editor. But it is worth it in the long run. I can help you with it though if you're interested :)
Plus you end up being able to edit variables for instances while the game is playing. It might not be that useful for a strategy game but it's really good for any action game, or any game where there's combat
 

YanBG

Member
I would do this, I have actually. But the main downside is that it takes about a year to create the engine and editor. But it is worth it in the long run. I can help you with it though if you're interested :)
I have the items/objects already loaded in-game, so that i can scroll through them with "+" and "-" for testing(you can see it in the top-left corner), would need a clickable menu and to order them into groups(was planning to do that). I'd be glad to get you on-board!
Plus you end up being able to edit variables for instances while the game is playing. It might not be that useful for a strategy game but it's really good for any action game, or any game where there's combat
Might be even better for strategy. I considered it for the RPG, like there are survival games or city(house)-builders but now i think that it's better to be more focused and not trying to cram a few games together("less is more"). In story driven RPG, there will be issues if the player can alter whole towns with NPCs that give quests.. But i'm open for brainstorming something with epic mechanics like Runescape!?
 
Last edited:

Joe Ellis

Member
Yeah I can def help you out with.. basically anything I've done in my Warp3D engine. You won't have to spend as much time as I have cus 2 thirds of it is the 3d part, the level editor is quite simple. (I say that, but it's complicated compared to normal coding, but simpler than 3d stuff) But yeah, I can def teach you everything I know to do with that. I can't actually be like a programmer on board with the game unfortunately, cus I'm already working with 2 other people. So I just won't have enough time :/
 

YanBG

Member
Yeah I can def help you out with.. basically anything I've done in my Warp3D engine. You won't have to spend as much time as I have cus 2 thirds of it is the 3d part, the level editor is quite simple. (I say that, but it's complicated compared to normal coding, but simpler than 3d stuff) But yeah, I can def teach you everything I know to do with that. I can't actually be like a programmer on board with the game unfortunately, cus I'm already working with 2 other people. So I just won't have enough time :/
Sure thing, i'll ask you when i have questions!
 

Yal

🐧 *penguin noises*
GMC Elder
But the main downside is that it takes about a year to create the engine and editor.
Citation needed :p My SoulsVania engine took about a year to make, but the level editor is one of the smallest contributors to the total dev time... most of the time was spent on coding user-facing menus, with game physics and animations as a close second. 1 month dev time would be an exaggerated upper bound on the time it took to make the level editor.

Can definitely agree that it's worth it, though. I made the 60-ish levels in just 2 days thanks to the convenience features to create terrain quickly, so for a full-sized game, even the bleak 1-month-estimate time investment would've paid off.
 
Top