The Daily Click ::. Forums ::. Klik Coding Help ::. Problem with AI
 

Post Reply  Post Oekaki 
 

Posted By Message

Jatzek(DreamEvil Corp)



Registered
  21/06/2003
Points
  949

VIP Member
12th July, 2010 at 17:54:14 -

So, basicly I am trying to make an online game, and I have a small little program with my AI. I start two client programs, log in with them to the server (currently localhost), and spawn an enemy at the map. The enemy has a circle around him which is his sight range, whenever one of the players enters it's sight range the enemy starts following him. My problem is as follows:

Whenever I start luring away the enemy with my player, and I lure him near the other player, at my client the enemy still follows me, but at the other client it starts to follow him. My code basicly looks like this:

* When MYPLAYER overlaps ENEMYSIGHT
* When ENEMYSIGHT overlaps ENEMY (this is for the program to know which enemy I am talking about)
* When ENEMY flag 1 is OFF
- ENEMY look in direction of MYPLAYER
- ENEMY set flag 1 ON

* When OTHERPLAYER overlaps ENEMYSIGHT
* When ENEMYSIGHT overlaps ENEMY (this is for the program to know which enemy I am talking about)
* When ENEMY flag 1 is OFF
- ENEMY look in direction of OTHERPLAYER
- ENEMY set flag 1 ON

* When ENEMYSIGHT doesn't overlap OTHERPLAYER
* When ENEMYSIGHT doesn't overlap MYPLAYER
- ENEMY set flag 1 OFF

So basicly I've used the flags because if my enemy starts following someone he should follow him until he loses his sight and not change targets in between.

Anyone knows any usefull solution for my problem?

If my problem is not clear enough, I'll try posting a screenshot too.

Thanks in advance

 
"Some nightmares never go away"

I'm waiting for you in SILENT HILL!
   

Post Reply



 



Advertisement

Worth A Click