Game Development Community

Understanding the Level Editor data

by Don Hogan · in Torque Game Builder · 03/31/2006 (9:21 am) · 4 replies

I decided it made sense to break this off the other thread, so I'll do a little quick quoting for context's sake:

Me:
Quote:
That said, I am curious how the engine is going to handle my taking objects with predefined scene IDs and mixing them in with what I have already that gets IDs at runtime. I.e. my world gets started, objects get created, then at some point I call the datablocks from the .t2d file - if there are clashing IDs, how does the game handle it? Especially with mounted objects where the Level Editor generated datablocks' IDs are all 'hard coded'.

From Matt L.:
Quote:
The Level Builder doesn't hardcode IDs :) If you look at your .t2d file you'll notice its all basically just script, it recreates those objects with thsoe values when the level gets loaded so the IDs won't conflict.

Ok, so when I look at my .t2d file, there are 4 objects that are mounted to a base object. While each has a different mountID, all point to the same mountToID. So, I was assuming that the parent would have to keep the name specified for it - wouldn't it? Or am i thinking about this all wrong?

I'm writing this really slow and re-reading it, so perhaps it's starting to gel. Should I be thinking of the lines below as only being pointers in the script for building my assembly? And as usual it gets its unique ID when it's created and displayed in the game?

mountID = "711110"; // 
mountToID = "75768"; // the ID that the 'parent' object has - all 4 mounted objects point to this

Thanks for helping me understand this!
- Don

#1
03/31/2006 (9:26 am)
My comment was in response to basic object IDs, I thought you were referencing how Torque really stores a unique reference ID to each object (and thats really what you store in a global var when you create something) and didn't think you were talking about just mount IDs.
#2
03/31/2006 (9:40 am)
In response to the uniqueness of mount IDs, presently the Level Builder uses an offset system, this happens when you "add to level" (you can use this to combine different level files, etc.

Internally TGB keeps pretty good track of mount IDs and when mounting, as well as the loadLevel functionality...

To look a bit more at the scripts driving the loading of a level look in "games/common/gameScripts/levelManagement.cs"
#3
03/31/2006 (9:40 am)
Looking at the order and mount considerations taken in there you can get an idea of how the system works :)

EDIT: btw the Beta 2 does have those source script files :)

good questions btw
#4
03/31/2006 (10:11 am)
Actually, when I first asked that's the way I was interpreting it - in my mind the mountID and object were inseparable - then the more I read your reponse and thought about it, the more I questioned myself. =)

I'll definitely dig into the level management file, we're getting sooooo close to the point of having our main features complete I'm getting imaptient to organize content!

Thanks for the explanation and the tip on where to read more - as always, great stuff.

- Don