akarnokd / open-ig

Free & open-source reimplementation of Imperium Galactica. Download the Installer below the file list!
GNU Lesser General Public License v3.0
244 stars 55 forks source link

Pathing rework 2 #1139

Closed hemoridos closed 1 month ago

hemoridos commented 1 month ago

Implemented basic pathfinding for space war based on ground war methods so for now all ships are treated as 1x1 sized, but that can be iterated upon. For this I created a class structure for common pathing and movement methods that are used by both ground war and space war battles since most of the mechanics are the same. There were some changes made to how spacewar movement is handled to fit the new pathing mechanics. Scripting was also updated to work with the new code. Also added a node weighing mechanic to encourage spreading paths when groups of units are moving together. A weight is added to each node on the grid for each path touching that node. This weight is used when calculating the distance between two neighboring nodes. It is very basic and does not differentiate between the players nor does it use weights on vertices, but it does the job. The pathfinding in spacewar can be disabled in the settings to use freeform movement.

Besides the pathfinding there are some additional changes: