I am attempting to create an RTS game inspired by Forts on Steam, where two teams of players must build a base and fight each other, winning only by destroying all spawn locations and finishing off the enemy team. One major factor in building bases is electricity, which powers just about everything that’s important including spawners.
When i say “Number System” i am referring to a system with the following:
- Generators: Adds numbers or “power units” to the system at a set rate per second.
- Storages: Sets the max size of the system by defining the number of units that can fit.
- Consumers: Subtracts units from the system at a set rate per second.
See the picture below for an example:
The system above generates 2 units of power per second, consumes 1 per second, and has a max storage of 200 units.
Now setting up a system to work like that is easy, I currently use a data folder for each team that contains a NumberValue for the power level, and both generators and consumers add and subtract from it. There is also a NumberValue defining the max storage allowed that updates with a for-loop whenever a folder containing all the physical storages is updated, and the power level cant go any higher then what the max storage value allows.
But here’s the problem… I intend for players to expand past their base and build outposts, rather it be to collect resources, or just to expand and gain a possible edge over the enemy. I would rather these outposts not draw from a unified power grid and instead need to have their own grids built from scratch, hence the “Closed” part of the system that im struggling with. Basically, players should be able to create separate grids that don’t affect each other unless physically connected, such as in the picture below:
The two grids above are separate from each other, the objects only affect what their connected to. They can be merged into one grid, or split into more (Note that the wires are not necessarily physically there, they just represent the connections indicated in the objects data)
Another game on Roblox that does this PERFECTLY is Eclipsis (amazing game) which i will link below.
In Eclipsis, players collect a fluid resource called Iridium which is collected from wells and extractors and carried by player-built pipes into storage containers, and then buildings that consume it like fabricators and turrets. Multiple different grids can be built and they don’t affect each other unless physically linked by pipe. Grids can also be split in half or into multiple pieces either intentionally, or from incoming damage severing the pipes. This is basically what im trying to create.
How would i go about creating a system like that? Specifically, how would I define separate grids and their data? Especially when merging or splitting? Any help is greatly appreciated!