Skip to content

Commit 82b5b93

Browse files
Merge branch 'doc-sdk-commit-world' into 'master'
[SDK]doc(sdk): update javadoc for commitWorldState See merge request codingame/game-engine!243
2 parents a98331a + b74c3e8 commit 82b5b93

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

engine/core/src/main/java/com/codingame/gameengine/core/RefereeMain.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class RefereeMain {
1919
private static boolean inProduction = false;
2020

2121
/**
22-
* Is overriden by CodinGame's server side game runner
22+
* Is overridden by CodinGame's server side game runner
2323
* @return whether or not this execution is happening locally or on CodinGame
2424
*/
2525
public static boolean isInProduction() {
@@ -30,10 +30,8 @@ public static boolean isInProduction() {
3030
* CodinGame's game runner will launch the referee using this method.
3131
*
3232
* @param args unused
33-
* @throws InstantiationException
34-
* @throws IllegalAccessException
3533
*/
36-
public static void main(String[] args) throws InstantiationException, IllegalAccessException {
34+
public static void main(String[] args) {
3735
inProduction = true;
3836
InputStream in = System.in;
3937
PrintStream out = System.out;

engine/modules/entities/src/main/java/com/codingame/gameengine/module/entities/GraphicEntityModule.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
* <p>
2121
* The GraphicEntityModule takes care of displaying and animating graphical entities on the replay of the game.
2222
* </p>
23-
* Use it by creating shapes, sprites, texts etc, then commiting their states to a certain moment of the frame. By default, the states are commited
23+
* Use it by creating shapes, sprites, texts etc, then committing their states to a certain moment of the frame. By default, the states are commited
2424
* automatically at the end of the frame.
2525
*/
2626
@Singleton
2727
public class GraphicEntityModule implements Module {
2828

29-
//TODO: extra properties for Texts (text wrapping, alignement, ...)
29+
//TODO: extra properties for Texts (text wrapping, alignment, ...)
3030

3131
static int ENTITY_COUNT = 0;
3232

@@ -103,8 +103,16 @@ public SpriteSheetSplitter createSpriteSheetSplitter() {
103103
}
104104

105105
/**
106-
* Every entity's graphical counterpart, at instant t of the frame being computed, will have the same properties as the java object as they are
107-
* now.
106+
* <p>
107+
* Creates a commit for each entity that has had some of its properties modified since a previous commit or the previous frame.
108+
* </p>
109+
* <p>
110+
* This means that each one of those entities' graphical counterparts, at instant t of the frame being computed, will have the same properties as
111+
* the java object as they are now.
112+
* </p>
113+
* <p>
114+
* To force an entity to keep its current state instead of interpolating to the values of next frame, use <code>commitEntityState</code> instead.
115+
* </p>
108116
* <p>
109117
* Only the most recent commits are kept for a given t.
110118
* </p>
@@ -188,13 +196,9 @@ private void sendFrameData() {
188196
.map(Entry::getValue)
189197
.collect(Collectors.toList());
190198

191-
List<String> worldCommitsBuilder = new ArrayList<>();
192199
List<WorldState> updateBuilder = new ArrayList<>();
193200

194201
for (WorldState nextWorldState : orderedStates) {
195-
if (nextWorldState.isWorldCommit()) {
196-
worldCommitsBuilder.add(nextWorldState.getFrameTime());
197-
}
198202
WorldState worldStateDiff = nextWorldState.diffFromOtherWorldState(currentWorldState);
199203
updateBuilder.add(worldStateDiff);
200204
currentWorldState.updateAllEntities(nextWorldState);

engine/modules/entities/src/main/java/com/codingame/gameengine/module/entities/SpriteSheetSplitter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.google.inject.Inject;
66

77
/**
8-
* Utility to load an image containg serveral subimages displayed in sequential rectangles.
8+
* Utility to load an image containing several subimages displayed in sequential rectangles.
99
* <p>
1010
* Will extract each separate image and return generated names that can be used to create a <code>Sprite</code> or <code>SpriteAnimation</code>
1111
* </p>

0 commit comments

Comments
 (0)