- Code: Select all
DrawCircle(MarkerPosition, 5, markerInfo.color)
DrawLinePop(MarkerPosition1, MarkerPosition2, markerInfo.color)
Basicaly its working with a ForkThread like this:
- Code: Select all
while true do
DrawPathGraph() -- this function is drawing all lines we need.
WaitTicks(2) --if you wait 3 ticks, then the linedrawing will flicker
end
Sometimes you need to use WaitTicks(1) on fast PCs. (fps over 60)
If the game runs with 60fps, then we have 1 frame every 16.7 milliseconds.
WaitTicks(2) is waiting 20 milliseconds.
Now, if we wait 2 ticks/20 milliseconds, and the game creates a frame every ~17 ms,then we have already a tiny flickering every 7 frames.
(at least for 3,3 milliseconds -> (20 - 16,7))
If the game has no markers it will use the c-engine command CanPathTo(pos).
This will also find a path but it's way slower then using the graph with Markers.
I have already experimented with auto generated waypoints.
Well. hard to say if we get this to an beta state. Maybe possible on 5x5 maps.
- I created a grid for a 20x20 map with about 5000 nodes.
- Checked the path between all adjacent nodes.
(I used GetTerrainHeight() and GetSurfaceHeight() to scan the way on every pixel between 5000 x 6 nodes. (30000 connections)
- Removed all nodes that are near hills.
- Removed all nodes that are connecting the same point twice.
- Genreated paths between all startlocations and massmarkers.
- Removed all nodes that ar not needed for a path.
- After this i had about 150 nodes for pathing.
But the calculation time was on my i7 ~1.2 minutes and there where many pathing errors on different maps.
I don't say its not possible, but we won't get this in the near future.