Game Development Community

T2D 1.1 Alpha) Two bugs in spaceshooter

by Jason Cahill · in Torque Game Builder · 11/28/2005 (2:50 pm) · 6 replies

I've noticed two bugs in the spaceshooter that I haven't seen reported. I don't know where the error lies, because I haven't debugged it. They are:

1) The shield doesn't appear around the ship when you pick up the power-up.
2) The mounted "helper" ships don't render, nor do they move.

I suspect that in both cases, the problem is the same: It looks like mounting is either broken in the 1.1 alpha, or the way this demo sets up the mounts is broken.

#1
11/28/2005 (4:15 pm)
To confirm this the "inherited attribute" in the mounting isn't working correctly and autorotation isn't either

if you get a helper before you die they will show in the correct spots but won't rotate, after you die the player is setEnabled(false) and so is the mount system for the player, when the player is re-enabled the mount system is not so anything mounted to it in the f uture doesn't appear.
#2
11/28/2005 (4:32 pm)
If you get something before you die then it shows up, but afterwards it doesn't. It appears that the mount is being hidden when the player dies, but not re-enabled afterwards.

Add this line in the newPlayer function and it works correctly.

$player.mountSystem.setEnabled( true );

On a related note to the helper ships don't move. if you have a helper ship and it hits an upgrade before you do then it destroys the helper ship rather than upgrading it. This can be fixed by copying and modifying the player<->upgrade collision for the "helper".


Darn, Matt beat me to it. I should probably refresh a thread before posting if it's been awhile since I pulled it up.
#3
11/29/2005 (2:11 am)
*scribbles notes*

Thanks guys; I've posted this bug (#851).

- Melv.
#4
12/01/2005 (11:18 am)
Okay, I've found what the problem is here. When I went through and made considerable changes so that only the absolute minimal processing is done when and if an object changes; I inadvertently missed the transition for owned, mounted objects whose parent is disabled and then becomes enabled. This transition is checked by the child, which is disabled at this point, and doesn't get checked as this is part of the integrate routine which gets skipped for this object because it is currently disabled.

A fix is to check to see if the object is in this condition e.g. mounted and owned and the parent is current enabled. If this check is positioned in the condition correctly, it'll only get checked if the object is in this condition and shouldn't affect the performance when you've got lots of objects.

Through all this, the "autoRotation" parameter seems to be working perfectly; only things that are inheritted will be affected.

@Matt: If you've found an "autoRotation" problem then please, could you provide me a simple script showing the problem? Thanks!

Anyway, here's the new "subUpdateScene()" function for those who can't wait for alpha#2...
#5
12/01/2005 (11:18 am)
... continued ...

//-----------------------------------------------------------------------------
// Sub-Update Scene.
//-----------------------------------------------------------------------------
void t2dSceneGraph::subUpdateScene( const F32 elapsedTime, CDebugStats* pDebugStats )
{
#ifdef T2D_DEBUG_PROFILING
        PROFILE_START(T2D_t2dSceneGraph_subUpdateScene);
#endif
    // Update Graph Time.
    mSceneTime += elapsedTime;

    // Only Process if we've got objects in the scene!
    if ( getSceneObjectCount() > 0 )
    {
        // Increment Update Sequence.
        nextUpdateSequence();

        // Fetch First Object.
        t2dSceneObject* pSceneObject2D = mpProcessHead->mpNextProcess;

        // ****************************************************
        // Pre-Integrate Stage.
        // ****************************************************
#ifdef T2D_DEBUG_PROFILING
        PROFILE_START(T2D_t2dSceneGraph_preIntegrate);
#endif

        while ( pSceneObject2D != mpProcessHead )
        {
            // Is the object enabled?
            // NOTE:- We also need to check if we're disabled but owned by a mount that is now enabled.
            if ( !pSceneObject2D->isBeingDeleted() && (pSceneObject2D->getEnabled() || (pSceneObject2D->getIsMounted() && pSceneObject2D->mMountOwned && pSceneObject2D->getProcessMount()->getEnabled()) ) )
            {
                // Pre-Inegrate.
                pSceneObject2D->preIntegrate( mSceneTime, elapsedTime, pDebugStats );
            }

            // Fetch Next Object.
            pSceneObject2D = pSceneObject2D->mpNextProcess;
        }

#ifdef T2D_DEBUG_PROFILING
        PROFILE_END();   // T2D_t2dSceneGraph_preIntegrate
#endif
        // Reset to first object.
        pSceneObject2D = pSceneObject2D->mpNextProcess;


        // ****************************************************
        // Integrate Object Stage.
        // ****************************************************
#ifdef T2D_DEBUG_PROFILING
        PROFILE_START(T2D_t2dSceneGraph_integrateObject);
#endif

        while ( pSceneObject2D != mpProcessHead )
        {
            // Is the Object enabled and not being Deleted?
            // NOTE:- We also need to check if we're disabled but owned by a mount that is now enabled.
            if ( !pSceneObject2D->isBeingDeleted() && (pSceneObject2D->getEnabled() || (pSceneObject2D->getIsMounted() && pSceneObject2D->mMountOwned && pSceneObject2D->getProcessMount()->getEnabled()) ) )
            {
                // Post-Update.
                pSceneObject2D->integrateObject( mSceneTime, elapsedTime, pDebugStats );
            }   

            // Fetch Next Object.
            pSceneObject2D = pSceneObject2D->mpNextProcess;
        }

#ifdef T2D_DEBUG_PROFILING
        PROFILE_END();   // T2D_t2dSceneGraph_integrateObject
#endif

    }
#ifdef T2D_DEBUG_PROFILING
        PROFILE_END();   // T2D_t2dSceneGraph_subUpdateScene
#endif
}

- Melv.
#6
12/01/2005 (12:25 pm)
Awesome. Thanks for the bug fix!