Unity simple map generation
Budget: $30 – $250 USD
I have created a map generation system. I need you to optimize the code and finish the main task. My budget is 50 USD.
Main task:
1. Refactor and optimize the code so that it is more user friendly and easy to add another objects into the map. If possible, I would prefer using scriptable objects. I am open to your suggestion.
2. The way the corridor and room are spawned must be kept
3. The objects in the corridor and the room, cannot be spawned when overlapping with the other previously spawned object
4. The mesh of active game objects of a corridor and its connected room are baked using a simple mesh combiner asset. The objects would have different material.
You can check the system that I have created in the attachment. The map consist of corridor and room. The player will walk from starting point to the end point. The length of the map depends on the player progression. For example, player level 1, will only have 5 corridors to explore before finding the finish line. Meanwhile, player level 10, will have 20 corridors to explore. I want the map arrangement and objects in the map to be completely different when the player start the game.
An example of a corridor is depicted in Picture 1. A corridor exhibits several corridor connectors (red dots) that are used to place another corridor . Beside the corridor connectors, there are several room connectors (blue dots) that are use to place room. The pink dots represent the location of windows. There are no connectors on the window.
A room is always connected to a corridor. This room is called 'parent room'. When a room is spawned and connected to a parent room, it is called 'child room'. A child room is still in the same ecosystem as the corridor that is anchored by the parent room. Picture 2 shows three ecosystem that consist of three corridors and its connected room where are each ecosystem is colored by red, green, and blue line.
In picture 2, it can be seen that there are several objects. Orange cube = locker, purple cube = cupboard, yellow cube = trash can, and gray cube = obstacle. In the corridor and room, there are spawn points for hiding place, looting place, and obstacle. The hiding place, looting place, and obstacle will be spawned there by chance. The number of hiding place and looting place that can be spawned in a corridor and its connected room can controlled in the inspector. This number is a range for the random number generation.
The starting point is at 0,0,0. There is a game object named 'Goal' and its position is at 0,0, 100000. The goal is used by the system to make decision of spawning the corridor. Before spawning the corridor in the corridor connector, the program will check if the angle between the connector and the goal is less than 120 degree to spawn a corridor that lead to the finish line. If there are more than one corridor connector can fulfill the condition, one will be picked randomly. On the other hand, the dead end corridor will be spawned to the other corridor connectors.
In picture 3, one hundred corridors are arranged randomly.
To combine the mesh, we can use Mesh Combiner or Easy Mesh Combiner
https://assetstore.unity.com/packages/tools/modeling/mesh-combiner-157192
https://assetstore.unity.com/packages/tools/game-toolkits/easy-mesh-combiner-mt-scene-mesh-merge-atlasing-support-more-138805
Main task:
1. Refactor and optimize the code so that it is more user friendly and easy to add another objects into the map. If possible, I would prefer using scriptable objects. I am open to your suggestion.
2. The way the corridor and room are spawned must be kept
3. The objects in the corridor and the room, cannot be spawned when overlapping with the other previously spawned object
4. The mesh of active game objects of a corridor and its connected room are baked using a simple mesh combiner asset. The objects would have different material.
You can check the system that I have created in the attachment. The map consist of corridor and room. The player will walk from starting point to the end point. The length of the map depends on the player progression. For example, player level 1, will only have 5 corridors to explore before finding the finish line. Meanwhile, player level 10, will have 20 corridors to explore. I want the map arrangement and objects in the map to be completely different when the player start the game.
An example of a corridor is depicted in Picture 1. A corridor exhibits several corridor connectors (red dots) that are used to place another corridor . Beside the corridor connectors, there are several room connectors (blue dots) that are use to place room. The pink dots represent the location of windows. There are no connectors on the window.
A room is always connected to a corridor. This room is called 'parent room'. When a room is spawned and connected to a parent room, it is called 'child room'. A child room is still in the same ecosystem as the corridor that is anchored by the parent room. Picture 2 shows three ecosystem that consist of three corridors and its connected room where are each ecosystem is colored by red, green, and blue line.
In picture 2, it can be seen that there are several objects. Orange cube = locker, purple cube = cupboard, yellow cube = trash can, and gray cube = obstacle. In the corridor and room, there are spawn points for hiding place, looting place, and obstacle. The hiding place, looting place, and obstacle will be spawned there by chance. The number of hiding place and looting place that can be spawned in a corridor and its connected room can controlled in the inspector. This number is a range for the random number generation.
The starting point is at 0,0,0. There is a game object named 'Goal' and its position is at 0,0, 100000. The goal is used by the system to make decision of spawning the corridor. Before spawning the corridor in the corridor connector, the program will check if the angle between the connector and the goal is less than 120 degree to spawn a corridor that lead to the finish line. If there are more than one corridor connector can fulfill the condition, one will be picked randomly. On the other hand, the dead end corridor will be spawned to the other corridor connectors.
In picture 3, one hundred corridors are arranged randomly.
To combine the mesh, we can use Mesh Combiner or Easy Mesh Combiner
https://assetstore.unity.com/packages/tools/modeling/mesh-combiner-157192
https://assetstore.unity.com/packages/tools/game-toolkits/easy-mesh-combiner-mt-scene-mesh-merge-atlasing-support-more-138805