In Dragon Jump you play as a orange dragon who’s job is search for the secret door that takes him to the next level.
While playing you only need to PRESS SPACE (or ENTER), to make the Dragon Jump. The more you press the space bar, the higher it jumps. However, the dragon gets tired after jumping for too long and will fall after a while.
The dragon can also roll over ledges and walls, and hang onto walls to jump some more.
How the environment works
1. Build the wrapper
First you’ll need to create a wrapper over the Godot environment in order to get access to the game state and act.
Here’s a short Python snippet on how to do this:
2. Reset the environment
To make sure the environment and the code is synchronised, you’ll need to reset it before doing anything else.
The reset will also return the first set of observations that you’ll use to take your first action.
3. Take action
Once you decided on what action you want to take, your agent needs to take a step in the environment.
The step will return some valuable information regarding what happened after your agent acted, that will be useful when deciding on what’s the next action it may take.
What do those values mean?
- obs: dict - the observation of the current state of the game
- reward: float - the thing your agent will optimise towards maximising
- done: bool - whether the game is playing or it ended
- info: dict - additional information regarding the game
4. Repeat
The done flag will be set to true once the agent either completes the map or a certain number of in-game steps have passed.
Disclaimer: I don’t remember what’s the number of steps I chose for this environment, so you can figure out the reason it ended by what was the last reward it received. If the reward is higher than usual and you have a seemingly random number of steps: Congrats! You did it! 🍻
About Observations
For each game tick / action you take you get the following information from Godot
You can also checkout how sensors are indexed in the image bellow.
About Actions
In Dragon Jump you control the Dragon by pressing the SPACE BAR. That means that the action space is a Discrete Action Space where the action is either Jump (1) or Don’t Jump (0).
You can decide whether to jump or not based on a lot of factors, such as:
- how close a object is to the dragon based on the sensors
- how close the dragon is to the door
- whether the color of the next 20 pixels from the dragon are green or gray