Originally Posted By: Superku
How does it look/ work when you try to send your troops through a 3-4 tile choke or when one half of the squad moves against an obstacle?


just debugged this part yesterday laugh groups now go through without problem even if arriving at the same time to the 3 tile wide, 7 tile long gate. the screen shows an A* seqarch of the main group leader (non examined black, closed list red, open list blue):


the full system is basically very complex, tasks are spread over a few frames resulting in a balanced load, and related both on pathfinder and movement parts (I had to draw by hand several flow-charts to get it work). I use a hierarchical pathfinder consisting of 2 parts:

1) the group searches a path only among clusters (actually 8x8 tiles for terrain, but varies after terrain decomposition, and in case of buildings. in Company of Heroes they use 10x10, it is very game dependent).

2) the tile pathfinder is simple: if the straight move path check fails, the 1st row uses an A* like thing towards next cluster middle. others only follow the one is assigned to them as sub-leader. on the picture you can see the search area, it is not big. in case of leaders if pathfinding fails, they use another search ignoring other units to avoid to be got stuck. it leads of course to collisions. (this basic group formation and target finding system will be totally rewritten to be more effective and to show visually better group cohesion)

thus in the movement part as a quite new feature, I implemented a push/bounce collision system, which works surprisingly performcance effectively, utilizing simply c_move (I was unable to do it with PhysX). collision length is measured for each unit, and handled in multiple stages. they can repath after a certain frames, or if everything goes wrong finally they can ignore other unit collisions, but it is a very rare situation so nearly never visible. and there are some counters measuring if a unit is got stuck, then they are not allowed to search a new path in every frames to avoid high CPU load.

later I can make a video, but there are some issues with accessing 2nd building floor (that was okay in past so back to backups again...). I have to work on more visual debugging tools as they make the work much easier and faster. and afterwards, I'll rewrite the army/group/unit/entity structs to be flexible and really game ready. it will be a heavy job, but I have a nice road-map with exact plans, like potential map creation for AI decision making etc. laugh


Free world editor for 3D Gamestudio: MapBuilder Editor