net.sourceforge.simplegamenet.specs.model
Class GameFactory

java.lang.Object
  extended bynet.sourceforge.simplegamenet.specs.model.GameFactory
All Implemented Interfaces:
Comparable

public abstract class GameFactory
extends Object
implements Comparable

An abstract superclass which represents the game. All the game module classes originate directly or indirectly from the subclass of this game interface. The subclass of this game interface should be set as the main class of the game package for the SimpleGameNet framework to find.

Version:
1.0, 2003-06-18
Author:
Geoffrey De Smet
See Also:
GameServer, GamePlayerClient, GameSettings

Constructor Summary
protected GameFactory(String name, Version version, String description, String author)
          Creates a new game interface and sets required information about the game.
 
Method Summary
 int compareTo(Object o)
          Compares two game interfaces lexicographically, primarily on name and secondarily on author.
 GameSettings createDefaultGameSettings()
          Creates new game settings with default values.
abstract  GamePlayerClient createGamePlayerClient(ClientEngine clientEngine)
          Creates a new game player client.
abstract  GameServer createGameServer(ServerEngine serverEngine)
          Creates a new game server.
 boolean equals(Object o)
          Compares this game interface to the specified object.
 String getAuthor()
          Gets the author of the game.
 String getDescription()
          Gets the description of the game.
 Version getMinimumSimpleGameNetVersion()
          Returns the oldest version the SimpleGameNet framework can have to be able to run this game.
 String getName()
          Gets the name of the game.
 Version getVersion()
          Gets the version of the game.
 boolean isBotProvided()
          Returns true if the game includes a bot.
 String toString()
          Returns the name appended with the version string of the game.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameFactory

protected GameFactory(String name,
                      Version version,
                      String description,
                      String author)
Creates a new game interface and sets required information about the game. Every subclass should call this constructor with super.

The arguments are shown in the connection wizard and the "Status" tab.

Parameters:
name - The name of the game. This name can contain spaces but should resemble the jar file and package name.
version - The version of the game, which is used to assert that a server and its clients run the same game version.
description - the description of the game
author - the name of the author or group of authors who wrote the game
Method Detail

createGameServer

public abstract GameServer createGameServer(ServerEngine serverEngine)
Creates a new game server.

Parameters:
serverEngine - the server engine to construct a new game server with
Returns:
a new game server

createGamePlayerClient

public abstract GamePlayerClient createGamePlayerClient(ClientEngine clientEngine)
Creates a new game player client.

Parameters:
clientEngine - the client engine to construct a new game player client with
Returns:
a new game player client

createDefaultGameSettings

public GameSettings createDefaultGameSettings()
Creates new game settings with default values. The SimpleGameNet framework uses these game settings to create the first game settings panel.

Returns:
new game settings

isBotProvided

public boolean isBotProvided()
Returns true if the game includes a bot. Currently bots are not yet supported by the SimpleGameNet framework. This method will be used in future versions of the SimpleGameNet framework.

Returns:
true if the game includes a bot

getName

public String getName()
Gets the name of the game.

Returns:
the name of the game

toString

public String toString()
Returns the name appended with the version string of the game.

Returns:
the name appended with the version string of the game

getVersion

public Version getVersion()
Gets the version of the game.

Returns:
the version of the game

getDescription

public String getDescription()
Gets the description of the game.

Returns:
the description of the game

getAuthor

public String getAuthor()
Gets the author of the game.

Returns:
the author of the game

getMinimumSimpleGameNetVersion

public Version getMinimumSimpleGameNetVersion()
Returns the oldest version the SimpleGameNet framework can have to be able to run this game. If the game module requires functionality which is only provided by a newer SimpleGameNet framework, this method can prevent older SimpleGameNet frameworks not to run this game.

If a subclass does not overwrite this method it always returns the oldest version of the SimpleGameNet framework.

Returns:
the oldest version the SimpleGameNet framework can have to be able to run this game

equals

public boolean equals(Object o)
Compares this game interface to the specified object. The result is true if both game interfaces have the same name and author.

Parameters:
o - the o to compare this game interface against
Returns:
true if the game interfaces have the same name and author

compareTo

public int compareTo(Object o)
Compares two game interfaces lexicographically, primarily on name and secondarily on author.

Specified by:
compareTo in interface Comparable
Parameters:
o - the object to compare this game interface against
Returns:
the value 0 if the argument game interfaces name with author is equal to those of this game interface, a value less than 0 if this game interfaces name with author is lexicographically less than those of the argument and a value greater than 0 if this game interfaces name with author is lexicographically greater than those of the argument.


Copyright © 2003-2004 The 3 Belgians. All Rights Reserved.