I would like to try to make a Factorio-type game - but I do not know how to make the game optimized so that there are many objects - the only thing that comes to mind is to use tilemaps - because using separate objects would be very un-optimized - on this question - are there any other ideas how optimization could be done in the game by Factorio type
I had to search for a definition.
Description of Factorio-type games
Factorio-type games, also known as factory-building or automation games, focus on resource gathering, complex production chains, and logistical puzzles, with popular examples including Satisfactory (3D, first-person), Dyson Sphere Program (interstellar automation), Mindustry (tower defense/factory hybrid), Shapez (abstract shape-based), and Techtonica (underground automation). These games involve designing, building, and optimizing automated systems, often with survival or combat elements against local threats, offering deep, time-consuming experiences.
While a tilemap would optimize the visual part, I’m not sure how you would get things to interact with each other in the way you could do with different objects. I guess you could keep an array of where items are. Maybe seperate arrays or a mix of structure variables or children. IDK.
You wouldn’t have seperate objects that could be linked or detected through collision. You would have to maintain the variables in a scene or global variable instead of object variables.
I guess if you had a structure then you could have variables that relate to the column and rows of each tile.
Tile[column] [row].structure
Im really leaning towards objects over a tilemap.
the Culling
I thought of culling as well. Although, I have zero experience with it.
The issue with culling is the factories would appear and disappear along with their variables and timers. You would need to use other types of both. Or store the time when they were culled and calculate the production done in that period when the object returns. A bit like you would do if time were to pass when the user was away.
This code saves object variables (STRING) and restores them when the object is created, but not Number, Array, or Behaviour variables. Timers can be compensated for using a variable. Variables must be used to maintain a state.