Weird AI vehicle disapearing act
by Mark Miley · in Torque Game Engine · 06/04/2004 (10:41 am) · 14 replies
I'm having a rather unusual problem with an AI vehicle. To better explain the problem I am using a modified aiplayer.cc that is subclassed off of hovervehicle and not the player. I implemented some basic ai shooting and firing stuff so they spawn in and start shooting if they see me blah blah blah. The player is also a hovervehicle and both the player and the AIbot are just vehicles...no players mounted inside.
The problem is that as they are chasing me down they will sometimes just vanish...poof gone. They are still there techinically as they can still fire, but my bullets pass right where they should be. I checked their damagestate and they are enabled so I'm not what's causing them to stop rendering. I had a similar problem with getting the collision impulses working when I ram into them when I first implemented it. I changed some code and that stopped, but it seems to have returned. I took out the impulse code and it is still doing the same thing.
Not sure if anyone has any suggestions. I'm plain stumped at the moment.
The problem is that as they are chasing me down they will sometimes just vanish...poof gone. They are still there techinically as they can still fire, but my bullets pass right where they should be. I checked their damagestate and they are enabled so I'm not what's causing them to stop rendering. I had a similar problem with getting the collision impulses working when I ram into them when I first implemented it. I changed some code and that stopped, but it seems to have returned. I took out the impulse code and it is still doing the same thing.
Not sure if anyone has any suggestions. I'm plain stumped at the moment.
About the author
#2
06/04/2004 (8:05 pm)
That's very curious. Maybe something is making the ghosts disappear on the client? Or the positions are getting hosed?
#3
Bruno: I haven't been using the AIManager for sometime, but I went ahead and ripped out all my code from aiplayer.cs and put it in it's own cs file. I'm doing all of the spawning and and moving differently from the original aiplayer.cs so I'm not even using it now and it's still having the same problem. Oh and Bruno all the code I have is just for hovercraft...it's not mounted with a player on it. If you want to see what I did shoot me over an email at tpelham@nitrousbutterfly.com. My code I'm using is kind of a mess at the moment, but it does work. It's a modification of some steering stuff I found on the forums.
Looking at it closer it seems to only happen when I have more than one of the same type of bot. If I have two bots, one will suddenly vanish. They spawn correctly and both start in on killing me, but then suddenly poof...one gone, but he still shoots and moves and everything else and the system thinks he's fine, but he ain't.
Thinking about it more been it could definitely be some disgreement between the client and server. I'm working on a single player game, but I know just enough about torque to know that doesn't matter. I'm not entirely sure though how the server handles ghosting and all that. It would seem like the server is handling all the logic and the client is just handling the drawing then. Perhaps making the spawning a server command would fix it?
06/05/2004 (7:59 am)
Ben: If I select one before it dissapears and follow it in the editor it's bounding box is still apparent after it disapears. It's right where it should be and handling all of its movement and shooting properly...it's just not being drawn.Bruno: I haven't been using the AIManager for sometime, but I went ahead and ripped out all my code from aiplayer.cs and put it in it's own cs file. I'm doing all of the spawning and and moving differently from the original aiplayer.cs so I'm not even using it now and it's still having the same problem. Oh and Bruno all the code I have is just for hovercraft...it's not mounted with a player on it. If you want to see what I did shoot me over an email at tpelham@nitrousbutterfly.com. My code I'm using is kind of a mess at the moment, but it does work. It's a modification of some steering stuff I found on the forums.
Looking at it closer it seems to only happen when I have more than one of the same type of bot. If I have two bots, one will suddenly vanish. They spawn correctly and both start in on killing me, but then suddenly poof...one gone, but he still shoots and moves and everything else and the system thinks he's fine, but he ain't.
Thinking about it more been it could definitely be some disgreement between the client and server. I'm working on a single player game, but I know just enough about torque to know that doesn't matter. I'm not entirely sure though how the server handles ghosting and all that. It would seem like the server is handling all the logic and the client is just handling the drawing then. Perhaps making the spawning a server command would fix it?
#4
It's a rather strange problem. It acts as if it's completely ok and yet it's just not drawing them on the screen. Seems like a ghosting problem as Ben mentioned, but I'm not sure where to look exactly to fix the problem. Any ideas?
06/07/2004 (3:45 pm)
Well I looked into it a bit more and still no luck. Tried adding in a datablock for AIPlayer and still vanishing. I also noticed that it is happening with only one bot on the screen. It's a rather strange problem. It acts as if it's completely ok and yet it's just not drawing them on the screen. Seems like a ghosting problem as Ben mentioned, but I'm not sure where to look exactly to fix the problem. Any ideas?
#5
Another suggestion.. you might be setting the position of the bot to the same as the other bot (when there are two) resulting in one disappearing.
Just a thought.
06/07/2004 (4:24 pm)
Add in some code to print the position of the vehicle and just log that out, if your getting and large jumps in position, youve got some physics bug coming from a result of the AI input.Another suggestion.. you might be setting the position of the bot to the same as the other bot (when there are two) resulting in one disappearing.
Just a thought.
#6
Also Phil..when they were dissapearing there positions were fine. After the vanished they were still where should be and doing all related actions such as shooting and moving...they just weren't being drawn. I'm still not sure exactly why it's being caused by the disable of collision, but it does appear to be fixed and my hover bots are zipping around shooting me again without vanishing. Thanks all.
06/08/2004 (9:57 am)
Well I figured it out. Totally my fault. I was doing a raycast to check for LOS and when I was having trouble with it I called a disableCollision...I was re-enabling the collision right after the raycast, but for some reason that was causing the disapearing act. I removed that and the bots look pretty stable now. Also Phil..when they were dissapearing there positions were fine. After the vanished they were still where should be and doing all related actions such as shooting and moving...they just weren't being drawn. I'm still not sure exactly why it's being caused by the disable of collision, but it does appear to be fixed and my hover bots are zipping around shooting me again without vanishing. Thanks all.
#7
Where you able to use a vehicle as the datablock for an AIPLayer? I use the standard spawn:
%player = new AIPlayer() {
dataBlock = MyBot; //EnemySub; //EnemySub; //MyBot;
path = "";
};
I have tried it (as you ccan see) using EnemySub and Drone which are both FlyingVehicleData datablocks, but it never liked those.
06/29/2004 (2:18 pm)
Any more on how to make flying bots? I'm trying to make bots that move through the air like vehicles, and it doesn't like me using a VEHICLE as an AIPlayer at all.Where you able to use a vehicle as the datablock for an AIPLayer? I use the standard spawn:
%player = new AIPlayer() {
dataBlock = MyBot; //EnemySub; //EnemySub; //MyBot;
path = "";
};
I have tried it (as you ccan see) using EnemySub and Drone which are both FlyingVehicleData datablocks, but it never liked those.
#8
As I like to say, there are two ways of doing this : Nice flight and Easy flight.
Nice flight involves mounting an AIPlayer to the vehicle. The problem is : Bots can't drive.
Badguy posted a thread where he made a steering function for the bots that will solve your problem when driving a car. But for flight the AIPlayer don't calculate a pitch, only a 2D vector. So nice flight is still a dream...
Easy flight involves changing the onUpdateMove function of the PlayerClass I managed to do it using both the swimming and air-control resource. the swimming resource uses the player eye vector to create the pitch required to let you move in the Z axis. This can be set with setAimLocation().
Some moment in the future I'm going to try to add this up as a resource.
HTH
06/29/2004 (2:32 pm)
Andrew,As I like to say, there are two ways of doing this : Nice flight and Easy flight.
Nice flight involves mounting an AIPlayer to the vehicle. The problem is : Bots can't drive.
Badguy posted a thread where he made a steering function for the bots that will solve your problem when driving a car. But for flight the AIPlayer don't calculate a pitch, only a 2D vector. So nice flight is still a dream...
Easy flight involves changing the onUpdateMove function of the PlayerClass I managed to do it using both the swimming and air-control resource. the swimming resource uses the player eye vector to create the pitch required to let you move in the Z axis. This can be set with setAimLocation().
Some moment in the future I'm going to try to add this up as a resource.
HTH
#9
I'm just starting out and trying out path following, however, I seem to have
a wierd disappearance problem too. In some areas, my bot is fine, dandy,
and visible, and then in other areas, he will disappear. I can still see his
inivisible body running around in the World Editor. There seems to be some
sort of region where he can't be seen, because when I move the path to
straddle those 2 regions (viewable and not viewable), he will appear and
disappear while following the path.
Anyone have any ideas?
02/11/2005 (9:18 am)
I have a similar problem:I'm just starting out and trying out path following, however, I seem to have
a wierd disappearance problem too. In some areas, my bot is fine, dandy,
and visible, and then in other areas, he will disappear. I can still see his
inivisible body running around in the World Editor. There seems to be some
sort of region where he can't be seen, because when I move the path to
straddle those 2 regions (viewable and not viewable), he will appear and
disappear while following the path.
Anyone have any ideas?
#10
02/12/2005 (6:14 am)
Missing bots may happen due to the AIManager use. Try using a think method binded to the AIPlayer class and schedule each think separately.
#11
Have you modified your networking code at all?
02/12/2005 (8:03 pm)
The AIPlayers should show up whether or not the AIManager is used - the manager just controls how they act. (Or should.)Have you modified your networking code at all?
#12
02/15/2005 (1:55 am)
I've had the same problem. I don't remember exactly, but I think it was something to do with the advanced camera, do you use it?
#13
Lidwine - I am using the advanced camera - any ideas?
03/08/2005 (10:01 am)
Ben- I haven't modified the network code,Lidwine - I am using the advanced camera - any ideas?
#14
And I am using the advanced camera too. Is there any relation?
10/10/2005 (1:33 am)
Me too, I've had the same problem. :-(And I am using the advanced camera too. Is there any relation?
Torque Owner Bruno Grieco
It may seem completely unrelated, but I had problems with this :
The Torque AI Management system have some strange bugs I could never actually track down. One sollution that minimized the problem was not creating the AIManager scriptObject.
Instead my bots are just AIPlayers with think methods for each instead of a think method for AIManager.
Other point is that I was never able to get a bot to drive a flying ( or hover ) vehicle. If you were willing to share your code, I'm very interested in it.
HTH