Passing arbitrary parameters from the client to the server
Sometimes, a game client needs to pass along information to the server when it connects. This information could be the player's name, or what the player looks like.
In this recipe, we will learn how to send any data we require from the client to the server when the client first connects.
Getting ready
We will be making TorqueScript changes in a project based on the Torque 3D's Full
template, using the Empty Terrain
level. If you haven't already, use the Torque Project Manager (Project Manager.exe
) to create a new project from the Full
template; it can be found under the My Projects
directory. After that, start your favorite script editor, such as Torsion, and let's get going!
How to do it...
In the following steps, we will pass some game-specific parameters from the client to the server when the client first connects:
Open the
scripts/client/game.cs
file in your text editor, add the following code to the top of the file, and save it:...