Best way to

I want to create a strat game in code, having factions and many units and having them move around the map doing things. So list of units and so forth. How would i do this in unity? Scriptable objects? Or just lots of classes that can be used by scriptable objects? Im a bit of a noob so apologies for my ignorance.

Depends on how many is the “many”, if it’s really “many”, so hundreds or maybe thousands (for all players combined), you may want to look into the DOTS technology. It’s being built for this.

Yes thousands, and then the factions may have there own list of units as indexes into a master list. I figure in c# its fairly straight forward, and i can just get the data i need when i need it. I just need to simulate this world, like an elaborate board-game running in the background that i can access what i need when i need it.

If you’re not a beginner, then check out the DOTS: https://forum.unity.com/forums/entity-component-system-and-c-job-system.147/

If you’re a beginner, my advice is to put this idea on the self, work on it (design, plans, rules, etc), but do not start to develop (code and such) it. If you’re a beginner, or moderately experienced, make some simpler games and practice, you have a nice goal, it will motivate you. :slight_smile:

1 Like

Thanks Ninja, forgive my ignorance i just want to clarify a couple of things.

Can i not; write all the classes i need, the data i need (in Lists), have that data persist (dontDestroyOnLoad) and update outside of monobehaviour?

If i could do that i could then inform my scenes ‘whats going on’ and adapt my scenes accordingly? Thereby simulating my world.

You can. We’re doing that, well, for forever now.

If you’re planning with a couple of dozen game objects, that will definitely work. A couple of hundreds most likely/probably will work, a thousand I doubt it (moving/simulating units, buildings, whatnot, you need to have budget for effects, AI, path-finding, UI, sounds, all bells and whistles). Try to build a prototype with just one type of thing and scale it up. If you’re able to run a couple of thousands at once without tanking your frame rate on your target device, it may work.

Ah i think im getting it, i wont be throwing lots of work at these units, i just need them to be in memory and do their thing. There will be a concept of a player ‘bubble’ where the heavy work will be, 3d models, ai, collisions etc, but otherwise its all going on in data, representing the world(galactic map).

They wont be gameobjects until i need them to be

Is this making sense?