Vehicles using AIPlayer
by Brian Marlow · in Torque Game Engine · 12/08/2003 (1:47 pm) · 4 replies
I implemented an AI bot using the Bot-Path Finding tutorial from http://www.codesampler.com/torque.htm
I tried to modify the BOT.CS code so it would create a wheeled vehicle instead of a player... I tweaked it successfully so that it spawns a new vehicle... however it said that ... setMoveDestination() function is an unknown command...
I tried making a class deriving from the AIPlayer class like
%car = new AIPlayer(){};
However it does not work and says that its NULL...
%car = new WheeledVehicle() {}; works though, but then I can't use any of AIPlayer classes functions...
Any ideas how I can make AIPlayer spawn vehicles and have them behave like any other bot?
Thanks
-Brian
I tried to modify the BOT.CS code so it would create a wheeled vehicle instead of a player... I tweaked it successfully so that it spawns a new vehicle... however it said that ... setMoveDestination() function is an unknown command...
I tried making a class deriving from the AIPlayer class like
%car = new AIPlayer(){};
However it does not work and says that its NULL...
%car = new WheeledVehicle() {}; works though, but then I can't use any of AIPlayer classes functions...
Any ideas how I can make AIPlayer spawn vehicles and have them behave like any other bot?
Thanks
-Brian
#2
12/08/2003 (2:02 pm)
All this work to discover the current bots cannot drive :)
#3
12/08/2003 (2:07 pm)
What they can't drive? :)
#4
they dont know how to "Steer" the vehicle.
it is different than just walking.
they will just sit there and bust nuts. :)
basically the calculation's for angle to turn dont work properly when taking the vehicle into consideration.
if you got good math skill's you can fix this.
I have written a fix once... Im not that great at the math.
and did it the harder way :) but it works just fine.
someone else tho who was better at math wrote it too.. they are both around the forums somewhere here.
Ok I found the link I added my code too:
www.garagegames.com/index.php?sec=mg&mod=forums&page=result.thread&qt=5091
maybe from here you can find the better math to do it.
this will work tho if you feel lazy.
12/08/2003 (2:13 pm)
Nope...they dont know how to "Steer" the vehicle.
it is different than just walking.
they will just sit there and bust nuts. :)
basically the calculation's for angle to turn dont work properly when taking the vehicle into consideration.
if you got good math skill's you can fix this.
I have written a fix once... Im not that great at the math.
and did it the harder way :) but it works just fine.
someone else tho who was better at math wrote it too.. they are both around the forums somewhere here.
Ok I found the link I added my code too:
www.garagegames.com/index.php?sec=mg&mod=forums&page=result.thread&qt=5091
maybe from here you can find the better math to do it.
this will work tho if you feel lazy.
Associate James Urquhart
i think you make a player using :
If you want to have vehicles that act like bots, you could just spawn a player and mount the player to a vehicle.
See the game.cs in the "starter.racing" demo. (function GameConnection::createCar) on how to make the car.
And when you want to mount the player, just use :
Then you should be able to move the player and move the vehicle.