Game Development Community

Throwcallback problem

by Mark Miley · in Torque Game Engine · 07/06/2004 (12:11 pm) · 4 replies

I have extended my AIplayer class to use a hovervehicle and it is now uses an AIPlayerData datablock instead of using the hovervehicle datablock. Now I have some custom callbacks to script that aren't always being called. I have a function in my aiplayer class that checks the distance between it and the player and if it can see it and stuff so it nows when to move/fire ect.. Now the function itself seems to work because I have the aiming inside that function and it always aims. The callbacks I am using in script handle it's movement and firing. Sometimes when the bot is spawned in it just sits there. Now I know the engine code is working because it is rotating to face me but it won't fire or move when I'm within range. I added in some echo in the script callback functions and sure enough that function wasn't being called. The odd part is that sometimes it works perfectly and other times it doesn't do the callback. I tried putting in a straight Con::executef(...) and the same thing happens. I'm not sure why sometimes it calls the script functions and sometimes not. Any ideas?

#1
07/06/2004 (2:20 pm)
The more I think about it could subclassing the hoverVehicle be the problem? What I mean is that my player is a hovervehicle and the AIPlayer extends off of that, but could that be causing some conflict with movement/actions? Would a better idea be to have a completely separate AI class based off just the vehicle class? I'm sure doing it wouldn't hurt, but would that be something worth doing.
#2
07/06/2004 (2:38 pm)
Mark,

It sounds to me like making a subclass of hoverVehicle, and perhaps copying some code from AIPlayer would be a better way to go.

Just my two cents worth.
#3
07/06/2004 (2:47 pm)
Ok...well that's what I have now and have the problems I've described. It does make me feel good knowing that seems to be the right option though. Thanks.
#4
07/09/2004 (9:19 pm)
Ok so I've been browsing the forums some more and there certainly seems to be all sorts of trouble with AI. Now the root of the problem seems to be a problem in the fact the torque has trouble managing multiple script based bots. Now that seems true from what I've seen as the hard c++ code is being activated on each, but the script instructions are not. Sometimes it get's the callback and sometimes it does not, like it doesn't know how to update each one all the time. Now I'm a little confused as to how to fix this problem.

Now I suppose I could try and move all my bot script stuff into c++ but that defeats the purpose of having scripting so can anyone point me in the right direction here? I am also having a similar problem to the warping issues discussed in this post:

www.garagegames.com/mg/forums/result.thread.php?qt=16254

Now from what I had read in that post though it seemed to be a problem with network games...I'm running a single player mission and having some weird warping issues where my hovervehicles will jump from one position to another. I'm rather befuddled.