diff options
Diffstat (limited to 'src/docs/dev.md')
-rw-r--r-- | src/docs/dev.md | 73 |
1 files changed, 44 insertions, 29 deletions
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 | --- |
2 | title: "BSc IN S5 / OOP with Java / Wall-J / Wall-J / Devel. notes" | 2 | title: "BSc IN S5 / OOP with Java / Wall-J / Wall-J / Devel. notes" |
3 | author: [Pacien TRAN-GIRARD, Adam NAILI] | 3 | author: [Pacien TRAN-GIRARD, Adam NAILI] |
4 | date: 2018-01-14 | 4 | date: 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 | |||
60 | Additional constraints on board validity have been added to ensure their correctness during their manipulation in the | 60 | Additional constraints on board validity have been added to ensure their correctness during their manipulation in the |
61 | program. Those conditions have been described in the user manual as well. | 61 | program. 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. | ||
66 | Most utility, logic functions and algorithms have been covered by automatic unit tests to reduce the risk of | 66 | Most utility, logic functions and algorithms have been covered by automatic unit tests to reduce the risk of |
67 | small-but-yet-critical mistakes and regressions during the development. | 67 | small-but-yet-critical mistakes and regressions during the development. |
68 | Those automatic tests are ran with the help of the JUnit 5 test framework. | 68 | Those 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. | |||
70 | Components and modules related to the graphical user interface could not have been easily tested automatically. | 70 | Components and modules related to the graphical user interface could not have been easily tested automatically. |
71 | Quality control of such parts of the program have been handled manually. | 71 | Quality control of such parts of the program have been handled manually. |
72 | 72 | ||
73 | |||
73 | ## Architecture | 74 | ## Architecture |
74 | 75 | ||
75 | The architecture of the program is loosely based on the _Model-View-Controller_ pattern, combined with an event-driven | 76 | The architecture of the program is loosely based on the _Model-View-Controller_ pattern, |
76 | approach, separating state objects from actions and events handlers. | 77 | combined with an event-driven approach. |
77 | 78 | ||
78 | A more complete package and class diagram is attached to this report. | 79 | Input and game generated events are propagated recursively through each sub-module, |
80 | which can return new events to be broadcast on the next tick. | ||
79 | 81 | ||
80 | TODO: | 82 | Those events are fed to controller methods which alter their parent state holding object. |
81 | 83 | ||
82 | - include a simplified diagram here | 84 | This 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 | ||
90 | TODO: | 90 | ### Physics |
91 | |||
92 | This game makes use of the JBox2D physics engine to simulate a physical world. | ||
93 | Each block is linked to a corresponding JBox2D body which is used to determine its position and detect collisions. | ||
94 | |||
95 | Bomb explosion management uses the physics engine's ray cast feature to determine which garbage blocks are affected by a blast. | ||
96 | This 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 | |||
100 | Events are broadcast to each and every game entity. | ||
101 | This simple method has been profiled and validated for the low number of events propagated in this game. | ||
102 | A more complex mailbox-driven approach has been considered but was not implemented due to its unnecessary complexity and | ||
103 | the 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 | ||
98 | None yet. | 108 | None of the suggested additional feature was implemented. |
99 | 109 | ||
100 | ## Notes | 110 | Those 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 | ||
114 | to the explosion events with a reversed impulse vector. | ||
115 | - A timer can be added in the viewer. | ||
101 | 116 | ||
102 | TODO: | ||
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 | ||
112 | TODO: | 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 | ||