pathfinding version 1: spatial tile based

Pathfinding:
Event type: Click (split to several custom events)
This is a large behavior that may sometimes produce calculation flaws thus diagnosis drawing maybe required to correct the snippets below. 

pathfinding properties: 
scan method: tile-by-tile 
flaws: yes: 
limits: yes. to prevent crashing

trigger click , inspired by all Command and Conquer games


Next, the actor will scan tile-by-tile to look for plateaus of occupied tiles. 


Next again, the actor will scan the surroundings and calculate its perimeter. (in this case, anti-clockwise). 
start

middle
A hole in a plateau means there is an unoccupied space enclosed by occupied space. 

end
to calculate the partial waypoint generated. 


Later, the scan around and calculate on the clockwise. The snippets is similar in large scale but different details. 
start

The purple game attribute snippet above is for diagnosis purposes. 

middle



end


Last piece of the loop is the chosen path. Adds the selected sets whichever is shorter of data to the overall waypoint data. 

The purple things above are for diagnosis purposes. 

The loop repeats itself with new line data. 
starting at the the last point where it is left off and repeats until it reach the destination.

the custom event diag_place_dots is for diagnosis purposes. 

After the calculation step, it is dispatch movement. it works similar to actors move according to waypoints. The pathfinding is useless without the dispatch movement. By assembling all of these together there is a flaw in this code as tested. (found in calculating section above) thus this behavior is not available on his Pinterest yet.













No comments:

Post a Comment