Game Development Community

SceneLoading folders, or control

by Will O-Reagan · in Torque X 2D · 07/10/2007 (10:39 am) · 9 replies

1: It seems as though sceneUnloading is supposed to be able to target a single scene, but it doesnt always, and I'd like to be able to change that. Especially considering mass deleting of the objects in a single scene does not clear away loaded materials, which can take up valuable resources(unless I am mistaken about this?)

2: It also seems as though we should be able to load a particular scene into a scene folder, or the scene container, but I don't think I've ever seen this implemented. This would allow us to just "delete" a scene perhaps, without unloading the entire scenegraph

3: I've considered buying the source, so I can possiby subclass or create a second scene loader, capable of add implemeting some of these features, but I'm afraid that might be too high of a level of coding for me to accomplish. Simply put, if that is the only option, thats what I'm going to have to do I'm afraid, but I'd like to hear some opinions on this first.

About the author

I have a degree in dramatic art, and literature, from UC Santa Barbara. I've worked for a few studios, also at Animax Ent in 2008, and some smaller studios. Currently studying Computer Science at CSU Channel Islands.


#1
07/12/2007 (6:54 pm)
Sorry for bumping this, but the weekends coming up. I was hoping this could get answered.

I was told it would be possible to create a "master" scene, containing characters, buttons, armor, gui etc.

And then load and unload combat scenes/ maps, as needed. However, I can't see how this is possible with my the current TorqueX configuration? Can someone please explain to me how I can pull this off?
#2
07/14/2007 (2:04 am)
Good luck with this, i dont use levels / scenes in my project. if you look for an alternative, you might consider adding all your "level" objects to a list, and then when you are deleting your scene, just manually looping through and unregistering everything in the list.


hope that helps,

-j
#3
07/14/2007 (7:28 am)
Keep in mind that there is only a single instance of a "scene" in TorqueX, so I think your definition is different from the stock implementation (and having seen your project, I'm reasonably sure I know what you want to do).

Jason has a really good idea--I'd set up a list for each of your "areas", and serialize via that list myself given what you've got set up currently (assuming it hasn't changed drastically).
#4
07/14/2007 (1:48 pm)
Ok, thanks...

edit: cleared up reply.
#5
07/31/2007 (2:56 pm)
The problem with deleting everything on the list is you can't load the same scene twice, if a scene is loaded, you can't load it again with the current configuration if that scene is currently loaded... Meaning I'll basically be shooting myself in the foot if I try to reload the stuff I delete. So, Stephen and Jason, your suggestions won't work.
#6
08/01/2007 (2:58 am)
Sorry if i dont fully understand the problem, but cant you do something like:

Have one txscene file (persistant.txscene) that contains everything you want to carry between each stage

Then have seperate scene files (stage1.txscene, stage2.txscene) that just contain everything that needs to be removed


Then when you first load the game you'd have

SceneLoader.load("persistant.txscene");
SceneLoader.load("stage1.txscene");

and at a level change you'd have

SceneLoader.unload("stage1.txscene");
SceneLoader.load("stage2.txscene");


This is how I do it. Though i must say I have my scenegraph defined in the stage files, but I imagine if you defined it in the persistant file instead it shouldn't be removed.
#7
08/01/2007 (9:23 pm)
@Josh that idea has merit, but I chose another path...

@Stephen, Josh, and Jason, Thank you for all of your time.

I broke down and bought the source, and was finally able to make some progress in my game by changing a few lines of code... I think this is really a testament on how easy to work with Garage Games tools are. Here I am programming a really big game, with very little expereince, and Its working. I don't know how to explain it. But thanks!

If anyone wants to know what I did to get over this hurdle, I can post a TXPro users only blog about it.
#8
08/02/2007 (10:21 am)
You can post torquex code in here cant you? This is the TorqueX forum after all.
#9
08/02/2007 (5:56 pm)
@Will: That might be a useful resource.

@James: Source code is technically only supposed to be posted in the Pro forums. Nobody here is really particular about that as long as people are being reasonable. Learning the underlying functionality can greatly help your productivity with the engine, although that could be seen as a sales point for buying Pro in the first place. That said, several people have been banned in the past for posting source from pirated copies of our tech.