aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-02-04 23:57:21 +0100
committerpacien2018-02-04 23:57:21 +0100
commit3bc1c40642c773a899a7651c407b9ff3246c543d (patch)
tree38dff02f3d67320019aeb83071efa4a83f80dff7
parent8554edc96eb2da6510fa4159873b940f1202fae3 (diff)
downloadwallj-master.tar.gz
Merge branch 'master' of https://github.com/pacien/upem-java-walljHEADmaster
Signed-off-by: pacien <pacien.trangirard@pacien.net> # Conflicts: # src/main/java/fr/umlv/java/wallj/viewer/ScreenManager.java
-rw-r--r--src/docs/class.puml2
-rw-r--r--src/docs/dev.md73
-rw-r--r--src/docs/user.md13
3 files changed, 49 insertions, 39 deletions
diff --git a/src/docs/class.puml b/src/docs/class.puml
index 6b76380..eceb954 100644
--- a/src/docs/class.puml
+++ b/src/docs/class.puml
@@ -1,8 +1,6 @@
1@startuml 1@startuml
2 2
3skinparam linetype ortho 3skinparam linetype ortho
4skinparam monochrome reverse
5skinparam backgroundColor #FFFFFF
6 4
7package viewer { 5package viewer {
8 class Viewer { 6 class Viewer {
diff --git a/src/docs/dev.md b/src/docs/dev.md
index fb3e614..9df3b3f 100644
--- a/src/docs/dev.md
+++ b/src/docs/dev.md
@@ -1,7 +1,7 @@
1--- 1---
2title: "BSc IN S5 / OOP with Java / Wall-J / Wall-J / Devel. notes" 2title: "BSc IN S5 / OOP with Java / Wall-J / Wall-J / Devel. notes"
3author: [Pacien TRAN-GIRARD, Adam NAILI] 3author: [Pacien TRAN-GIRARD, Adam NAILI]
4date: 2018-01-14 4date: 2018-02-04
5... 5...
6 6
7# Preamble 7# Preamble
@@ -60,9 +60,9 @@ Their respective properties such as their traversability by the player have been
60Additional constraints on board validity have been added to ensure their correctness during their manipulation in the 60Additional constraints on board validity have been added to ensure their correctness during their manipulation in the
61program. Those conditions have been described in the user manual as well. 61program. Those conditions have been described in the user manual as well.
62 62
63
63## Unit testing 64## Unit testing
64 65
65_"Sir, the testing?"_, Caroline reminds.
66Most utility, logic functions and algorithms have been covered by automatic unit tests to reduce the risk of 66Most utility, logic functions and algorithms have been covered by automatic unit tests to reduce the risk of
67small-but-yet-critical mistakes and regressions during the development. 67small-but-yet-critical mistakes and regressions during the development.
68Those automatic tests are ran with the help of the JUnit 5 test framework. 68Those automatic tests are ran with the help of the JUnit 5 test framework.
@@ -70,50 +70,65 @@ Those automatic tests are ran with the help of the JUnit 5 test framework.
70Components and modules related to the graphical user interface could not have been easily tested automatically. 70Components and modules related to the graphical user interface could not have been easily tested automatically.
71Quality control of such parts of the program have been handled manually. 71Quality control of such parts of the program have been handled manually.
72 72
73
73## Architecture 74## Architecture
74 75
75The architecture of the program is loosely based on the _Model-View-Controller_ pattern, combined with an event-driven 76The architecture of the program is loosely based on the _Model-View-Controller_ pattern,
76approach, separating state objects from actions and events handlers. 77combined with an event-driven approach.
77 78
78A more complete package and class diagram is attached to this report. 79Input and game generated events are propagated recursively through each sub-module,
80which can return new events to be broadcast on the next tick.
79 81
80TODO: 82Those events are fed to controller methods which alter their parent state holding object.
81 83
82- include a simplified diagram here 84This architecture ensures a low class coupling while allowing the program to be extended.
83- explain event handling and propagation 85
84- explain why not mailbox/event subscription system 86\newpage
85- explain how it minimizes coupling
86- explain how we can add stuff like a second robot and whatnot
87 87
88## Implementation details 88## Implementation details
89 89
90TODO: 90### Physics
91
92This game makes use of the JBox2D physics engine to simulate a physical world.
93Each block is linked to a corresponding JBox2D body which is used to determine its position and detect collisions.
94
95Bomb explosion management uses the physics engine's ray cast feature to determine which garbage blocks are affected by a blast.
96This solution is more realistic than a blast radius-based approach, while being less resource demanding than a particle propagation system.
97
98### Event propagation
99
100Events are broadcast to each and every game entity.
101This simple method has been profiled and validated for the low number of events propagated in this game.
102A more complex mailbox-driven approach has been considered but was not implemented due to its unnecessary complexity and
103the unavailability of a dependency injection framework.
91 104
92- per-module remarks:
93 - tell who did what in parallel
94 - using a ray tracer for explosions
95 105
96## Additional features 106## Additional features
97 107
98None yet. 108None of the suggested additional feature was implemented.
99 109
100## Notes 110Those could have been easily added as follows:
111
112- Bouncy walls can be added by defining a new block type with a greater restitution coefficient or a custom collision handler.
113- Imploding bombs can be added by defining a new block and a new implosion event types, which would be handled similarly
114to the explosion events with a reversed impulse vector.
115- A timer can be added in the viewer.
101 116
102TODO:
103 117
104- complain about Ant, beg for Gradle and dependency management 118## Notes
105- check that zen5 is actually using a double buffer 119
106- include git commit log? 120- Body in the physics engine should have been scaled down.
121- Zen5 could not handle _RETURN_ key events.
122- Zen5 ScreenInfo are not updated after a window resize.
123- Ant is hell. Gradle is better.
107 124
108--- 125---
109 126
110# References 127# References
111 128
112TODO: 129- Javadocs of JBox2D, Zen5, JUnit
113 130- Documentations of the JDK and the Ant build tool
114- jbox2d, zen5, jdk, ant, junit docs 131- [A* search algorithm article on Wikipedia](https://en.wikipedia.org/wiki/A*_search_algorithm)
115- A* on wikipedia 132- [JBox2D tutorial request on StackOverflow](https://stackoverflow.com/a/8929199)
116- common sense 133- [Hello World JBox2D with JavaFX 2.0](http://thisiswhatiknowabout.blogspot.com/2011/11/hello-world-jbox2d-with-javafx-20.html)
117- https://stackoverflow.com/a/8929199 134- [Box2D C++ tutorials - Explosions](http://www.iforce2d.net/b2dtut/explosions)
118- http://thisiswhatiknowabout.blogspot.com/2011/11/hello-world-jbox2d-with-javafx-20.html
119- http://www.iforce2d.net/b2dtut/explosions
diff --git a/src/docs/user.md b/src/docs/user.md
index 8dd78d2..57193ed 100644
--- a/src/docs/user.md
+++ b/src/docs/user.md
@@ -1,7 +1,7 @@
1--- 1---
2title: "BSc IN S5 / OOP with Java / Wall-J / User manual" 2title: "BSc IN S5 / OOP with Java / Wall-J / User manual"
3author: [Pacien TRAN-GIRARD, Adam NAILI] 3author: [Pacien TRAN-GIRARD, Adam NAILI]
4date: 2018-01-14 4date: 2018-02-04
5... 5...
6 6
7# Preamble 7# Preamble
@@ -54,7 +54,7 @@ The player controls a robot, dropping bombs whose explosion can push garbage int
54Garbage bounce when colliding other elements such as walls, unexploded bombs or other garbage blocks, 54Garbage bounce when colliding other elements such as walls, unexploded bombs or other garbage blocks,
55and disappear of the screen when reaching a garbage can. 55and disappear of the screen when reaching a garbage can.
56 56
57The explosion of each of the dropped bombs can be delayed using independent timers. 57The explosion of each of the dropped bombs can be delayed using independent timers, up to 9 seconds.
58The robot must drop exactly 3 bombs on each level. 58The robot must drop exactly 3 bombs on each level.
59 59
60A stage is considered done once the world has been cleared of all its garbage. 60A stage is considered done once the world has been cleared of all its garbage.
@@ -78,18 +78,16 @@ Robot Blue disk / /
78 78
79## Controls 79## Controls
80 80
81Controls are defined as follows:
82
83Trigger Action 81Trigger Action
84------------------------------- ------------------------------------------------------- 82------------------------------- -------------------------------------------------------
85Click on a traversable tile Moves the robot to the pointed location 83Click on a traversable tile Moves the robot to the pointed location
86`SPACE` on a free tile Drops a bomb at the current location 84`SPACE` on a free tile Drops a bomb at the current location
87`SPACE` on a tile with a bomb Increases the timer of the bomb at the current location 85`SPACE` on a tile with a bomb Increases the timer of the bomb at the current location
88`S` while controlling the robot Puts Wall-j into a safe place before activating the bombs 86`S` while controlling the robot Puts Wall-j into a safe place before activating the bombs
89`R` at any moment Restarts the current level if the stage is not cleared or continues to the next one if possible 87`R` at any moment Restarts the current level or continues to the next one if solved
90`Q` at any moment Exits the game 88`Q` at any moment Exits the game
91*__Note__: The specifications precise that the _RETURN_ button must be used for the bomb management. This key is not defined in the Zen5 library. 89
92The *SPACE* key is used in substitution* 90
93## Custom levels 91## Custom levels
94 92
95Custom world can be defined by the user in plain text files, each of which containing a single world. 93Custom world can be defined by the user in plain text files, each of which containing a single world.
@@ -113,7 +111,6 @@ A world is defined as valid if its blocks fulfill the following criteria:
113* The world must have enough free tiles to contain all droppable bombs. 111* The world must have enough free tiles to contain all droppable bombs.
114 112
115Only valid worlds can be loaded into the game. 113Only valid worlds can be loaded into the game.
116
117The validity of a world may not guaranty the solvability of the puzzle. 114The validity of a world may not guaranty the solvability of the puzzle.
118 115
119\newpage 116\newpage