This changes pushing in various ways, hopefully improving the behaviour.
Here are the high-level changes:
- The biggest change is adding 'push pressure dampening', inspired by @alre's suggestion (https://wildfiregames.com/forum/topic/56436-for-a-better-unit-movement/#comment-461987). I've tweaked the idea slightly, but essentially, units that are under a lot of pushing pressure will move slower & be harder to push. This leads to more realistic crowd movements, and more occurences of units being bogged down.
- Changed the 'units crossing path' logic to be more efficient. Units will now more often look like they're actually trying to avoid each other.
- Reworked the parameters -> there is now a 'spread' parameter (name comes from the CSS box-shadow spread), essentially making it easier to have less overlap. Also change default values.
- Fix the 'optimisation' that units only consider units in their square. They now consider neighboring squares as well. This helps reduce some bad cases of overlap.
- Slightly reduce the grid size (though testing didn't really show much difference, I'd rather err lower given the above^).
- Add debug rendering mode (see screenshots).
Overall, these new settings have less overlap, and less efficient movement. I think the new values remain much better than whatever we had before, but big-groups-of-units are no longer as efficient as they were, which probably fits the expectations of players in A25.
Note that push-pressure has the side-effect of making people want to use formations, since those won't suffer from that so much.
Screenshot of the debug mode (compile-time choice): The sphere are the units, the redder the higher the 'push pressure'. Lines above are pushing vectors, lines below are individual pushing forces. As you can see, it's a _mess_.
Video:
New default settings:
A25 settings:
New settings, without pushing pressure:
Pushing deactivated: