Sci-Fi Map Generator

Games Creators

Sci-Fi Map Generator

The project goal is to create a corridor base map generator. It will be capable of creating a complex procedural map with still the possibility to edit manually.

The idea came from playing Warframe and creating a 2D platformer map generator. I tried to figure out a way to generate a full procedural map out of rooms and hallway in 3D.

Creating a 2D Dungeon Map
On Warframe you can see links between the different rooms/sections
(Waframe is a Digital Extremes game)

I started by listing the different room format I wanted. In my project, I set up Rooms and Hallways. The rooms can have multiple doors, but most only have one, they should be larger than hallways. The hallways are strait, corner, T shape, cross shape, long, short or curved.

The process I planed is creating the rooms, hallways, then start coding the link system and spawn system, and adding the randomness with it. Then improve on it, by adding the custom inspector, making it easier to spawn.

Each Room and Hallways are made of squared tiles, this way it is possible to make them modular and maybe procedural too.

With those tiles, I started creating those rooms.

The doors are spawned at the link place. For now, they are only 2 squares long but there will be multiple sizes in the future.

I composed my project of 3 main scripts, one for the main Room System that serves as a database; one for the rooms, including hallways; and one for the links between rooms.
The Room script has the necessary variables and has multiple functions.  Those functions listed are:

  • The initialization, so that the room knows what link it has
  • The Generate function, this function is used to spawn room at each unlinked link.
  • The Spawn Room Function, that chooses randomly which room to spawn on the given link
The room needs to be first initialized
When initialized you can spawn more rooms
The Link script is there to know if it is linked and to what.

Links are empty objects with the link script on it and are used as points of connexion. They are located in the room prefab. With the script you can tell if they are linked, to what room and what type of link they are. The type of link makes sure that they are not linked to the wrong link. They use the orientation of their transform to know in what direction to spawn the next room.

The Room System is a scriptable object, meaning that it will be a file outside of the scene. It serves as a database of all the rooms, hallways, doors. It is also the place with the settings for the random room spawning.

Now with this tool, I can create full map 😀

The room spawning system is set so that you can spawn one specific room from a specific link place, this way you can edit the map more freely.

But you can also spawn randomly on a specific link, this way you can still have randomness where you want.

The upcoming goals will be; creating more room, and making them have a procedural aspect, like props in it, and maybe having a room generator to create more of them; Also adding the possibility of deleting only one room on a specific link, and not all the room linked to it (the reset button); Creating a full map procedural generator.

Leave a Reply

Your email address will not be published. Required fields are marked *