Game Development Community

Networked Torque Scripts

by Daniel Balmert · in Torque 3D Beginner · 12/02/2009 (2:16 pm) · 3 replies

This is probably a very basic question, but I can't find the answer in the forums or resources anywhere.

With the new T3D binary version, I've been considering the feasibility of making a small extremely simple game using only torque script. The only thing is, I kinda wanted it to be multiplayer (LAN only, nothing MMO CRAZY or anything.)

Here's the question: Can scripting provide permanent, networked variables to work with the already-implemented Client-Server architecture? I'm an artist, but I know a tiny bit of coding, so I'm trying to figure out some of the basics on my own.

It's my understanding that TorquScript creates transient variables that don't make it to the read/write stream and therefore are invisible to other clients or servers.

I know the engine already has a lot of server-client stuff built in, but do I need source access to add to it? I don't plan on making any crazy changes. I just want to add some simple methods and store some variables.

I don't even care about the integrity of the information, really. I don't plan on any commercial release and anyone who really wants to hack or modify the game will have my blessing. I just want to get it to work in a multiplayer setting.

If anyone has experience doing this kind of work (networking with only binary/scripting) please fill me in on this. I implemented a very simple melee system in script, but I'd like to clean it up and make it networked so other players can join in concurrently.

I'm pretty sure there's a Scripted melee resource, but I'm not sure if it's entirely script based or has minor engine mods.

Thanks for your time!

#1
12/02/2009 (3:32 pm)
For sending custom network commands and variables, have a look at the script functions commandToClient and commandToServer.
#2
12/02/2009 (3:39 pm)
I can define functions/objects on the server or client IN SCRIPT, and call them with script?

Do I just define the scripts in the "Server" or "Client" directories? Or is there a special place to put things that are called by commandToClient/Server?

#3
12/02/2009 (7:50 pm)
Yes all this can be done in script.

If you on the client do:
commandtoServer('SomeFunction',%Var);

then when that message is received on the server, the server will try to execute the script function ServerCmdSomeFunction

Which you can define like this:
function ServerCmdSomeFunction(%client,%var)