The following picture shows the structure of the game logic part of the package:
Only the containment of objects in other objects is drawn. The GameLogic
object contains e.g. one Maze3D
, which contains 100 MazeCorridor3D
objects.
The most important class is GameLogic
. There is always one GameLogic
object that defines a complete Amazing Quest game. When a game is started, the
game server creates such an object and distributes it to all the users and
spectators of the game.
First of all, a GameLogic
object contains all the users in a game
(as GameUser
objects) in a GameUserList
. Users are the
people that are activily playing the game, they participate in it. Second, it contains
the spectators of a game (as GameSpectator
objects) in a GameSpectatorSet
.
Spectators are people that are just watching the game.
Each user has a Mission
to accomplish: the collection of a certain
amount of Treasure
objects. Every time a user collects a treasure, he
puts it in his Backpack
. The user that collects all the treasures
in his mission wins the game.
The game itself takes place in a 3 dimensional maze (the Maze3D
object).
This maze can be visualized as a grid, in which each cell is a MazeCorridor3D
object. These objects have a certain position (MazePosition3D
) and
2D orientation (Orientation2D
). Think of it as standard building blocks
(corners, crossings etc.) that can be placed in 4 different orientations (facing
north, east, south or west). These blocks together form the maze. Each of
these corridors can contain a treasure, which the users have to find.
Some parts of the game can be selected by users. These object implement the
Selectable
interface (not drawn) and contain a SelectionState
object.
The following picture shows the structure of the communication parts in this package:
GameMessage
objects. There are a lot of game messages, which are all subclasses of GameMessage
itself. For the protocol, see {@link quest.global.game.GameMessage}.
One of the game message is GameMessage.Gamemove
. These messages all
contain one game move. A game move is some basic action a user can do, such as
walking to a new location in the maze or picking up a treasure. All these action
are defined as subclasses of GameMove
. Playing the game now involves:
GameLogic
object it maintains for each running game.
GameMove
and puts it in his GameLogic
object.