question about datablocks (may sound stupid, but need help)
by Isaac Barbosa · in Torque Game Builder · 06/10/2009 (10:09 am) · 5 replies
Hi,
I need to know something that may sound stupid to ask, but can´t figure or found info about it:
How it is possible to create datablocks for stuff prior to use instead of create every datablocks when datablocks.cs is compiled?
Need to try if that makes my game loads faster.
Thanks
Isaac
I need to know something that may sound stupid to ask, but can´t figure or found info about it:
How it is possible to create datablocks for stuff prior to use instead of create every datablocks when datablocks.cs is compiled?
Need to try if that makes my game loads faster.
Thanks
Isaac
#3
Can you:
1. Build levels with that graphic in editor
2. Save the level
3. Remove datablocks from "datablocks.cs" file
4. Load images later during the game (just before loading level)
5. Load a level
Will that work if i write those lines of code below each other in the same function:
06/11/2009 (9:43 am)
How do you build levels then? When you have no graphic loaded in your TGB editor?Can you:
1. Build levels with that graphic in editor
2. Save the level
3. Remove datablocks from "datablocks.cs" file
4. Load images later during the game (just before loading level)
5. Load a level
Will that work if i write those lines of code below each other in the same function:
function nextLevel(){
loadGraphics();
LoadLevel();
}Or i have to monitor loading, and w8 for all graphics to load?
#4
I guess I will keep the datablocks.cs until I finish my game and once it is done for release, I will split the script in several scrips as needed.
Otherwise, I don´t know which approach use to achieve this goal.
Cheers
Isaac
06/11/2009 (9:57 am)
Building levels this way may be a problem since no graphic are loaded in the TGB editor.I guess I will keep the datablocks.cs until I finish my game and once it is done for release, I will split the script in several scrips as needed.
Otherwise, I don´t know which approach use to achieve this goal.
Cheers
Isaac
#5
Or maybe change the source code of the editor to read all of your scripts in order if you pass in an argument. i.e., tgb.exe /loadall
then it would look in your folder for all your scripts and load all of the scripts?
11/24/2009 (8:39 pm)
Perhaps there's a way to script the creation of the separate scripts?Or maybe change the source code of the editor to read all of your scripts in order if you pass in an argument. i.e., tgb.exe /loadall
then it would look in your folder for all your scripts and load all of the scripts?
Torque Owner Mike Wright
Default Studio Name
Create a new .cs file and add your datablocks into it. (remove them from "datablocks.cs")
For example, to load datablocks only referenced during level "1" gameplay, create a new file called "level1Datablocks.cs".
Then in that file you can group the datablocks together.
$levelSpecificDatablocks = new SimGroup() { <add stuff here> };
(or new SimSet depending upon your needs)
Set each datablock with preload = "0" and allowUnload = "1"
load the datablocks on the fly, when you need them with:
exec("game/data/datablockFiles/level1Datablocks.cs")
This way you can also delete them at the end of the level, if you no longer need to reference them.
$levelSpecificDatablocks.delete(); (works for SimGroup, you must delete SimSet contents individually)