[game PIC] Chapter 31.   A Networked Two-Person Game


This chapter describes a networked two-person 3D game. The initial implementation lacks networking components, so we can concentrate on issues such as game logic, 3D modeling, and user interface design. In the second stage, networking elements are added, with fairly minimal changes to the basic game.

FourByFour is a 3D version of tic-tac-toe, as shown in image above. Player 1's markers are red spheres, player 2 has blue cubes. The aim is to create a line of four markers, all of the same type, along the x-, y-, or z- axes, or the diagonals across the XY, XZ, or YZ planes, or from corner-to-corner.

The non-networked FourByFour game described in this chapter is a simplified version of a game available in the Java 3D distribution.

The main programming features of FourByFour are:


[net game PIC] The networked version of FourByFour, called NetFourByFour, is an instance of a threaded client and server, similar in style to the threaded Chat application of Chapter 30. However, there are additional requirements for a networked two-person game, including the need to order the players' turns, and to control the number of players involved.

The main contribution of NetFourByFour is to illustrate strategies for designing and implementing networked two-person games:

The NetFourByFour GUI also extends the Canvas3D class to place overlays on-screen.




Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page