Game Development Community

A simple AI

by Arsh · in Torque Game Engine · 04/23/2002 (6:10 am) · 14 replies

I want to make a very basic AI, like a robot that shoot you and move when it see you, or another robot who attack you when you are close to it. I don't need any pathfinding or something aviable for a bot, just a stupid AI for solo games. I'm very nembie so I want an advice to make an enemy animate, detect the player, shoot or hurt, move, die.

Thanks for being patient with me.

#1
04/23/2002 (6:44 am)
Anything you mentioned should be in my two part tutorial ...
Have fun!
#2
04/24/2002 (2:38 am)
Well, but I need a step by step tutorial, for learning to create my own AI and the .cs syntax. Reading a template don't help me much since I'm a real dummy for mods or CC. And learning basic C++ didn't get me far.
#3
04/24/2002 (3:31 am)
Hey, that IS a step-by-step tutorial!
#4
04/30/2002 (2:10 pm)
Ok, ok. I have understood the script, placed it in AIplayer.cs . I want to try it, so I launch Torque Demo, load test mission, call a bot, and... nothing. The bot always stay here until I shoot him. I have missed something to get the script launched ? It may be obvious to you experienced Torque users (Compared to me) but I can't find the "thing" needed.

Note : Don't tell me I'm bad in English, I already know that.
#5
04/30/2002 (2:32 pm)
Could you give us some more input then? Did you check the console (press ^)? Are there any errors? Did you follow all the steps in the tutorials (add the classes to your project, recompile the engine, change all necessary scripts, execute aiplayer.cs, is there a aiplayer.cs.dso file, etc. etc.)?
#6
04/30/2002 (3:35 pm)
The console is "'" or "~" on standard torque versions :)
#7
04/30/2002 (4:04 pm)
Just a side note: RealmWars does not have the necessary code for ai players compiled in.
#8
05/01/2002 (12:53 am)
Marko, on a German keyboard it's ^ ...
#9
05/01/2002 (6:03 am)
First I read the script and understand it.
I follow instruction to include it in the .cs files and save them, after that I launch Torque and add a bot. There is no change at all, not an error in the console.
I thougt that may be a need to the script to be started. So I add a line "AIPlayer::handleWaypointsAndChase(%this);" on the "AIPlayer::onAdd()" function. Now, when add a bot I get :

fps/server/scripts/aiplayer.cs (201): Unable to find object: '' attempting to call function 'getlocation'

What's wrong ?
#10
05/02/2002 (2:38 pm)
I found what was wrong, OK, I have done some test on your AI. And started writing my own that could fit to the game. Anyway, there some missing elements that prevent me from finishing, it would help me much if someone could give me the answer :

- What is the keyword for making a pause (in frame and/or in time) and prevent the infinite loop trap.

- How to make the bot shoot ? The %this.setTrigger(0,true); doesn't seem to work.

Thanks!
#11
03/28/2006 (7:08 am)
I got sdk only 3 weeks ago, but the only problem in this time i have, is how to implement an ai player,
because i can't find it in the world editior creator?
#12
03/28/2006 (7:28 am)
For the stock ai system it's done in script. Refer to aiplayer.cs for details. Basically, in the stronghold mission you'll notice Kork running around on a looping path. The script contails all the details, all you have to do is create a path and get your ai character to spawn in on that path.

There are more advanced ai resources on this website, they are easy to follow and easy to implement. Do a search under resources using 'ai' or 'bot' or 'path'.

Here's one that I quite like & would recommend

AI Guard Unit

It gives you a free roaming ai unit (guard) plus a pathed ai unit (patrol). Both will attack you, the guard can be dropped in with the mission editor and the resource is easy to follow and understand.
#13
03/28/2006 (7:32 am)
They ussually aren't they get spawned through markers and such.
#14
03/28/2006 (7:34 am)
That is true, though the marker is dropped in via the mission editor so some of what I said can be salvaged :p