Game Development Community

TGB 1.7.3 beta 1 Bug - Behavior Shooter

by Mike Lilligreen · in Torque Game Builder · 04/29/2008 (1:01 pm) · 6 replies

Issue: The Behavior Shooter demo does not work.

Repo steps: Opened the project as normal through the editor, pressed the play button.

Description: When the game started, WASD controls work, but shooting does not. Also, no enemy objects spawn. The following appears in the console:
t2dSceneGraph::addToScene() - Object '1545' is already in a SceneGraph!.
t2dSceneGraph::addToScene() - Object '1550' is already in a SceneGraph!.
t2dSceneGraph::addToScene() - Object '1555' is already in a SceneGraph!.
t2dSceneGraph::addToScene() - Object '1561' is already in a SceneGraph!.
t2dSceneGraph::addToScene() - Object '1568' is already in a SceneGraph!.
t2dSceneGraph::addToScene() - Object '1573' is already in a SceneGraph!.
t2dSceneGraph::addToScene() - Object '1577' is already in a SceneGraph!.
t2dSceneContainer::removeSceneObject() - Object 'Always Scope' but not in Scope-List! (1577)
t2dSceneGraph::addToScene() - Object '1580' is already in a SceneGraph!.

Looking through the scripts, I don't see any obvious issues with the behaviors themselves. Guessing a problem with the cloneWithBehaviors function?

#1
04/29/2008 (1:18 pm)
The addToScene warnings are simply that, warnings, and normally don't apply. The 'Always Scope' error I'm not sure, and will take a look.
#2
04/29/2008 (1:24 pm)
Brought a copy of Astral Objects into TGB 1.7.3. Same issue as the behavior shooter - anything set up using the template behavior that should be added to the scene through cloneWithBehaviors doesn't work. Changing cloneWithBehaviors() to clone() doesn't seem to work either.

The debug banner shows objects being added to the scene through the TotalObject field, but nothing actually appears in the scene.
#3
04/29/2008 (1:35 pm)
Just whipped up a small test case level.

Basically it's just a ship with asteroids controls and the shoots behavior. I put a projectile outside of the camera view and associated it with the shoots behavior on the ship. If the projectile has the template behavior, no projectile will be fired from the ship and the messages seen above appear in the console. If I remove the template behavior, still get those messages but now the projectiles display and fire from the ship properly.

I'll continue to work on this.
#4
04/29/2008 (1:58 pm)
Looks like cloned objects are inheriting the enabled status of the "master" object that has the template behavior.

In TGB 1.7.2, if I gave an object the template behavior - it would disable the master object but all clones would be enabled because they would not use the onLevelLoaded callback. Now in 1.7.3, although cloned objects ignore the onLevelLoaded callback in the template behavior as expected, they are added to the scene with enabled set to false.
#5
04/29/2008 (3:17 pm)
Ok, this is starting to make more sense now.

One of the bugs that existed in 1.7.2 was that cloneWithBehaviors() did not properly copy over the class and superClass fields before registering the object with the simulation, so the object never had their namespaces properly registered.

It sounds as if that fix is now causing this bug, I'll look into it more deeply now that I have a repro case, and know that the issue is with the template field specifically.
#6
05/01/2008 (12:40 pm)
This has been corrected in the repository.

I added an optional argument to cloneWithBehaviors() so that you can choose to disable a cloned object during it's creation, and default this property to false, so with no changes to existing projects, behaviors should operate as expected.