Sending a network event from the server to the client
Over the course of a networked game, it is often necessary to send an event from the server to the client. This event may also contain data for the client to process. In this recipe, we will learn how to send a network event from the server to the client, and how to have the client process this custom event.
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 will be found under the My Projects
directory. After that, start up your favorite script editor, such as Torsion, and let's get going!
How to do it...
In the following steps, we will send a command from the server to all the connected clients that will pop up a message dialog and display our custom message:
Open the
scripts/server/game.cs
file in your text editor, add the following...