#Design question

1 messages · Page 1 of 1 (latest)

crystal laurel
#

I don't know if this is the right place to ask, but I have a design question, I was wondering if anyone could help me answer it.

I'm making a Fallout Shelter-like game. I need each room to communicate with each other to determine the other's room caracteristic and it's occupant's caracteristic. They also need to know if the nearby spot is empty as to change their assets.

Let's assume I have
[Room A][Room B]
[Room C]

I need Room A to get B & C caracteristics, apply an "aura" to them, and know that there's nothing on it's left so it can turn on a caracteristic and change its look.
Also, the player can create rooms almost however he wants by clicking an empty spot on the "grid". When clickin a UI Button, empty spots near other rooms will display a yellow background that creates a default room once clicked on.

Should I use a Tilemaplayer to handle the room or make a custom grid with y, x coordinate and room nodes ?

solid mist
#

I think it depends on how many rooms you expect to have. If it's not a very high number, go with the solution which is easiest to implement

#

A third option is to define room properties in an inner class (which isn't a Node), you store them in an array/dictionary, and then either use a tile map or custom draw functions to visualise it

red shoal
#

Do you know how "next to" looks like in your game? Is it something like "within 20 meters", or is it more like the rooms are on a grid, and rooms that are neighbors on the grid need to have their edges customized or smth?
It sounds more like the underlying grid. I think a tilemaplayer will fight you, but I think a 2d array (array of arrays) is a good idea to track the data.
You could make a class like BaseFloorplan extends Node2d (or Node3d!) which manages the roomgrid, registers itself as a member of the BaseFloorplan.group = &"BaseFloorplan", and which BaseRoom instances ask questions of using static methods (like: given I'm at position Vector3(x, y, z), what's my BaseFloorplan room slot Vector2i(x', y') .
Could make BaseFloorplan an autoload; could put it into the tree explicitly, either makes sense depending on where you are with the project.

#

("will fight you" -- there's enough detail and stuff going on in a room that maybe that's hard to do as a tile? But maybe not! Tiles are pretty fully featured! 😄 )

crystal laurel
solid mist
#

If you don't want to define limits for your world you can use a Dictionary with Vector2i as keys, instead of an Array for your rooms. Some operations might get a little bit slower, but unless you have hundreds of rooms and you scan their surroundings every frame I think it won't be noticeable

crystal laurel
solid mist
#

From what I've heard, nodes don't scale that well (e.g. when you add hundreds of enemies to one scene) so it's probably best to have some kind of custom data structure + optimized drawing then.

#

I mean if you were considering using one scene instance per room