Skip to content

Commit 6d5e0cd

Browse files
author
Julien
committed
fix(sdk): add the setter for league level
1 parent e974c42 commit 6d5e0cd

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

playground/core-concepts/core-2-game-runner.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ In addition, you will need to set **Agents** to the Game Runner. They are progra
2626

2727
By default, you can access the game viewer for testing at [http://localhost:8888/test.html](http://localhost:8888/test.html). You may change the configuration of the game viewer by editing the `config.js` file. See the [Viewer configuration](core-4-configuration.md#viewer-configuration) for more details.
2828

29-
Warning ⚠ To use the game viewer locally, your browser must support ES6 JavaScript **modules**. For Chrome, that's version 61 or above. For Firefox, from version 54 this feature is behind the `dom.moduleScripts.enabled` preference. To change preferences in Firefox, visit `about:config`.
29+
**Warning** ⚠ To use the game viewer locally, your browser must support ES6 JavaScript **modules**. For Chrome, that's version 61 or above. For Firefox, from version 54 this feature is behind the `dom.moduleScripts.enabled` preference. To change preferences in Firefox, visit `about:config`.
30+
31+
The `MultiplayerGameRunner` also provides a `setLeagueLevel` method which you can use to test each league of your game. If left unspecified, the first level of the game will be run.
3032

3133

3234
# Examples

playground/getting-started/tutorial-2-multiplayer.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ Here's the file hierarchy for the project Tic-tac-toe:
2727
```
2828
.
2929
├── config
30-
│ ├── Boss.java
31-
│ ├── config.ini
32-
│ └── statement_en.html
30+
│   ├── Boss.java
31+
│   ├── config.ini
32+
│   ├── level1
33+
│   │   └── statement_en.html
34+
│   ├── level2
35+
│   │   └── statement_en.html
36+
│   └── stub.txt
3337
├── pom.xml
3438
├── README.md
3539
├── src

playground/misc/misc-3-release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
77
### 🐞 Bug fix
88

99
- `Circle` entities now displayed again
10+
- Included missing `setLeagueLevel` method in the `GameRunner`
1011

1112
## 3.4.1
1213

runner/src/main/java/com/codingame/gameengine/runner/MultiplayerGameRunner.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ public MultiplayerGameRunner() {
1818
System.setProperty("game.mode", "multi");
1919
}
2020

21+
/**
22+
* Sets the league level to run. The first league is 1.
23+
* <p>The value can also be set by setting the environment variable <code>league.level</code>.</p>
24+
* @param leagueLevel the league level. 1 is the lowest level and default value.
25+
*/
26+
27+
public void setLeagueLevel(int leagueLevel) {
28+
if (leagueLevel < 1 || leagueLevel >= 20) {
29+
throw new IllegalArgumentException("League level must be higher than 0 and lesser than 20");
30+
}
31+
System.setProperty("league.level", String.valueOf(leagueLevel));
32+
}
33+
2134
/**
2235
* <p>
2336
* The seed is used to generated parameters such as width and height.<br>

0 commit comments

Comments
 (0)