Skip to content

Commit 6ba7e34

Browse files
authored
update README (#23)
* update README * update README * update README
1 parent e81e08e commit 6ba7e34

File tree

1 file changed

+86
-27
lines changed

1 file changed

+86
-27
lines changed

README.md

Lines changed: 86 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,103 @@
11
# RayCastWorlds
22

3-
**Important:** This package is not registered yet. It is a work in progress.
3+
This package provides simple first-person 3D games that can also be used as reinforcement learning environments. It is inspired by [DeepMind Lab](https://github.com/deepmind/lab).
44

5-
This package provides simple raycasted games.
5+
**Note:** This package is unregistered as of this writing and can be installed using the following command in the Julia REPL's `pkg` mode (enter `pkg` mode by pressing `]` after starting the REPL):
66

7-
Right now only one game is provided called `SingleRoom`.
7+
```
8+
add https://github.com/Sid-Bhatia-0/RayCastWorlds.jl
9+
```
10+
11+
## Table of Contents
12+
13+
* [Getting Started](#getting-started)
14+
* [Notes](#notes)
15+
16+
[List of Environments](#list-of-environments)
17+
1. [SingleRoom](#singleroom)
18+
19+
## Getting Started
20+
21+
```julia
22+
import RayCastWorlds as RCW
23+
24+
env = RCW.SingleRoomModule.SingleRoom()
25+
26+
# reset the game. All environments are randomized
27+
28+
RCW.reset!(env)
29+
30+
# get names of actions that can be performed in this environment
31+
32+
RCW.get_action_names(env)
33+
34+
# perform actions in the environment
35+
36+
RCW.act!(env, 1) # move forward
37+
RCW.act!(env, 2) # move backward
38+
RCW.act!(env, 3) # turn left
39+
RCW.act!(env, 4) # turn right
40+
41+
# interactively play the game
42+
# keybindings:
43+
# `q`: quit
44+
# `r`: reset
45+
# `w`: move forward
46+
# `s`: move backward
47+
# `a`: turn left
48+
# `d`: turn right
49+
# `v`: toggle top view and camera view
50+
51+
RCW.play!(env)
52+
53+
# use the RLBase API
54+
55+
import ReinforcementLearningBase as RLBase
56+
57+
# wrap a game instance from this package to create an RLBase compatible environment
58+
59+
rlbase_env = RCW.RLBaseEnv(env)
60+
61+
# perform RLBase operations on the wrapped environment
62+
63+
RLBase.reset!(rlbase_env)
64+
state = RLBase.state(rlbase_env)
65+
action_space = RLBase.action_space(rlbase_env)
66+
reward = RLBase.reward(rlbase_env)
67+
done = RLBase.is_terminated(rlbase_env)
68+
69+
rlbase_env(1) # move forward
70+
rlbase_env(2) # move backward
71+
rlbase_env(3) # turn left
72+
rlbase_env(4) # turn right
73+
```
874

975
## Notes
1076

11-
#### RayCaster
77+
### RayCaster
1278

1379
The core raycasting algorithm is implemented in the [`RayCaster`](https://github.com/Sid-Bhatia-0/RayCaster.jl) package.
1480

15-
#### Units
81+
### Units
1682

17-
There are 4 types of units:
18-
1. 'wu': Stands for world units. These are usually floating point numbers representing positions in the real world.
19-
1. 'tu': Stands for tile units. These are integers representing positions on the tile map.
20-
1. 'pu': Stands for pixel units. These are integers representing positions on the visualization image.
21-
1. 'au': Stands for angle units. These are integers representing angles from 0 to `num_directions`.
83+
There are 4 types of units used throughout the code:
84+
1. `wu`: Stands for world units. These are usually floating point numbers representing positions in the real world.
85+
1. `tu`: Stands for tile units. These are integers representing positions on the tile map.
86+
1. `pu`: Stands for pixel units. These are integers representing positions on the visualization image.
87+
1. `au`: Stands for angle units. These are integers representing angles from 0 to `num_directions`.
2288

23-
The height of the tile map correponds to the x-axis of the coordinate system (indexed with `i` in the code base) and width correponds to the y-axis (indexed with `j` in the code base) . This is to keep the coordinate system right handed.
89+
The height of the tile map correponds to the x-axis of the coordinate system (often indexed with `i`) and width correponds to the y-axis (often indexed with `j`). This keeps the coordinate system right-handed.
2490

25-
#### Play
91+
## List of Environments
2692

27-
Here is how you start the game:
93+
1. ### SingleRoom
2894

29-
julia'''
30-
import RayCastWorlds as RCW
95+
The objective of the agent is to navigate its way to the goal. When the agent tries to move into the goal tile, it receives a reward of 1 and the environment terminates.
3196

32-
env = RCW.SingleRoomModule.SingleRoom()
97+
Camera view:
3398

34-
RCW.play!(env)
35-
'''
36-
37-
Here are the keybindings:
38-
1. `q`: quit
39-
1. `r`: reset
40-
1. `w`: move forward
41-
1. `s`: move backward
42-
1. `a`: turn left
43-
1. `d`: turn right
44-
1. `v`: toggle top view and camera view
99+
<img src="https://user-images.githubusercontent.com/32610387/128851560-4c713b0b-cf9f-4eed-bf60-439d456ab5f6.png">
100+
101+
Top view:
102+
103+
<img src="https://user-images.githubusercontent.com/32610387/128851489-befdb69e-157c-48ea-b6ac-7447e8018d93.png">

0 commit comments

Comments
 (0)