[ad_1]
Excessive stage
At a excessive stage, I am trying to create a galaxy exploration-style sport.
Numerous factors of curiosity shall be selectable on the map (I would wish to goal for a number of hundred, however versatile and desires testing).
A POI will be one thing story-related or a supply of one in every of 4 sources.
Gamers begin with a ship, head to a useful resource node, harvest sources and might transfer on.
Thus far so good, I’ve received a small variety of sources, so can simply group them collectively as a single ResourceStockpile
element and conceal empty sources within the UI.
The POI that produce sources may have a service that increments their stockpile over time, and ships may have a "cargo bay" of ResourceStockpile
.
The participant can use [some resources] to create factories at a POI.
Factories convert sources to items (each completed merchandise and parts/components).
Complexity
I need to have the ability to ship items. In contrast to sources, I am anticipating to have a number of dozen varieties of completed good (and lots of extra intermediate components and parts), with a watch to increasing over time.
Storing a number of zeroes for sources appeared like a small overhead to take care of a constant ResourceStockpile
I might reuse.
Because the variety of objects/fields grows, the design feels much less and fewer fascinating.
To make issues extra attention-grabbing, I would ideally like to have the ability to ship just about something (together with the factories, if the ship is massive sufficient).
Do I change to a HasX
element for each doable useful resource/good? In that case, it looks like I’ll spend an terrible lot of time swapping between archetypes.
It additionally looks like quite a lot of duplicated code, except there’s some strategy to deal with it as a generic Has<X>
as an alternative, however I consider that is fairly complicated to implement, and will negate among the reminiscence administration advantages of ECS (?)
Or do I create a ResourceStockpile
with -say- 100 integers, one per doable useful resource/good and simply swallow the overhead?
What’s the best™ strategy to break this down?
[ad_2]