aboutsummaryrefslogtreecommitdiff
path: root/src/docs/user.md
blob: 8dd78d2d4899977e7ab6613efdbbc7951e921435 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
---
title: "BSc IN S5 / OOP with Java / Wall-J / User manual"
author: [Pacien TRAN-GIRARD, Adam NAILI]
date: 2018-01-14
...

# Preamble

"Wall-J: the Space Cleaner" is a game in which a player uses bombs to push garbage into trash cans in user definable
worlds.

Being part of the "OOP with Java" course at [UPEM](http://www.u-pem.fr/), this application has been entirely
written in Java and makes use of the Zen5 and [JBox2D](http://www.jbox2d.org/) libraries.

## Licensing

This work is licensed under the terms of the
[Creative Commons BY-NC-SA 4.0 license](https://creativecommons.org/licenses/by-nc-sa/4.0/) by its authors:
Pacien TRAN-GIRARD and Adam NAILI.

Build-time and embedded run-time dependencies of this program are licensed under their own respective terms.

---

# Usage

## Prerequisites

This application requires the Java Runtime Environment version $\geq$ 8.

A graphical session is also needed to display the game window.

## Running the program

The program can be started by running the following command:

    java -jar wallj.jar

A custom world set contained within a directory can be loaded by supplying its path as command line argument as such:

    java -Dlevels=/home/sforthright/bnl/op_cleanup/ -jar wallj.jar

World definition files stored within the given directories and named as `level$i.txt`, where `$i` is a padded integer,
are loaded in alphanumerical order.

\newpage

# Game-play

## Rules

The player controls a robot, dropping bombs whose explosion can push garbage into trash cans.

Garbage bounce when colliding other elements such as walls, unexploded bombs or other garbage blocks,
and disappear of the screen when reaching a garbage can.

The explosion of each of the dropped bombs can be delayed using independent timers.
The robot must drop exactly 3 bombs on each level.

A stage is considered done once the world has been cleared of all its garbage.
The player is then allowed to move on to the next stage.
The game is finished once all stages are completed.

## World

The world is rectangular grid composed of the following type of tiles:

Entity type Appearance   Pushable by bomb Traversable by robot
----------- ------------ ---------------- --------------------
Wall        Black square No               No
Trash can   Red square   No               No
Bomb        Black disk   No               No
Free        Empty        No               Yes
Garbage     Brown disk   Yes              Yes
Robot       Blue disk    /                /

\newpage

## Controls

Controls are defined as follows:

Trigger                                 Action
-------------------------------         -------------------------------------------------------
Click on a traversable tile             Moves the robot to the pointed location
`SPACE` on a free tile                  Drops a bomb at the current location
`SPACE` on a tile with a bomb           Increases the timer of the bomb at the current location
`S` while controlling the robot         Puts Wall-j into a safe place before activating the bombs
`R` at any moment                       Restarts the current level if the stage is not cleared or continues to the next one if possible
`Q` at any moment                       Exits the game
*__Note__: The specifications precise that the _RETURN_ button must be used for the bomb management. This key is not defined in the Zen5 library. 
The *SPACE* key is used in substitution*
## Custom levels

Custom world can be defined by the user in plain text files, each of which containing a single world.
Such a definition file most contain no empty line, leading or trailing tabulation or space.

A tile map is a rectangular character array from the following alphabet:

Block type  Character Bounding Must be reachable
----------  --------- -------- -----------------
Free        (space)   No       Yes
Garbage     G         No       Yes
Trash can   T         Yes      Yes
Wall        W         Yes      No

A world is defined as valid if its blocks fulfill the following criteria:

* The bounding box of the defined world must be made of bounding blocks.
* The interior space formed by traversable blocks must be unique and simple.
* Reachable blocks are either adjacent or belonging to the interior space.
* The world must contain at least one trash can and one garbage block.
* The world must have enough free tiles to contain all droppable bombs.

Only valid worlds can be loaded into the game.

The validity of a world may not guaranty the solvability of the puzzle.

\newpage

__Example of invalid world definition:__
```
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW         W
W                              W                               W   WWW   W
W                              W                               W   WTW   W
                      WWWWWWWWWW                               W   WWW   W
                      W        W                               W         W
                      W        W                               WWWWWWWWWWW
                      WWWWWWWWWW                                         W
W                              W                                         W
W                              W                                         W
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
```

__Example of valid world definition:__
```
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
W                                                              WWWWWWWWWWW
W                                                              WWWWWWWWWWW
T                     WWWWWWWWWW                               WWWWWWWWWWW
T                     WWWWWWWWWW        GGGGGGGGGGGGG          WWWWWWWWWWW
T                     WWWWWWWWWW        GGGGGGGG               WWWWWWWWWWW
T                     WWWWWWWWWW        GGGGGGGGGGGGG                    W
W                              W                                         W
W                              W                                         W
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
```