Presentation is loading. Please wait.

Presentation is loading. Please wait.

3D Game Programming All in One By Kenneth C. Finney.

Similar presentations


Presentation on theme: "3D Game Programming All in One By Kenneth C. Finney."— Presentation transcript:

1 3D Game Programming All in One By Kenneth C. Finney

2 Chapter 6 Network

3 Network NetworkConnection object handles network GameConnection object links the client to the server (on the server) GameConnection object links the server to the client (on the client)

4 Network Direct Messaging –CommandToServer sends messages from client to the server –There must be a message handler on the server that expects the message –Client needs to know what the server expects (format) –Handler looks like this: function ServerCmdHandlerName ()

5 Network Direct Messaging –CommandToClient sends messages from server to the client –There must be a message handler on the client that expects the message –Server needs to know what the client expects (format) –Handler looks like this: function ClientCmdHandlerName ()

6 Network Direct Messaging –Use for ad hoc messages –Scoring –Synchronization –Setup options –Map cycling –Anything else you can dream up

7 Network Triggers –Area triggers –Animation triggers –Weapon state triggers –Player event control triggers

8 Network Player Event Control Triggers –AKA “player move event trigger” –Indirect messaging mechanism –Increment/decrement a count on client –Client will notify server in the background –Uses a first-in, first-out (fifo) queue –Maximum 255 events

9 Network GameConnection Messages –Negotiate client – server connection process –Use handlers you can override –Time-outs and error messages are built in

10 Network Lab: Finding Servers with emaga6 –Exercise the LAN query mode –Explore master server concept –Upgrade Emaga5 to Emaga6 to support network play –Run a game over a network connection –Use $Client::GameTypeQuery and $Client::MissionTypeQuery as filter variables

11 Network control/client/interfaces/serverscreen –GUI module –Defines buttons, text labels, and scroll controls –The screen is used to display servers to be selected by the player

12 Network control/client/misc/serverscreen –Control script for serverscreen GUI –Define behavior of GUI controls –Show how to initiate a client's connection to a server –Show how to query a server for information

13 Network Dedicated Server Make changes to: –root main module –control/main.cs module –control/initialize.cs module

14 Network Testing emaga6 –Run dedicated server –Then run client –In the client look for the server and join it –Use emaga6 to also test direct messaging

15 Summary Use direct messaging for ad hoc messages: CommandToServer() and CommandToClient() and their handler counterparts: ServerCmd...() and ClientCmd...() Player Event Control Triggers (PECTs) are used to trigger movement or other action events PECTs use a FIFO (first-in, first-out) queue for posted event—they operate like a "fire- and-forget" system

16 Summary There are six PECT queues: $mvTriggerCount0 to $mvTriggerCount5— each can hold 255 events GameConnection messages handle server- client synchronization and game update issues Torque has built-in capabilities for locating master servers from which to find a list of available game servers Torque's networking works equally well on LANs and the Internet


Download ppt "3D Game Programming All in One By Kenneth C. Finney."

Similar presentations


Ads by Google