Game Development Community

Large RPG loading and rendering issues

by Howard Dortch · in Torque 3D Professional · 02/08/2012 (9:05 am) · 62 replies

As the title implies. I load a mission file with buildings, doors, switches etc. As each item loads the engine creates a unique ID for reference. Now I have dynamic items that get loaded as POI items. I have them listed in a database (sqlite) so at the end of the mission load I load the dynamic POI stuff.
Here is the problem: Before all the items from the mission file actually get rendered in the game, the dynamic item loader gets called and one or more items from the mission file will disappear.
So my assumption is that one of the dynamic items is overwriting the ID number from the mission file and it causes the disappering item issue.

Couple of questions:
When creating the mission file would it help to bundle things in Simgroups ?
When creating the dynamic items should I delay creation until I am sure all mission items have been created?

Any help on the proper way to do this?

Page «Previous 1 2 3 4 Last »
#2
02/12/2012 (8:24 am)
My idea is this - don't save the actual dynamic item, save a description. Then create a new item of the same type and assign the properties to it on load. That should avoid ID collisions.

So, I guess where I'm going is simply assign a type name to the ID on save and have your loader use a factory method to create the item from its assigned type name and its description.
#3
02/14/2012 (10:11 am)
That is what I do now, I just store the type pos and rot in a database. I even tried putting a delay between mission load and object load/create and still something will come up missing. It almost seems like a thread/semaphore issue where one thread will want to create an object, assign the ID and at the same time another thread steps on the number.
I did do a missionCleanup.getCount() then use a for() to print all the ID and sure enough it skips one number. Thanks for the reply...
#5
02/22/2012 (6:45 am)
Try loading your dynamic data in Game.onMissionLoaded() before the call to StartGame() perhaps? That is in core/scripts/server/game.cs around line 48.
#6
02/24/2012 (10:41 am)
I have tried everything. The engine is just brokeware and I dont have enough bubble gum or bailing wire to fix it.
I guess I will have to just put everything in the mission file or dynamicly load everything.
Just tired of spending 90% time on the engine and 10% on the game.
Thanks...
#7
02/24/2012 (10:53 am)
@Howard:
If i understand your problem correctly, this is one of the things on the "ToDo" list that we plan on tackling. Unfortunately, there is a whole list of other things ahead of it before we even get there. Hopefully, if we can get some more help in, we can get to this faster. However,as it stands, we are still working on converting T3D TorqueScript over to C#.
#8
02/24/2012 (5:23 pm)
So it is a known bug? I am 2 years into a project and would like to get it done. Do you have any suggestions on how I can cheat it? Is it better to load all out of the mission file? Any suggestions would be great.
#9
02/24/2012 (5:54 pm)
dunno if its a bug or not, but i do know that from your description, thats something that we plan on doing something simular to. we just arent there yet ourselves.
#10
02/24/2012 (8:41 pm)
@Howard, have you checked to make sure that your dynamic objects are named uniquely? Torque will automatically convert an object name to an ID and if you have name collisions it could override the existing object. It possibly could happen even with an object that does not have a name specified.
#11
02/25/2012 (7:07 am)
Good idea Ryan, I will check that. I know there are some statics that go in that are not named...Thanks...
#12
02/26/2012 (7:02 am)
@Ryan that seems to make a difference. I dug into the code that assigns the ID and there should be a check there for name and GUID it like the materials. I also added some Con: code in to report things.
I consider this a bug but I am sure GG has better things to do.
Thanks again....
#13
02/26/2012 (7:27 am)
Also on the naming thing, you can't delete a dynamic object and then later spawn a new one with the same name (as I found out with using items eg: "myItem_1"), it'll complain in the console about not being able to instantiate(sp?) the name and the object won't be created, but it won't actually flag this as an error.
#14
02/26/2012 (5:45 pm)
Well I spoke too soon. It just changed which object is missing now. This is a bug from hell. The object in question is right in the middle of the mission file. It gets created and an ID assigned I echo to the console when onAdd()is called for the object . Before I get in the game howevr the ID is no longer valid. I put a test in a loop at 10 ms to check for isObject(%obj) and if not fail. So it gets created as a valid object but then goes away at GameConnection::onConnect() or there abouts..
I changed everything to have a unique name. All globals are scriptObjects etc...
#15
02/26/2012 (6:26 pm)
@Howard, are you getting any errors in the console log? Also, are you loading up any datablocks through your dynamic loader?
#16
02/27/2012 (7:37 am)
No errors per se, I get material warnings. By loading datablocks you mean exec a file after the mission load? No. I do dynamicly create things but it is objects that are defined.
Odd thing is it is only ONE part missing. I can move that part to another location in the mission file and something else is missing. It's like what ever is on line 1055 will disappear. I have resorted to listing the object ID for every onAdd() and after the load echo a list of all things in the missionCleanup. The object gets created but after the game starts it doesn't exist. That ID number is no longer valid.
I do know that onMissionLoaded is a lie.. I can get in the game and see things being created around me so the mission is not done being created when my dynamics are being called. Thanks...
#17
02/27/2012 (12:29 pm)
I think this is hard to grasp without some code to look at. Do you have some code we can go over and possibly see something you are not seeing?
#18
02/27/2012 (12:47 pm)
How much would you like to see? I hate to just post the whole project after working on it so long.
I managed to "fix" it by duplicating the object in the mission file. Named the first one objectnameFAKE and the second one objectname. So now the first one gets deleted (magic) and the second one renders. Hack city but it works for now.
#19
02/27/2012 (7:16 pm)
I agree with Frank, that we need to see some code to help figure this one out. I am not really sure it is a bug yet until I can see what is going on. I think just the part that is actually creating the objects should be good enough to review.

Another question I have is are you connecting to the server from another machine or is the client and server running on the same box? The reason I ask is that if it is a remote client it could be in the object transmission that could be the problem.
#20
02/28/2012 (1:06 pm)
Here is from the mission file. There are about 20 doors, this is just the one that disappears.

new Door(Al3In) {
dataBlock = "ASwingDoor";
position = "-80.7471 68.1247 105.113";
rotation = "0 0 1 90";
scale = "1 1 1";
isRenderEnabled = "true";
canSaveDynamicFields = "1";
lock = "1";
};

The OnAdd function I get the object ID value and name so I know which door.

function ASwingDoor::onAdd(%this,%obj)
{
echo("AirLock Door "@%obj SPC %obj.name);

}

fron the console.log file

Airlock Door 6265 al3in



and after the game loads, player in and active the door is missing and I open the console ~ and type this:

echo(6265.getPosition())

and the response at the console is this:

<input> (0): Unable to find object: '6265' attempting to call function 'getPosition'

The door object is just not there, yet it gets created.

More?


Page «Previous 1 2 3 4 Last »