Game Development Community

AIPlayer Client/GameConnection

by Mr Meikel · in Torque Game Engine · 02/19/2006 (11:01 am) · 2 replies

Hi,

I'm fiddling around with aiPlayer.cs, and have introduced characteristics for each bot to have (simulating sight, attentiveness, aggression etc), after a bit of thinking I have decided I would like players to "learn" how each bot plays, as you would with a normal non-AI player. To do this, I need to store my characteristic variables somewhere, as the AIPlayer is deleted when it dies, and the AIPlayer doesn't have a GameConnection.
This also means that a bot doesn't have a "score", and that the GameConnection::onDeath function behaves differently when you are killed by a bot (%sourceClient is 0, as AIPlayer doesn't have a client/GameConnection).

I just wondered if anyone had tackled this problem before, and any information people could share with me :)

I was thinking of just making some form of array in the AIManager scope that stores characteristics, name and score, and use an if statement in the onDeath statement to differentiate between the bots and normal players. Maybe there is a more elegant solution?

#1
02/19/2006 (11:09 am)
I used to store everything in an array and also store the object ID of the bot in there. Upon death, I respawn the new bot and change the object ID so that I can call the new bot with the settings again.
#2
02/20/2006 (1:13 am)
Sounds good, that's probably what I'll try.

Thanks very much :)