Skip to Main Content
Killer Game Programming in Java
book

Killer Game Programming in Java

by Andrew Davison
May 2005
Intermediate to advanced content levelIntermediate to advanced
998 pages
26h
English
O'Reilly Media, Inc.
Content preview from Killer Game Programming in Java

An Overview of NetTour3D

Figure 32-2 shows the main objects involved in a NetTour3D world.

The application uses a threaded client/server model, much like the threaded chat application in Chapter 30.

The NetTour3D application is the client. It creates a WrapNetTour3D object to build the world and to handle communication with the TourServer server. The world consists of a checkerboard, background, lighting, and scenery loaded from a tour file with the help of a PropManager object (first used in Chapter 16). No 3D objects or images need to be transferred over the network; all the necessary 3D models are present on the client.

Objects in a NetTour3D world

Figure 32-2. Objects in a NetTour3D world

WrapNetTour3D starts a TouristControls object to monitor the client's key presses, which move the client's local sprite (the ones colored blue in Figure 32-1) or adjust the third-person camera. TouristControls is unchanged from the Tour3D example in Chapter 18.WrapNetTour3D sends messages to the server, and the monitoring of messages coming from the server is delegated to a TourWatcher object. Most of these messages will be related to the creation and movement of distributed sprites (the sprites representing other clients, colored orange in Figure 32-1). TourWatcher manages these sprites and updates them in response to the server's messages.

TourServer creates a TourServerHandler thread for each client who connects to it ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Game Development with LibGDX: From Beginner to Professional

Java Game Development with LibGDX: From Beginner to Professional

Lee Stemkoski

Publisher Resources

ISBN: 0596007302Supplemental ContentErrata Page