Triverse 0.2.0 introduces a new EMP part, core-claiming mechanics, and RTS-like orders.
EMP
The new EMP part fires a shell that bursts in the next turn and unpowers any nearby hostile parts. The EMP burst strength is reduced by distance and by certain parts like hulls (and storage to a lesser degree). Like other parts, EMP power level is determined by its proximity to cores. L1 EMP is mostly a minor nuisance that just forces units to move, but L2 and L3 can unpower hostile cores. All levels cause shields to drop.
There are a few defenses against EMP. Because it bursts in the next turn, nearby units have a chance to move away if they can, making mobility a good defense against EMP. Units with less mobility may want hulls to block propagation of EMP. Those measures come at a cost, so if you know you’re not facing EMP, you can instead favor firepower or shields rather than hulls or thrusters.
Core claiming
To complement EMP, external cores (those with fewer than three immediately-connected parts) can now claim unpowered cores. This means you can use EMP to unpower hostile units and then take them over using ‘worker’ units with external cores, which is quite effective if the EMPs land. Also note that as units are damaged and lose parts, cores may be exposed and allow those units to take over others, so battles with EMP can become chaotic as both sides attempt to take over each other.
Orders
Finally, Triverse is venturing into RTS territory with unit orders. These are the new controls:
Right-click empty space
: Move to pointRight-click unit
: Approach, follow, or attack unitRight-click selected unit
: Pick up selectionR
: Cancel orderH
: Halt
To fulfill orders, units will attempt to move in their main propulsion direction and steer around obstacles. Turrets will prioritize firing on the targeted unit. In some cases, it might be better to cancel orders and allow the AI to freely decide which units to attack. In other cases, the AI might need some help from you. This is the first version with orders, so please let me know if you find any weird behavior!
Pathfinding
Movement orders means group pathfinding. Group pathfinding can be tricky, especially when working with mixed size units or obstacles. In the case of Triverse, it’s even more complex because the units can have arbitrary shapes or propulsion, and they can change at any time.
One approach to pathfinding is to use A* to calculate a path for each unit, which can achieve the best possible path for the unit at the cost of CPU. Another way is to calculate approximate distance maps (or Dijkstra maps) to the destination for each order group, then make local decisions per unit. Using a shared map works adequately and can be less CPU-intensive, but it may fail to find paths through corridors if the units have odd shapes. I’ve also considered using A* for individual unit paths, but doing that may incentivize optimizing players to micromanage each individual unit rather than using group orders.
Note that taking multiple samples from a scalar distance map is similar to using the gradient defined by flow fields, The gradient could be useful if I sampled at the centroid of each unit, but because unit shapes can vary a lot I instead sample at individual cell positions.
Usability
Right-click is getting a bit overloaded. I like the convenience of being able to pick up units so easily, but I worry that players in a hurry may accidentally do that, causing shields and counters to reset. One mitigation could be introducing an undo/redo system when paused, which I’d like to try at some point anyway.
I also plan to add explicit buttons for move and attack orders. These would aid discoverability and be more explicit than right-click, but they would probably still involve some implicit context (like what the player clicked on) to decide whether to ‘attack’ or ‘attack move’.