Making a roguelike and wanted to use external layouts for it (not using dungeon map extension because it looks not that great). Any tips?
Well if you plan to make the map generate at the beginning, you may be better off just making the map on a program like tiled. The issue with generating tile objects is that it causes a lot of lag if their rendered and generating them also causes lag.
I would recommend using tiled to create it beforehand and using objects as hitboxes for tiles.
If you really want to generate the map at the beginning, and I really don’t recommend it then you can use a loop that checks the value of a string corresponding to a tiles coordinates and then sets the tiles animation to that block. Eg. # is a rock, $ is grass. Etc.
Never done it, but in theory, this would work. It would be complicated but it’s easier than mapping every single tile and what block it is at the beginning.
You can make a scene variable array that stores the names of all of your layouts as strings. Then, when you need to load a layout, pick a random element from the array.
You could even have multiple arrays, one for “regular rooms” and another for “boss rooms” or something so if you need something more specific.
Think about how to make the layouts line up. You could design them so that the outer edge of the tiles are dynamic in every layout: after loading the layout you can have a wall there, or no wall depending on the previous room.
The performance of the game might suffer after a lot of rooms have been loaded. You could have one loaded at a time (a room takes up the whole screen) to avoid this problem. Or, have multiple loaded to the game at once but “unload” the ones that are far away from the camera (delete the objects) and re-load them when the camera is moving closer (but not yet on screen)
That is a good tip, about performance, the extension im using called plane projection (one which allow a sort of “fake 3d” with a rotating camera), apparently has in built-in draw distance where once a object is too far away, it dissapears (probaly due to performance). So i hope that should not be a problem.
May I ask how I can load one scene at a time ?
I’m suffering this issue now. Thanks very much
Are you trying to load objects from a layout, then switch to another one but need to remove the first one?
One way I’ve sometimes done it is to have a global variable containing a layout name. You can have your layout load during the “On beginning of scene” event, using this global variable string. Whenever you want to change layout, set the value of the global variable string, then use “Start/Reset Scene” action
The scene restarting will clear all the objects, then the “On beginning of scene” event will trigger again, loading the new layout as per the global variable.