I’m currently developing some sort of “build and fight” game, and the “battle” gameplay in some aspects looks like a RTS game (pvp, units vs units etc.).
For now, I’m encountering 1 major issue: the collisions (preventing me from having massive battles for now).
1/ I did not implement a crowd management system yet, so my units tend to overlap each other pretty often
2/ both the units and the projectiles have a collision box (“unit” and “projectile” group/mask, detecting each other)
==> each projectile can collide with several unit at the same time, even though this is not its target
3/ so… the potential number of simultaneous collisions can be insane
(it may not be super obvious on this screenshot, but several units (and thus their collision boxes) are currently overlapping with each other)
(super extreme situation of course, with 100 overlapping units and 100 projectiles colliding at the same time… Won’t happen but you get the idea)
And once the limit is reached, the collisions are ignored, the projectiles are not deleted, and… this is a mess.
I could increase the max nb of collisions in the project settings, but that would not really fix the issue.
SO the ideal solution would be to have the possibility to dynamically create collision masks and groups (so a projectile would collide with its “official target” only)
I found this:
“The group name should exist i.e. have been used in a collision object in the editor.”
Does that mean that I can’t create group names at runtime? (which isn’t very convenient in a “massive battle” situation, where I want each projectile to hit a specific unit only - the mask/group would be unique strings that can’t be created in the editor)
So I have 2 questions:
1/ It is possible to dynamically create collision masks/groups at runtime? (would be the ideal solution )
Or it’s not:
2/ What would you recommend in my situation to manage the “collisions” between units and projectiles? (in a “massive pvp battles” context)
2b/Should I use something else than Defold collisions? Maybe based on the distance?..