This is a browser-based game for Search and Rescue missions. It was written in Python and Javascript and used the FastAPI Python framework to display the interface in a web browser.
- Navigate the grid: using
Arrow Keys
orArrow Keys + X
to speed up the move - Open a door: pressing the
Enter
key - Rescue a green victim: pressing the
Enter
key five times - Rescue a yellow victim: pressing
Enter
ten times
Layout the default search and rescue task with different levels of visibility.
- To run locally:
- Python 3.7+ installed
- A Web browser
Create a database in MySQL using the SQL script script.sql
.
- In a command shell, go to the main folder that contains the
requirements.txt
file. - (suggestion) Create a virtual Python Environment by running the following commands in your shell. (This may be different on your machine! If it does not work, look at how to install a virtual Python env based on your system.):
python3 -m venv env
source env/bin/activate
- Install the required Python libraries by running this command in your shell:
pip install -r requirements.txt
- To start the server, run:
python server.py
Experiment variables are specified in the file mission/config.json
.
cond_name
: condition nameload_new_map
:1
indicates to use of a new task layout in case of creating/modifying a task scenario, and0
otherwisemap_file
: map design file inCSV
format in case of using the new map layout ("load_new_map": 1
)map_dir
: directory where all map design files are locatedtile_width
: value to increase or decrease the size of a task environmentgame_duration
: variable controlling a gameplay duration (in seconds) within an episode. For a 5-minute game,"game_duration": 300
max_episode
: value specifying a number of times (episodes) one can play the task.victim_die
: variable indicating the time (in seconds) when victim disappearance happens. To simulate critical victims disappearing after two minutes elapse,"victim_die": 120
visibility
: variable controls three levels of visibility, i.e.,fov
(field of view),map
(map view), andfull
(full view)complexity
: levels of structural complexity used in the study, i.e.,simple
orcomplex
delayed_time
: variable specified the delay period (in seconds) for one action to take effect. For immediate actions,"delayed_time": 0
perturbation_time
: variable indicating when a perturbation or a sudden change within an episode occurs (measured in seconds). For example, during a 5-minute mission, if the perturbation takes place after 2 minutes of gameplay, then"perturbation_time": 120
map_perturbation
: the design file inCSV
format associated with the new scenario layout when a perturbation occurs.
A step-by-step walkthrough for creating a task scenario in Minimap.
A player needs to navigate the
Create a map design file in the Excel configuration and save it in the CSV format (e.g., map_design_c.csv
). Put the CSV design file in the folder
mission/static/
.
Illustration of map design Excel and CSV format for the new scenario
The code number of each object in the environment, together with their associated action and reward, is determined in the following table.
Num | Name | Press | Reward |
---|---|---|---|
1 | wall | 0 | 0 |
2 | door | 1 | 0 |
3 | green | 5 | 10 |
4 | blue | 15 | 10 |
5 | red | 20 | 60 |
6 | yellow | 10 | 30 |
7 | other | 0 | 0 |
8 | agent | 0 | 0 |
9 | rubble | 5 | 0 |
The reward for obtaining each object and the number of keystrokes required for such action is defined in the column Press
and Reward
. For instance, to adjust the value of saving the green object to 12 points (instead of 10 points) and the number of key presses needed is 7, change the third row in the table as follows:
Num | Name | Press | Reward |
---|---|---|---|
3 | green | 7 | 12 |
To simulate a sudden change in the environment within a game, design a new setting when the perturbation happens in the Excel file. Save the design file in the CSV format (e.g., map_perturbation_c.csv
) and place it in the folder mission/static/
.
Illustration of map design Excel and CSV format for the new setting after the perturbation
Adjust the file mission/config.json
as the following
"load_new_map": 1,
"map_file": "map_design_c.csv",
"map_dir": "mission/static/data/",
"tile_width": 20,
"game_duration": 180,
"max_episode": 10,
"victim_die": 120,
"visibility": "full",
"delayed_time": 1000,
"perturbation_time": 60,
"map_perturbation": "map_perturbation_c.csv"
Start the server by typing:
python server.py
Once the server is started, launch the new task scenario by connecting to:
http://0.0.0.0:5700/minimap?uid=XX
Replay the recorded data files by entering:
http://0.0.0.0:5700/replay
Then select the data file to display the playback:
Illustration of the replay function with the new task scenario
If you have issues or questions, don't hesitate to contact Ngoc Nguyen at [email protected].