Game Development Community

V12/T2 events/messaging question

by Jim Rowley · in Torque Game Engine · 04/10/2001 (12:12 am) · 8 replies

I'm wondering if someone would write a very brief overview of the messaging for T2? The functions look different from the messaging in T1 so I'm a little confused. I'm wondering how the command to server, command to client, and callback functions work? I'm also clueless about the packages and datablocks... Any clues?

#1
04/10/2001 (12:50 am)
Well before any of you guys answer with a smartass comment... Yes, I've already read the more detailed networking model overview that Tim posted on the site:

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=331

That document was very helpful, but I'm still wondering if anybody who has written any server mods and client scripts might give us a much shorter summary of how it works. Sort of a V12 messaging for dummies ... =)
#2
04/10/2001 (9:43 am)
I'll start with the datablocks (I'll have to post later on the other stuff...) The easiest way to think of datablocks is as objects derived from C++ base classes. Datablocks contain data used to initialize their base class, and can also declare their own instance data and methods. Datablock script methods can override C++ declared methods. By providing unique instance data and by adding or overriding the default methods, a scripted datablock can customize the behavior of it's C++ class.

Every C++ game simulation object has it's equivalent datablock type. The C++ object basically provides some type of functionality (such as "wheeled vehicle"), and exposes any parameters as datablock fields and any events as calls to datablock scripts methods. When a C++ object is constructed in the scripting language (using "new"), it's datablock must be specified.

Datablocks are also transmitted to every client so that they know how to initialize and predict objects declared on a server (the networking article talks a little about this part).

Hope that makes sense :)
#3
04/10/2001 (9:50 am)
Thanks Tim! I'm looking forward to hearing more ;-)
#4
04/12/2001 (11:41 am)
Hey Tim :-)

I've been talking to some guys on tribalwar.com forums about packages. It seems to me that packages are the way to overload base class methods not datablocks, is this correct?

Also, Cowboy is going to email Dynamix about it, but we seem to have found a limit to the amount of nested packages allowed ... it stops at twenty nests. I'm not exactly sure why they want that bar raised, but the primary purpose of people nesting packages has been to allow scripts to work with other scripts with no knowlege of eachother.

Any comments?
#5
04/12/2001 (1:50 pm)
It wasn't just nested packages. There was a limit of 20 on the number of total packages that could be active at any one time.

Mark Frohnmayer has responded and they are going to raise the limit to 256 in the next patch. They never expected us to use the packages on the client side.

~LabRat
#6
04/12/2001 (2:13 pm)
Maybe i have this wrong but does that mean we can only use 256 script files or a file with a bunch of scripts in them?
#7
04/12/2001 (2:43 pm)
This is my understanding:

No, it actually doesn't mean much of a restriction at all. It just means that if you are using scripts that use packages to overload functions dynamically (which doesn't have to be done at all if you don't want to), then you are limited to loading (read: not even activating...) 20 of those packages during game execution. This is not a problem when scripting your own game. It has become an issue with scripters who want their scripts (read: client-side mods) to be compatible with other author's scripts without knowlege of what might be written in those scripts. What people are trying to do is have the possibility through client-side packages to overload the same function multiple times in order to maintain operability of prior scripts that overload the same function. As long as your script calls the parent function as well as execute your own code, then your script for that function should be compatible with another script that has overloaded the same function. I hope that makes sense...
#8
04/12/2001 (7:17 pm)
Actually you could have as many packages defined as you wanted. Only 20 could be active at any one time.