Class MultiplayerGameRunner
-
Field Summary
-
Constructor Summary
ConstructorDescriptionOnce this runner is instantiated, the system property game.mode is set to "multi" -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an AI to the next game to run.void
Adds an AI to the next game to run, with the specified nickname.void
Adds an AI to the next game to run.void
Adds an AI to the next game to run.void
Adds an AI to the next game to run.void
Adds an AI to the next game to run.void
Adds an AI to the next game to run.void
Adds an AI to the next game to run, with the specified nickname.void
Adds an AI to the next game to run.protected void
buildInitCommand
(com.codingame.gameengine.runner.Command initCommand) void
setGameParameters
(Properties gameParameters) The game parameters are used to pass additional information to the Game Manager.void
setLeagueLevel
(int leagueLevel) Sets the league level to run.void
The seed is used to generated parameters such as width and height.
If a seed is present in the given input, the input value should override the generated values.
The seed will be sent to the GameManager.simulate()
Runs the game without a server and returns computed game resultsvoid
start()
Runs the game and attempts to start a server on the port 8888.void
start
(int port) Runs the game and attempts to start a server on the given port.
-
Field Details
-
log
protected static org.apache.commons.logging.Log log -
players
-
-
Constructor Details
-
MultiplayerGameRunner
public MultiplayerGameRunner()Once this runner is instantiated, the system property game.mode is set to "multi"
-
-
Method Details
-
setLeagueLevel
public void setLeagueLevel(int leagueLevel) Sets the league level to run. The first league is 1.The value can also be set by setting the environment variable
The value is program-wide, and will not be reset for subsequent instances ofleague.level
.MultiplayerGameRunner
.- Parameters:
leagueLevel
- the league level. 1 is the lowest level and default value.
-
setSeed
The seed is used to generated parameters such as width and height.
If a seed is present in the given input, the input value should override the generated values.
The seed will be sent to the GameManager.
Typically, the seed is used to generated other parameters such as width and height, then those parameters are placed back in the
Properties
.
If those parameters are present in the given input, the input values should override the generated values.- Parameters:
seed
- this game's seed returned by theGameManager
during execution
-
setGameParameters
The game parameters are used to pass additional information to the Game Manager.
- Parameters:
gameParameters
- the parameters to send
-
addAgent
Adds an AI to the next game to run. You must keep any standard output for the game inside the given class.- Parameters:
playerClass
- the Java class of an AI for your game.
-
addAgent
Adds an AI to the next game to run.The given command will be executed with
Runtime.getRuntime().exec()
.- Parameters:
commandLine
- the system command line to run the AI.
-
addAgent
Adds an AI to the next game to run.- Parameters:
playerClass
- the Java class of an AI for your game.nickname
- the player's nicknameavatarUrl
- the url of the player's avatar
-
addAgent
Adds an AI to the next game to run.The given command will be executed with
Runtime.getRuntime().exec()
.- Parameters:
commandLine
- the system command line to run the AI.nickname
- the player's nicknameavatarUrl
- the url of the player's avatar
-
addAgent
Adds an AI to the next game to run, with the specified nickname.- Parameters:
playerClass
- the Java class of an AI for your game.nickname
- the player's nickname
-
addAgent
Adds an AI to the next game to run, with the specified nickname.The given command will be executed with
Runtime.getRuntime().exec()
.- Parameters:
commandLine
- the system command line to run the AI.nickname
- the player's nickname
-
buildInitCommand
protected void buildInitCommand(com.codingame.gameengine.runner.Command initCommand) -
addAgent
Adds an AI to the next game to run.The given command array will be executed with
Example:Runtime.getRuntime().exec()
.new String[]{"bash", "-c", "echo command1 && echo command2"}
- Parameters:
commandArray
- the system command array to run the AI.nickname
- the player's nicknameavatarUrl
- the url of the player's avatar
-
addAgent
Adds an AI to the next game to run.The given command array will be executed with
Example:Runtime.getRuntime().exec()
.new String[]{"bash", "-c", "echo command1 && echo command2"}
- Parameters:
commandArray
- the system command array to run the AI.nickname
- the player's nickname
-
addAgent
Adds an AI to the next game to run.The given command array will be executed with
Example:Runtime.getRuntime().exec()
.new String[]{"bash", "-c", "echo command1 && echo command2"}
- Parameters:
commandArray
- the system command array to run the AI.
-
start
public void start()Runs the game and attempts to start a server on the port 8888.Open a webpage to the server to watch the game's replay.
-
start
public void start(int port) Runs the game and attempts to start a server on the given port.Open a webpage to the server to watch the game's replay.
- Parameters:
port
- the port on which to attempt to start the a server for the game's replay.
-
simulate
Runs the game without a server and returns computed game results- Returns:
- game result of the game
-