I have 2 questions for use in my
Tower Defense Game. The enemies will be using Dark AI for pathing around the players' towers and throughout the map. The enemies will not attack, but simply move from their spawn to their goal.
The first question is how to prevent entities from colliding. I am going to have many enemies all traveling the relative same path, but some will move much faster than others, and I want them to be able to clip through each other and not try to go around.
Edit: Found it in the help files: AI SET AVOID MODE
The second is how I would best create collision for a tile based game? Here is a rough idea of the current code:
type GridType
TileImage as dword
AIPathable as boolean
endtype
global dim Map(95,95) as GridType
` Load the map here
LoadMap()
` Create Collision
for x = 0 to 95
for y = 0 to 95
if Map(x,y).AIPathable = 0
AI Start New Obstacle
AI Add Obstacle Vertex x*32,y*32 : ` Top Left
AI Add Obstacle Vertex (x+1)*32,y*32 : ` Top Right
AI Add Obstacle Vertex x*32,(y+1)*32 : ` Bottom Left
AI Add Obstacle Vertex (x+1)*32,(y+1)*32 : ` Bottom Right
endif
next y
next x
AI End New Obstacle 0,1
In a 96x96 map (my current maximum) there are 9,216 squares. I estimate that about half or more will be non-pathable. Is there a better way to do this than to create a huge amount of obstacles? This is my first time really working with Dark AI so I haven't learned any neat tricks just yet.
Thanks in advance for any help you can provide.
- GIDustin