Skip to content

Commit d140ea8

Browse files
Jean PoreeJulien Poulton
authored andcommitted
Redirect doc to tech.io
1 parent 99737fc commit d140ea8

File tree

3 files changed

+5
-333
lines changed

3 files changed

+5
-333
lines changed

README.md

Lines changed: 3 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,11 @@
11
# About
22

3-
This is the Game Engine Toolkit of CodinGame. With it one can develop a game for the CodinGame platform.
3+
This is the Game Engine Toolkit of CodinGame. With it one can develop a game for the [CodinGame platform](https://www.codingame.com).
44

55
This engine is meant to be imported with maven from a project such as [the Game Engine skeleton](https://github.com/CodinGame/game-skeleton).
66

77
# Getting started
88

9-
Check the documentation on the [github repository](https://github.com/CodinGame/codingame-sdk-doc).
9+
Check the documentation on the [tech.io playground](https://tech.io/playgrounds/25775).
1010

11-
# Usage
12-
13-
## Using the Game Runner
14-
15-
See [Game Runner readme](runner/).
16-
17-
## Using the Game Manager
18-
19-
See [Game Manager readme](engine/core/).
20-
21-
## Using the Graphic Entity Module
22-
23-
See [Graphic Entity Module readme](engine/modules/entities/).
24-
25-
## Configuring your game
26-
27-
28-
### Code Stub
29-
30-
You may add to the config/ folder a text file named `stub.txt`. If the contents of this file is a syntaxically valid **CodinGame Stub Generator** input, the IDE will be prefilled with input/output code.
31-
32-
See [Stub Generator Syntax](stubGeneratorSyntax.md) for details.
33-
34-
35-
### Viewer configuration
36-
37-
You can change the default player colors to whatever you wish by adding an export to `config.js`:
38-
```javascript
39-
export const playerColors = [
40-
'#ff1d5c', // radical red
41-
'#22a1e4', // curious blue
42-
'#ff8f16', // west side orange
43-
'#6ac371', // mantis green
44-
'#9975e2', // medium purple
45-
'#3ac5ca', // scooter blue
46-
'#de6ddf', // lavender pink
47-
'#ff0000' // solid red
48-
];
49-
```
50-
The colors must respect the above format.
51-
52-
You can change the identifier of your game for the IDE's cache by adding an export to `config.js`:
53-
```javascript
54-
export const gameName = 'MyGame';
55-
```
56-
This doesn't have any effect on user experience yet.
57-
58-
59-
### Statement
60-
61-
Place a file named `statement_en.html` in the `config/` directory and it will be used for as the statement of your game.
62-
63-
For a game with multiple leagues, you may place a file named `statement_en.html.tpl` in the `config/` directory and it will be used as a basis for the statement of each league when you click the export button.
64-
65-
Within the `.tpl` file, you may place special comment blocks to indicate whether a block of html should be included for any specified league.
66-
67-
#### Example
68-
69-
This `statement_en.html.tpl`:
70-
```html
71-
<!-- LEAGUES level1 level2 level3 -->
72-
<div>
73-
<p> Always included </p>
74-
<!-- BEGIN level1 -->
75-
<p> Included in first league </p>
76-
<!-- END -->
77-
<!-- BEGIN level2 -->
78-
<p> Included in second league </p>
79-
<!-- END -->
80-
<!-- BEGIN level1 level2 -->
81-
<p> Included both first and second league </p>
82-
<!-- END -->
83-
</div>
84-
```
85-
86-
Will result in these three statements for a three-league game:
87-
88-
First league in `config/level1/statement_en.html`:
89-
```html
90-
<div>
91-
<p> Always included </p>
92-
<p> Included in first league </p>
93-
<p> Included both first and second league </p>
94-
</div>
95-
```
96-
97-
Second league in `config/level2/statement_en.html`:
98-
```html
99-
<div>
100-
<p> Always included </p>
101-
<p> Included in second league </p>
102-
<p> Included both first and second league </p>
103-
</div>
104-
```
105-
106-
Third league in `config/level3/statement_en.html`:
107-
```html
108-
<div>
109-
<p> Always included </p>
110-
</div>
111-
```
112-
113-
114-
## Welcome popup
115-
116-
Welcome popups can be used in **Multiplayer** games with multiple leagues. They will be displayed when a player is promoted to the next league.
117-
118-
Place a file named `welcome_en.html` in every `config/level<number>` directory you want the popup to be used in.
119-
120-
You can display images using `<img src="your_image.jpg"/>`. The image files must be located in the same directory.
11+
Check the [javadoc](https://codingame.github.io/codingame-sdk-doc/).

engine/modules/entities/README.md

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,3 @@
11
# About
22

3-
The Entity Module takes care of displaying and animating graphical entities in the replay of the game, each frame of the viewer corresponds to a game turn.
4-
5-
Use it by creating shapes, sprites, texts etc, then commiting their states to a certain moment of each frame.
6-
7-
By default, the states are commited automatically at the end of a frame.
8-
9-
# Usage
10-
11-
Include the dependency below in the pom.xml of your project.
12-
```xml
13-
<dependency>
14-
<groupId>com.codingame.gameengine</groupId>
15-
<artifactId>module-entities</artifactId>
16-
<version>2.3</version>
17-
</dependency>
18-
```
19-
Or a more recent version.
20-
21-
The EntityModule is an injectable Guice Singleton.
22-
23-
# Examples
24-
25-
## Creating a circle
26-
```java
27-
// Creates a green circle
28-
Circle circle = entityModule.createCircle()
29-
.setRadius(50)
30-
.setLineWidth(0)
31-
.setFillColor(0x00FF00);
32-
```
33-
## Moving a circle
34-
```java
35-
MyPlayer player = gameManager.getPlayer(turn % 2);
36-
circle
37-
.setX(player.getX())
38-
.setY(player.getY());
39-
```
40-
## Animating a circle
41-
```java
42-
//Starts invisible
43-
circle.setRadius(0);
44-
entityManager.commitEntityState(circle, 0);
45-
46-
//Grow to big size
47-
circle.setRadius(70);
48-
entityManager.commitEntityState(circle, 0.8);
49-
50-
//Shrinks to normal size
51-
circle.setRadius(50);
52-
entityManager.commitEntityState(circle, 1);
53-
```
54-
55-
## Creating a group of sprites
56-
```java
57-
Sprite planet1 = entityManager.createSprite()
58-
.setImage("planet")
59-
.setX(-20);
60-
Sprite planet2 = entityManager.createSprite()
61-
.setImage("planet")
62-
.setX(30);
63-
.setY(-10);
64-
Sprite planet3 = entityManager.createSprite()
65-
.setImage("planet")
66-
.setY(20);
67-
68-
// The planets are around the point (960,540).
69-
Group system = entityManager.createGroup(planet1, planet2, planet3)
70-
.setX(960)
71-
.setY(540);
72-
```
73-
74-
## Spinning a group of spinning sprites around a point
75-
```java
76-
planet1.setRotation(planet1.getRotation() - Math.PI / 4);
77-
planet2.setRotation(planet2.getRotation() + Math.PI);
78-
planet3.setRotation(planet3.getRotation() + Math.PI / 16);
79-
80-
system.setRotation(system.getRotation() + Math.PI / 2);
81-
82-
//Optional
83-
entityManager.commitWorldState(1);
84-
```
85-
86-
# Documentation
87-
88-
## Reference API
89-
TODO
3+
Check the [graphical entity engine](https://tech.io/playgrounds/25775/codingame-sdk-documentation/introduction-3).

runner/README.md

Lines changed: 1 addition & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,3 @@
11
# About
22

3-
The Game Runner lets you run your game locally during developement. It comes with a handy HTML package to watch each game's replay.
4-
5-
You can create your own AI for your game and use the Game Runner to connect it to your game's implementation.
6-
7-
You can also fiddle with your game's initialization input, such as the seed for random values (for **Multiplayer** games) or a test case file (for **Solo** games, the content of such files is detailed below).
8-
9-
# Usage
10-
11-
Include the dependency below in the pom.xml of your project.
12-
```xml
13-
<dependency>
14-
<groupId>com.codingame.gameengine</groupId>
15-
<artifactId>runner</artifactId>
16-
<version>2.3</version>
17-
</dependency>
18-
```
19-
Or a more recent version.
20-
21-
Instantiate a `MultiplayerGameRunner` or a `SoloGameRunner` to launch a game with the `start()` method. This will create a temporary directory and start a server to serve the files of that directory. You need not stop the previous server to launch a new game.
22-
23-
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.
24-
25-
Warning ⚠ To use the game viewer locally, your browser must support ES6 JavaScript **modules**. For Chrome, that's version 61 or more. For Firefox, from version 54 this feature is behind the `dom.moduleScripts.enabled` preference. To change preferences in Firefox, visit `about:config`.
26-
27-
28-
# Examples
29-
30-
In order to run a game, you must have prepared a `Referee` and a `Player`. The game will surely fail to finish if they are not properly implemented. See [Game Manager](../engine/core/) for details.
31-
32-
## Running a **Multiplayer** game
33-
34-
### Using the same java class for each player:
35-
```java
36-
MultiplayerGameRunner gameRunner = new MultiplayerGameRunner();
37-
gameRunner.addAgent(Player.class);
38-
gameRunner.addAgent(Player.class);
39-
gameRunner.start();
40-
41-
```
42-
_This method will prevent the agent from printing to stdout from any other class than Player. It has been deprecated for this reason._
43-
44-
### Using external python programs as players:
45-
```java
46-
MultiplayerGameRunner gameRunner = new MultiplayerGameRunner();
47-
48-
gameRunner.addAgent("python3 /home/user/player1.py");
49-
gameRunner.addAgent("python3 /home/user/player2.py");
50-
gameRunner.addAgent("python3 /home/user/player3.py");
51-
52-
gameRunner.start();
53-
```
54-
55-
### Using a custom seed:
56-
```java
57-
// I want to debug the strange case of this particuliar seed: 53295539
58-
59-
Properties refereeInput = new Properties();
60-
refereeInput.put("seed", "53295539");
61-
62-
MultiplayerGameRunner gameRunner = new MultiplayerGameRunner();
63-
gameRunner.setGameParameters(refereeInput);
64-
gameRunner.addAgent(Player1.class);
65-
gameRunner.addAgent(Player2.class);
66-
gameRunner.start();
67-
```
68-
69-
## Running a **Solo** game
70-
71-
### Using a java class and a test case with its filename:
72-
```java
73-
SoloGameRunner gameRunner = new SoloGameRunner();
74-
gameRunner.setTestCase("test1.json"); // You must set a test case to run your game.
75-
gameRunner.setAgent(Player.class);
76-
gameRunner.start();
77-
```
78-
79-
---
80-
### Test case file
81-
82-
You will need to create test case files to run your **Solo** game. If you are creating a **Multiplayer** game, you can skip this section.
83-
84-
Your test cases must be named `test<number>.json` and placed in the `config` directory. Their `<number>` determine the order they will be listed in the CodinGame IDE. Here is an example:
85-
86-
`test1.json`
87-
```json
88-
{
89-
"title": {
90-
"2": "One path",
91-
"1": "Un seul chemin"
92-
},
93-
"testIn": ".o...\\n.ooo.\\n...o.",
94-
"isTest": "true",
95-
"isValidator": "false"
96-
}
97-
```
98-
- **title:**
99-
- **2:** English title, this parameter is mandatory.
100-
- **1:** French title, optional.
101-
- **testIn:** The content of your test case. It can contain multiple lines separated with `\\n`.
102-
- **isTest:** If true, this test will be visible and used as a regular test case.
103-
- **isValidator:** If true, this test will be use to validate the player's code. You can use this to avoid hardcoded solutions.
104-
105-
### Activating game logs
106-
107-
You can view the data that the Referee and the Players send each other by editing the built-in logger's settings.
108-
To do this, open `log4j2.properties` in the root of your project and replace ```rootLogger.level = warn``` with ```rootLogger.level = info```.
109-
Additionally, if you would like to see the output of the different modules, you can use:
110-
`rootLogger.level = trace`.
111-
112-
113-
## Viewing a replay
114-
115-
Once a game is run, files are copied into a temporary folder. A server is started to serve those files on `localhost:8888`.
116-
117-
The test page `/test.html` let's you watch the replay as it would appear on CodinGame.
118-
119-
Many of the viewers game-specific parameters may be changed by the default `config.js` file located in `src/main/resources/view` of your game's project. These parameters include:
120-
* The list of modules needed by the game.
121-
* The colours for the different players (affects the IDE).
122-
123-
### Loading assets
124-
Assets are expected to be placed in the `src/main/resources/view/assets` folder of your game's project.
125-
126-
You can then use the images in the texture cache with the [Graphic Entity Module](../modules/entities/):
127-
```java
128-
entityManager.createSprite.setImage("background.png");
129-
```
130-
131-
The game's replay is run using an engine based on [Pixi.js](http://www.pixijs.com/).
132-
133-
# Documentation
134-
135-
## Reference API
136-
TODO
3+
Check the [game runner documentation](https://tech.io/playgrounds/25775/codingame-sdk-documentation/game-runner).

0 commit comments

Comments
 (0)