Game Development Community

Camera / AI Bot Weirdness

by kbilly · in Torque Game Engine · 05/30/2005 (9:19 pm) · 8 replies

Greetings All,

I've had TGE for about a month now and had a wonderful time playing with the scripting and tinkering under the hood in the engine. The results have been fantastic - but I've run accross an interesting problem...

I have 20 AI Bots all running on the same path and the camera on a circular path above them. The camera is circling faster than the bots, and when a bot comes in to view, it will flicker about until it finds it's correct position and then keep running from there as if it had been all along. I'm sure I'm making no sense at all - so here's a little clip (1.5MB).

I assumed it was my system struggling - but it never goes below 90fps!
With 10 AI Bots it's fine. With 40 it's at least 10 times worse - even going at 75fps!
(The clip I'm showing has player collision turned off - but the problem still occurs with the collision on.)

Any help would be greatly appreciated.

Bevan.

About the author

Recent Threads

  • Should we be scared?

  • #1
    05/31/2005 (5:52 am)
    Looks like it does some visibility checks or frustrum culling or something (maybe even in the netcode). I would say, check it with 40 real clients, but heh that's a bit tough... Maybe Ben Garney knows something about this?
    #2
    05/31/2005 (5:55 am)
    Did you code the ai? Cause it looks to me like the server is updating the client, who had the wrong position. The unpack and packupdate functions might be mucked.
    #3
    05/31/2005 (9:34 pm)
    No I hadn't touched the engine ai, though since I came accross this problem I've been commenting out sections at a time to determine the cause - no luck though.

    Thanks I'll check into these areas you both mentioned and see how I go.
    #4
    06/01/2005 (7:53 pm)
    Hmmm. I don't think it is a camera issue. As I can keep all the AI bots on camera at once and still get some jerky movement.
    Here's another clip of this occuring.

    The frame rate still stays above 90fps though.
    I was wondering if forcing a lower framerate would fix this, and if this was at all possible.

    I'm using a Radeon 9550 on a P4 3GHz with 1GB RAM.
    One weird thing is because the CPU is dual core (or something), Torque only seems to run in the one core and only takes the CPU Usage up to 50%. Is this normal?
    I'll try on another computer and see how it performs though.

    Any other ideas on this problem are very welcome.
    #5
    06/02/2005 (1:12 am)
    I have no idea why this happens, but I get the same behaviour when I use more than 20 bots. However, even with only 5 bots on screen, this can happen too for those bots which are close to screen limits. (PC 2.8Hz ATI Radeon Mobility, 1GB RAM).
    #6
    06/12/2005 (6:03 am)
    The problem doesn't seem to be computer related as this occured on all machines I tested it on.

    I found if I entered the "World Editor Inspector" (F11) the red spots denoting the AI player objects would be running smoothly and just the meshes would be flickering about.

    I've disabled collisions and shadows and played around with Player::renderImage and TSShapeInstance::render to no avail.

    I've just been on the forums and will check out what gets done per tick and ghost objects next. (Does anyone know exactly wehat "ghost objects" are?).

    Any ideas or thoughts on how to optimize the code to run smoothly for 20 AI bots is very welcome.
    #7
    06/12/2005 (7:19 am)
    I just recently posted about ghosting/ghost objects, you may want to do a forum search, or simply read the documentation--it has an incredibly detailed answer to what they are!
    #8
    06/16/2005 (10:24 pm)
    If I edit GameBase::getUpdatePriority(...) and change
    F32 wSkips = updateSkips * 0.5;
    to
    F32 wSkips = (updateSkips * 0.5) * 5;

    and change player.cc
    static S32 sMaxWarpTicks = 3;
    to
    static S32 sMaxWarpTicks = 27;

    This seems to fix the problem for the moment, although I'm sure more tweaking will be necessary when I have put alot more into the game - but hopefully I'll have learnt alot more by then also.

    Thanks.