Game Development Community

Life after Torque Demo

by Gordon Walton · in Torque Game Engine Advanced · 08/25/2005 (12:47 pm) · 7 replies

Some of my friends think i could be crazy, because of what i'm doing, sometimes i think i'm crazy then i have another cup of coffee. Anyway after much deliberation, reviewing of graphics engines, including those on a par with Unreal 3, i have decided to use the Torque Shader Engine, and have spent the last week trawling through the code. Why? Because i'm writing my own application from the ground up that uses TSE technology - or maybe another way of putting it is TSE - torque demo app. All this because i'm creating a MMORPG with TSE :). I hope i have the right forum for this.

Anyway i'm currently examining the script language and compiler, and its very good and complex. My problem is how does the recource manager know where things are? On line 860 of consoleFunctions.cpp in the consoleFunction exec function, the line ResourceObject *rScr = ResourceManager->find(scriptFileName); looks for the script, but does not find the script. I know the line makes a call to ResManager::find which in my log file tells me the path is "./data" and the script is "prefs.cs". Does the ResManager get initalised by a cs script to tell it where things are? Or is it looking for a modname directory that i haven't set? There must be something i haven't set for the resource manger to not find the script.

My directory structure has a folder called Data in the same directory as main.cs and under Data are 2 scripts, one called defaults.cs and the other called prefs.cs.

I hope someone can advise me.

#1
08/25/2005 (1:34 pm)
I'm not sure about this, but I know that when you start a certain mod, there is a variable in the scripts that gets updated with that mod's path. If that variable gets fed back into the engine, then it can fill in the blank between that filename and the "./data" portion of the path. Might be a good place to look.
#2
08/25/2005 (11:17 pm)
You must set a mod path for the resource manager using setModPaths or it will not find anything.
#3
08/26/2005 (1:49 pm)
Aha yes, the setModPaths work :)

Also on my more recent examination of the torque demo app, i discovered setLogMode function which enables console.log and that is really useful.

Hey ho its working now many thanks :)
#4
08/29/2005 (4:41 pm)
Thanks Ben for pinting me in the right direction.

I have another question. When the main.cs script is read into the char *script buffer in initgame() does this process put hidden characters or something into the script? I'm doing another test and i'm using MemStream to read in this script from a char * buffer. I've logged the script read in by both methods and they look identical, but the sizes are different. The size when using filestream is 1168, and the total number of characters including the 0 that's set by the line script[size] = 0 in initgame() is 1119. The script is 48 lines long, and i can't figure out why compileExec will not call exec when i'm using the MemStream method.
#5
08/30/2005 (11:45 am)
Is one method eating newlines, perhaps?
#6
09/01/2005 (6:37 am)
I did some checking and the filesize of my main.cs is 1168 bytes and the getstreamsize() returns the size of the file unless the dirty flag is set. The getstreamsize() in memstream returns the size of the char * buffer used as input/output. It seems that the newlines are there in the script but exec isn't getting called. I checked to see if the statement list was empty after CMDparse() but its not empty so it must have found statements in the script.
#7
09/01/2005 (7:49 am)
@Gordon:

Quote:
I have another question. When the main.cs script is read into the char *script buffer in initgame() does this process put hidden characters or something into the script?

Kinda. Each new line in your file get's modified, to show the system that there is a line break there.
Quotation marks also get modified. Let's pick an example:

This codesnippit:
function HelloWorld()
{
echo("Hello World");
}

would look like this when it has been read by the engine:
function HelloWorld()\n{\necho(\"Hello World\");\n}\n

Simply,

Double quotation symbols = \"
Line breaks = \n

Not sure this is what you wanted, hopefully it was. :)

Edit: Typo.