Global Positioning System Reference
In-Depth Information
This way, the server implementation is hidden and unreachable for external
clients by the application implementation. Although an overriding method
has to use the same method signature, the returned object is only required
to be a ServerObject , like any extension of it.
This covariant return type is a trick which makes use of software reusabil-
ity. Note that even the pre-implemented identification method of the
ROServer invokes the overriding method of the application without a code
change
The ServerPlayer is constructed in RealObjectsServer.identify by in-
voking LondonChase.createServerObject .
At this point the client player is identified, has a corresponding server
player, and the application can finally hand over a GameSet . This \bag
of things" can include things (objects), like tickets and barriers, to be
used in the game scenario. For a minimum implementation of LC, the
players should stick to a given network, the game board, or programmat-
ically a GameMap (see Section 9.4). The actual network is stored in the file
LDN.net.osm on the server side. The server creates one GameMap for all play-
ers and is free to validate the players' motion against this map. Note that
the server consumes time to create this PSF just like the data transfer,
which can become problematic for full coverage maps.
The game set is created individually for every client and has to be final
and Serializable to be transferred:
// prepare gameSet: load GameMap, role specific stuff,
//
initial station, etc.
final GameSet gameSet = new GameSet();
gameSet.gameMap = navMap;
After this identification process, the client can be validated with game
parameters, like a valid game role, and is then equipped with a map. The
client is free to simply set a valid node as its current position to enter the
game. Or, if it is already moving in another scenario (or stand-alone on
the local computer), it has to navigate and steer to a valid node to allow
continuous motion throughout the virtual world.
Server callback: init(GameSetgameSet) . The implementation of the
LC.identify can be concluded. The client has been identified, has a server
record, and is ready to receive a GameSet from the server. Note that
player.init(gameSet) is using the remote concept. This time a return
value, time, or exceptions are not of interest. So the method is simply sub-
mitted with remoteCall.submit() . In order to let the identification finish
before initializing the client, the remote method is deferred by a second.
public ServerInfo identify( RemoteObject client )
{
...
 
Search WWH ::




Custom Search