Game Development Community

Variable problem

by Mark Miley · in Torque Game Engine · 08/12/2004 (11:22 am) · 6 replies

Still new to programming so this could be a something stupid. I did some updates on AI player and I have a function that controls all of the movement/LOS ect.. Now I have some stuff that I didn't want running every tick so I get an elapsed time and add it into a variable...when the elapsed time reaches a certain number it checks in on the movement of the AIPlayer. Simple, but the elapsed time isn't always getting updated properly with multiple AIPlayers in the game resulting in that bit code never running. That bit of code controls the movement so my bot will just sit there.

I added in a function to check my ElapsedTime and on some bots it updated fine and their code run fine. On others I get stuff like -1.73535e+009...I have no idea where that is coming from. First I thought it could be the way I was getting elapsed time so I slapped in just a elapsedTime += 1; and again I'm still getting the some thing. Sometimes the bots will be fine and all their numbers are updated correctly. Then one here or there will get garbage. I'm not sure what's wrong. Hope the explaination made sense.

#1
08/12/2004 (11:28 am)
Are you using the code to see if the bots are stuck? If so, I have found an better way to do this. I use a ContainerRayCast from the Bots eye to the Waypoint and if there is something blocking it I have the bot sidestep when it gets within 50 feet of the object. This is more efficient, because the time can be affected by network slowdowns. I might be able to help if you post some details, and I can post my sidestep code if it would help.

Marrion Cox
#2
08/12/2004 (4:53 pm)
I'm not sure if they are stuck. If I move them around a bit they still just sit there. If I check there elapsed time it sometimes is garbage. I have my aiming code outside of where it checks the elapsed time and that always works. The bots always turn to look at me, but sometimes they just won't move...which is the code inside the elapseTime Check. For some reason my elapsedTime variable is giving me garbage data instead of the number it's suppose to have. Some bots work and some don't. It's very inconsistant. Sometimes I go in and everything is hunky dory and another time I go in and a bunch of the bots are sitting there looking at me in confusion. Thanks for the suggestion.
#3
08/12/2004 (5:28 pm)
It would sure help to see the code. If you dont want to post it you can send it to the email in my profile and I'll do my best to figure out the flaw. You have my word that I wouldn't steal or distribute your code.
#4
08/12/2004 (7:27 pm)
Hahaha... dude, you dont have to worry about folks here stealing code snippets... we're all in the same boat.

is your code engine or script??

maybe this is a silly comment, but are you checking for a number rather than greater than that number?

-s
#5
08/12/2004 (7:57 pm)
He's all fixed up.
#6
08/12/2004 (8:33 pm)
Yeah...got it...totally my own goof. Thanks for the support. :)