AI Player
by Jacob Dankovchik · in Torque Game Engine · 03/30/2004 (2:37 am) · 9 replies
Latly i've been havin trouble with this. The AI player just kinda runs his rounds without doin anything else, and i was wonderin how i get him to attack me. Like, is the code already there, and soemthin small i have to change, or is there more work involved? I tried some tut for it, but instead the bot just sat and did nothin at all.. Anyone have this issue before? thx
About the author
#2
04/02/2004 (3:33 pm)
Argh, still nothin! keeps runnin his loops, and if i remove the points, he doesnt spawn, and if i leave the first he does, but stays on it, and if i remove it after he spawns in the game, he runs off to the top of a mountain.. :/ Dont get why im havin such bad luck in gettin this damn things goin! :(
#3
One thing you might want to do is to get close to one of the bots, and then open the console window and look for error messages. That should lead in the right direction ;)
Peace
04/03/2004 (6:50 am)
Well, if you post your AIPlayer.cs and bot.cs files, I can take a look and see what you are doing wrong. There were some things that I had to do differently from that resource to get it to work, but I don't remember right off the bat what it was.One thing you might want to do is to get close to one of the bots, and then open the console window and look for error messages. That should lead in the right direction ;)
Peace
#4
04/03/2004 (8:59 am)
Well, tried that last part there, no errors, nothin.. :/ As for the bot.cs, i dont even have one.. for my aiplayer http://www.angelfire.com/dragon/imagerunner/aiPlayer.cs is the location... i just uploaded it to save on the space used up here..
#5
It doesn't look like you added anything from that resource. The bot isn't going to attack unless you tell it to, there is no attack built into the engine. To make the bot attack, you have to make the bot run towards the player, aim at the player, and shoot. You will have to decide when and why your bot would attack the player, check for that situation, and execute when the condition is met. The resource I posted shows how to make the bot come after the player immediately after finishing the patrol path.
You might want to do other things, like every AI frame, check to see if the bot can see the player. And if the bot can see the player, you might want to stop the patrol and attack the bot. Or perhaps, retreat to a safer location, and then snipe from behind something.
THe AI that currently exists in the torque engine seems to be limited to locomotion and animation control, and some basic waypoints. If you want decent AI, you will need to add the steering/pathfinding, decision making and combat control layers.
I'd suggest starting by trying that bot scripting resource again, and add the code to the aiplayer.cs that it lists.
Peace
04/04/2004 (6:19 am)
Hi Jacob,It doesn't look like you added anything from that resource. The bot isn't going to attack unless you tell it to, there is no attack built into the engine. To make the bot attack, you have to make the bot run towards the player, aim at the player, and shoot. You will have to decide when and why your bot would attack the player, check for that situation, and execute when the condition is met. The resource I posted shows how to make the bot come after the player immediately after finishing the patrol path.
You might want to do other things, like every AI frame, check to see if the bot can see the player. And if the bot can see the player, you might want to stop the patrol and attack the bot. Or perhaps, retreat to a safer location, and then snipe from behind something.
THe AI that currently exists in the torque engine seems to be limited to locomotion and animation control, and some basic waypoints. If you want decent AI, you will need to add the steering/pathfinding, decision making and combat control layers.
I'd suggest starting by trying that bot scripting resource again, and add the code to the aiplayer.cs that it lists.
Peace
#6
04/04/2004 (6:22 am)
K.. Ya, that one i posted was my original, not my modified. However even after i added the code, it didint change, however im gonna try it again.. Im workin on somethin of my own right now, see how it works out. Gonna start small by first making the bot run at the player instead of waypoints. Then im gonna make a check if the player is in view, and if so run at him, otherwise run waypoints. Then i'll add attacks, and then just small touchups.. :D
#7
04/04/2004 (9:51 am)
K.. ran thru it again, still nothin.. im gonna try checkin everything over again, see if somethin went wrong.. Would u like me to post my modfied aiplayer.cs? And thanks again for tryin to help.. :D
#8
peace
04/04/2004 (10:07 am)
Yes, if you cant get it to work, post the full aiplayer.cs again and I'll check it out when I get time.peace
#9
i have a question on a topic related to the AI Player, so i decided to post it here. is it possible for dynamic allocation of path markers? for example, could you read a text file with positions, and populate the path from that?
Cheers
04/05/2004 (3:23 am)
Hey,i have a question on a topic related to the AI Player, so i decided to post it here. is it possible for dynamic allocation of path markers? for example, could you read a text file with positions, and populate the path from that?
Cheers
Torque Owner Gerald Fishel
Development Ninja
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2505