Game Development Community

How are .dso objects loaded?

by Nic Biondi · in Torque Game Builder · 12/03/2008 (1:36 pm) · 10 replies

Hello! I want to send a dso object from server to client and load it up on the client. The reason I want to do that is that the dso objects are serialized while the .cs ones are not. This would make my weany script transfer like... 20,000 times faster, roughly.

So now that you have my problem, here is my question:
If you transfer a dso object over line, by line, and save it as a .dso object in script... how do you get TGB, to read that dso object? Is there some way I need to force that to happen? Does that only happen in the loading of a tgb level?

please help!
cheers!
-nic

#1
12/03/2008 (1:47 pm)
The dso are actually binary bytecode. I don't know where the pipeline is that reads it in, nor do I know their architecture. I'm sure there's a chance that they are similar to DLL's and are more like black boxes, so reading them in may not be possible.

I don't hack around the engine that much to know for sure, so someone else may have a better answer.

You also might find something useful in the auto update research here:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10800

It's for TGE, but many of the core engine components are fairly close to TGB's.
#2
12/03/2008 (9:25 pm)
Yeah I looked at the autoupdater.. and I think I might have to use something like that eventually. However.. right now I need something quicker.. to serialize some of that nasty text data so I can send it quicker. I don't want to suck all the joy out of my game making by spending all my time on the details right now.

1) So no one knows of an easy way to serialize, or otherwise shrink data before sending it?
#3
12/03/2008 (10:44 pm)
Nic, why not just include the text data with the client in the first place ?
in general, sending large quantities of data, especially static data, over the network is better to just avoid.

fwiw, i believe TGB networking does run text through a layer of Huffman encoding, which does a good job of compression, but really it's meant for small bits of text, not pages and pages.

if you really want to have the client download a bunch of data,
you might look at using the HTTPObject, or integrating LibCurl.

however, i can answer your question.
if you really want to create a new .dso file on the client and execute it,
you would write the data out to a file and name it "foo.cs.dso", and then exec("foo.cs").
the engine will first look for the .dso file, and since it found it, and there's not a more recent "foo.cs" as a sibling (in fact there's no foo.cs as a sibling) it will exec it.
but i highly encourage you to look for another way to achieve what you want.
#4
12/03/2008 (10:53 pm)
Thanks Orion. I specifically chose an online game-model that allows me to download all the competitors "Best time" data to get around alot of the shortfallings of TGB networking out of the box.

It turns out that sending 20,000 messages and rebuilding the object.. while works fantastic.. takes 3 minutes or so. Since I don't need any crazy robust realtime networking.. I just want a way to send a sizable simobject over the network. It's been a while since I ate into the c++ code.. back in my TGE days.. so I'm avoiding anything I can't easily plug in, or do in script.

I agree Orion, that it's not the best way to do it. I would much prefer to somehow "serialize" my object into something smaller and then send it in chunks. I think I only get like 4096 bytes or something in a string right? Any ideas on how I could pack my data into something that server/clientcmd could pass around like a string object?

I am afraid if I start chomping into the HttpObject.. I will never emerge! lol.

-nic
#5
12/03/2008 (11:17 pm)
Here's what i would do if i were in the sitch i think you are in -
i've got a fair amount of text data in the form of high scores and stuff on the server
and i want each client to get an up-to-date version of it.

i would install apache or some other tiny HTTP server,
and set it up so that a particular "page" really just serves a text file which has one high-score entry per line.
this file is written occasionally by the Torque server.

then the clients use the HTTPObject to fetch the file.


so, the whole process would look like:
on the torque server:
* the torque server starts up.
* the torque server reads and parses scores.txt.
* when a new score occurs, the score list is updated and re-exported to scores.txt

meanwhile, apache (or some more lightweight HTTP server) is running,
and when it gets a request for "http:///foo/bar/scores.txt,
it simply serves up that same scores.txt file.

meanwhile, you've got a bunch of torque clients who occasionally want to get an updated high-scores list. they use the HTTPObject to request "http:///foo/bar/scores.txt", and parse it line-by-line.


this may seem like overkill,
but if you've really got 20,000 messages or even a fraction of that to send,
i think you're going to be pretty unhappy with the CommandToClient approach.
#6
12/07/2008 (7:10 pm)
Hello. How do I get torque script to compile a .cs file into a .dto file. My assumption is that it happens when you "build your code" but not with other .cs files durring a save? Is there a way to have the script it's self compile a cs into .dso or is this something the builder only does?

cheers!
-nic
#7
12/07/2008 (7:30 pm)
Sure:

compile(%myFile);
#8
12/07/2008 (7:48 pm)
Ok thanks I'll just use this one insead

if(philipOshea>=Genius)
  if(philipOshea>getSpeed(Bullet))
    echo("thanks for the quick reply!");
}

result: thanks for the quick reply!
#9
12/07/2008 (7:50 pm)
Haha, I do my best!
#10
12/07/2008 (11:28 pm)
PS, thanks orion for your thoughtful reply. I forgot to give you props for that solution.
To clarify, I have 20,000 lines of text to transfer, not simultaneous messages. Sorry for the confusion. I'm trying the crazy hack of serializing my object, then compiling it (to further serialize/compress the data), then transferring it line by line across the network. I will then save, and execute that data as a dto on the target server. Hack, absolutely!! will it work for my purposes.. well see! (:D)