Game Development Community

Problem starting map with many staticShapes

by Tcangussu · in Torque Game Engine · 01/19/2007 (6:41 am) · 11 replies

Hi,

I'm having a problem loading a map in a demo that I'm doing. The map has a lot of tsStatic and StaticShape objects (more than 1.000). After the loading of the map Torque render all the tsStatic objects, but the StaticShape objects only start to render a small time after the game begin. It seens that this objects are synchronized in all the clients because of their animation or something...

I don't really want to synchronize all these objects or their animation in all the clients and I want all of them to be read as soon as the map was loaded.

I tried to change some class, or make this objects not ghostable but it didn't work properly... O.o

Anyone have any idea how I can fix this ???

Thanks!!!

#1
01/19/2007 (7:43 am)
I dont know if this is related to your problem but check this out.
Topic: Max number of objects in Mission Group == 1024 ? Click !
#2
01/19/2007 (7:54 am)
Most likely the ghosting system which is trying to catch up with the amount of objects in the mission.
#3
01/19/2007 (8:28 am)
Billy, I've already read this post but I think this is not my problem... Actually the Torque read and render all the objects that I have in the map but It took some time after the game start and only for StaticShapes.

I think it's something related with the ghosting system... If I press 'N' after the game start I can see the "active ghosts" increasing from 200 to 1.050. And while it increases many objects start to appear in the screen.
#4
01/19/2007 (2:01 pm)
I think I fixed the problem...

I changed the NetFlag in the GameBase to Ghostable and ScopeAlways
Using ScopeAlways it seens that all the objects are loaded and synchronized during the mission load phase. So the loading is taking more time but when the game start I only have 14 active ghosts (before I used to have 1070+).

Well... Now I want to know if it's a good solution...
Anyone have tried this ???
#5
01/19/2007 (2:22 pm)
If the shapes do make sense to be ghostalways (scenery normally does) then this is the quickest/easiest "fix", but realize that in this case, especially if the shapes can be defined by patterns of just a few types of shape models, that you should probably be using shape replicators instead of placing each and every one by hand.

EDIT: Woah--I just re-read how you accomplished this:

Quote:
I changed the NetFlag in the GameBase to Ghostable and ScopeAlways
Using ScopeAlways it seens that all the objects are loaded and synchronized during the mission load phase. So the loading is taking more time but when the game start I only have 14 active ghosts (before I used to have 1070+).

Absolutely and totally a very bad way to do it. You just applied that modification to every single object in your game, thereby completely removing the scoping system, as well as many other network and performance optimizations, as well as "anti-cheat" designs for every one of your game objects.

At a minimum, you should move that change from GameBase to StaticShape, and even so, should be setting the objects themselves as scopeAlways, instead of changing the source code.

Even better, research Shape Replicators and see if they can achieve what you want.
#6
01/19/2007 (4:37 pm)
Hi Stephen,

Thanks for all this information.

I can't use Shape Replicator because I'm using animated shapes and shape replicator doesn't support this.
I don't think this fix was too bad... I looked in the tge code and all the tsStatics are ScopeAlways and many other objects.

Because the gameBase is scopeAlways all the objects are synchronized during the load and appear when the game start!!! These objects are animated and are scene objects, so they are only updated one time during the load phase. I also changed the ScopeAlways to false in the Vehicle class, so players are not scopeAlways! Thus minimizing the cheating.

The Torque code already put many objects in scope (terrain, sky, tsStatic, etc, etc...) but I think it's not a problem because it doesn't update any of these objects.
#7
01/22/2007 (10:30 am)
Changing the default scoping is a bad idea that can cause problems down the road. Torque already has a number of classes specifically designed for different scenarios. For example:

TSStatics - for static objects and scenery that are always in scope
StaticShape - for moveable and animated objects and scenery
ScopeAlwaysShape - for animated objects and scenery that are always in scope
#8
01/22/2007 (11:02 am)
Just to reinforce what I and John said:

By making the default for the GameBase class set to ScopeAlways, you have now made every single object in your game ScopeAlways.

My comment was not that having your objects ScopeAlways was bad--it was that having all of the objects in the game ScopeAlways is what is bad...and that simply means you should do as John said, and use the current objects that are marked as ScopeAlways already--or at least move your code change to a class that is much lower in the hierarchy.
#9
01/22/2007 (2:53 pm)
My problem was exactly because staticShape wasn't ScopeAlways... I have a lot of animated models in the map and when I started the game (a racing game), after one lap there are models still appearing in the map... O.o

I looked in the Torque and it seens that the majority of the objects are always in scope, including the Replicator and others.

I'm also having problems with the StaticShape::onCameraScope method... This method only scope objects in the front of the camera (or if they have higher priority, I'm not sure). So in the racing game there is a radar and all the objects behind me appears to be lagged in the radar.


I would really like to hear other possible solutions to this problem.
The unique other solution that I see is: start the game and then make the player wait one minute, before he can play (and he will wait watching the objects appearing)... Also, synchronize the objects after the game start is slower than during the loading process...
#10
01/22/2007 (2:58 pm)
Quote:
ScopeAlwaysShape - for animated objects and scenery that are always in scope
#11
01/22/2007 (3:05 pm)
Sorry, I didn't read the "animated"...
I'm using StaticShape because we already have 4 maps of the game done using this kind of shape.

Thanks I will look at this class!!
It appears that this class do the same that I've done in StaticShape, so I will have all the animated objects in scope anyway.