A forum to store posts deemed exceptionally wise and useful
roxaz
Posts: 575 Joined: Tue Jan 23, 2007 8:35 pm
Location: LT
Post
by roxaz » Sun Apr 01, 2007 8:35 pm
This might be very useful for you
Link removed by moderator
examples from the book (sources abd binaries):
www.wordware.com/files/ai
**Moderator Edit**
Unless you have permission from Wordware Publishing, Inc you can't distribute the entire book.
franklyn
Posts: 36 Joined: Thu Mar 15, 2007 7:03 pm
Post
by franklyn » Sun Apr 01, 2007 10:36 pm
isnt that illegal ?
roxaz
Posts: 575 Joined: Tue Jan 23, 2007 8:35 pm
Location: LT
Post
by roxaz » Mon Apr 02, 2007 8:55 am
i just wanted to help
franklyn
Posts: 36 Joined: Thu Mar 15, 2007 7:03 pm
Post
by franklyn » Mon Apr 02, 2007 7:58 pm
hehe. well we definitely appreciate it.
are you working on ai atm ?
dejai
Posts: 522 Joined: Sat Apr 21, 2007 9:00 am
Post
by dejai » Tue Jun 26, 2007 11:21 am
Hmm, where could I "purchase" this novel...
JJ But really were is or what is this thread about??
Dances
Posts: 454 Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:
Post
by Dances » Tue Jun 26, 2007 11:15 pm
dejai wrote: Hmm, where could I "purchase" this novel...
JJ But really were is or what is this thread about??
You can buy it with the link in the first post. Its right at the bottom of the page.
Frodenius
Posts: 64 Joined: Sun Aug 29, 2004 11:24 am
Location: Germany/Frankfurt
Contact:
Post
by Frodenius » Fri Jun 29, 2007 4:41 pm
hey roxaz if you wouldnt mind you could knowingly commit a crime and pm me your link, im a poor student and interested in ai game programming... i could eventually accept this crucial lapse with a heavy heart..
worst programming style ever seen...
BlindSide
Admin
Posts: 2821 Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!
Post
by BlindSide » Fri Jun 29, 2007 5:24 pm
You don't need the book Frodenius. Come on AI is just common sense in my opinion. Besides there are millions of articles for you on gamedev.net about A*, etc etc.
Dances
Posts: 454 Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:
Post
by Dances » Fri Jun 29, 2007 6:41 pm
Yes there are even A* libraries such as this one
http://www.grinninglizard.com/MicroPather/index.htm to help you along as well.
AI is really a bunch of decision making if statements.
For example if you want a monster that runs at your character and explodes your AI is something like this:
Code: Select all
if(monster->isAlive())
if(moster->canSeePlayer())
{
if(player->getPosition.X() < monster->getPosition.X())
monster->moveXNegative();
else
monster->moveXPositive();
if(player->getPosition.Z() < monster->getPosition.Z())
monster->moveZNegative();
else
monster->moveZPositive();
if(monster->getPosition.X() - player->getPosition.X() < 10 ||
monster->getPosition.X() - player->getPosition.X() > -10)
if(monster->getPosition.Z() - player->getPosition.Z() < 10 ||
monster->getPosition.Z() - player->getPosition.Z() > -10)
if(monster->getPosition.Y() - player->getPosition.Y() < 10 ||
monster->getPosition.Y() - player->getPosition.Y() > -10)
monster->explode();
}
Its simple, like writing out a thought process.
Katsankat
Posts: 178 Joined: Sun Mar 12, 2006 4:15 am
Contact:
Post
by Katsankat » Sun Jul 01, 2007 6:50 pm
The word terrorist would fit well, instead of monster.
arras
Posts: 1622 Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:
Post
by arras » Thu Aug 30, 2007 7:25 pm
I would recommend you to leave it monster ...else somebody may come with idea of spreading war against terrorism to your code. You dont want to se Toronto be bombed by F15s and Tomahawks, do you?
kornwaretm
Competition winner
Posts: 189 Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:
Post
by kornwaretm » Tue Nov 13, 2007 8:44 am
sorry i'm indonesian
this code rotate each actor to face their closest target, but stil got some trouble, may be because i haven't read all about matrixes
Code: Select all
void runAi(actor* head){
float jarak,dX,dZ,sudutTarget,sudutSekarang;
core::vector3df pos1,pos2,rot;
int attack;
float tambahan;
bool attackAble =false ;
if(Live>0){
if((target==NULL)||(target->Live<1)){
pickTarget(head);
resetControl();
//printf("id : %d cari musuh %d\n",id,&target);
}else{
pos1 = node->getPosition();
pos2 = target->node->getPosition();
dX = pos2.X-pos1.X;
dZ = pos2.Z-pos1.Z;
if(pos2.Z>pos1.Z){
dZ *= -1;
dX *= -1;
tambahan = 180;
}else{
tambahan = 0;
}
jarak = sqrt(dX*dX+dZ*dZ);
rot = node->getRotation();
sudutSekarang = rot.Y;
sudutTarget = atan(dX/dZ);
sudutTarget = sudutTarget*180/3.14;
if(sudutSekarang+10 < sudutTarget+tambahan){
input->turn = 3;
attackAble=false;
}else if(sudutSekarang-10 > sudutTarget+tambahan){
input->turn = -3;
attackAble=false;
}else{
attackAble=true;
}
if(jarak>20){
input->accelerate=2;
}else if((jarak<=20)&&(jarak>10)){
input->accelerate = 1;
}else{
input->accelerate=0;
if(attackAble){
input->turn = 0;
if(target->Live>0){
input->speedAttack = true;
}else{
input->speedAttack = false;
}
}
}
}
}
}
i assume even if the ai to control the it self it throug a class thal i call the input class.