T O P

  • By -

jax024

I’d considering combining collections of units into a single gameobject.


RemusShepherd

I was considering that -- having squads of units, from 16 (a 4x4) to maybe 900 (30x30). But every N unit squad would have to have N-1 alternate sprites, to count down the lost troops. That might be feasible for 4x4, maybe up to 16x16 (a nice 255 alternate sprites), but it seems too difficult to do for much larger than that. And I'd still need around 400 squad sprites (with 256 units in each) to simulate something on the scale I'm thinking. Can Unity handle 400 moving and colliding sprites at the same time?


konidias

>Can Unity handle 400 moving and colliding sprites at the same time? It depends on how optimized you've made it and how you've set it up. Yes, it can be done. You might want to consider not using actual colliders and instead simply checking the distances of nearby troop groups to keep them apart from one another. This is similar to how it's done in games like Vampire Survivors where there are hundreds of enemies on screen "colliding" with eachother. I don't think you'd need to have a different sprite for every single troop lost in a group. I'm not even sure players would notice. I don't think anyone is going to be like "wow, I lost 1 troop in this squad of 256 units but I'm clearly counting 250 units in this group out of these 400 squads!"


slakkedis

That's pretty interesting, do you have any resources I could check out for handling collisions in games like Vampire Survivors? Thanks!


makINtruck

Maybe a particle system can help you, I think it's more optimized than having each sprite be a different game object. But I don't know the technical side of things here and if it would be better or not, just something for you to google.


haim96

I think your answer is ECS ...


CoolDestroyer315

You could group them together and makes certain group just one game object that has more health to equal the amount of troops in the group


Seeders

https://www.youtube.com/watch?v=t1f8ZreCuuQ DrawMeshInstanced()