Sadly, I'd lost my code and was unable to recover it as of a tiny IDE setup mistake, so I'm unable to revisit it.
Unit collision and a simplest straight-forward pathfinding (no walls support, just go to click point) requires a lot of calculations and are hard to optimize.
Just bullets collision check with a single boss or few object are easy to optimize. For ex. divide a screen into a grid and only check objects on the same cell where collided object is or that are moving towards collided object.
Mostly important, you do not need to check collisions when bullets hit other bullets.
Moreover, you only need one positive collision to stop checking that bullet again.
Additionally, you do not need to compare to higher radius as of different unit size, so you can simplify calculations even a bit more.
And you can use different threads for, example, each enemy projectiles. Separate thread for boss. Separate for player.
200 bullets * 1 boss = that shoots 200 bullets to player = 200+200 = 400 collision checks
or 20 player bullets * 20 enemies and 20 bullets from each enemy = 400+400 = 800 collision checks
and you can still heavily optimize
50 units * 49 units = 2450 collision checks and you can hardly optimize
But imagine if you want to add to this game
- adding other players
- ability of boss/enemies to shoot as intensely and other players to catch these collisions
and your calculations might quickly rise, so your design/ideas are limited by technology. Or, to rephrase, technology will dictate your design.
It would be nice, though, if somebody could re-check my experience.
Threading, [Inline], lowering number of functions, some additional optimizations will help, but not as radically as RTS needs.
As far as I remember, I'd optimized my code, for ex. only using while-- loops, avoiding mass for loops, but there's always a chance that I'd missed something as my code was lost before I double-checked, but sadly I can't re-check as of code absence.
Concerning graphics, Starling can easily draw that many objects when using MeshBatches and Texture Atlases.