Skip to content

Commit

Permalink
Merge branch 'main' into lunathanael-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
lunathanael authored Mar 11, 2024
2 parents 4aff706 + 591d3eb commit 6341549
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 13 deletions.
17 changes: 7 additions & 10 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ body:
2.
3.
validations:
required: true
required: false

# Requirements
- type: textarea
Expand All @@ -41,17 +41,14 @@ body:
description: Which version of Python are you using?
placeholder: "e.g. 3.11"
validations:
required: true
required: false

# Log File
# Screenshots
- type: textarea
attributes:
label: Log File
description: |
Please upload the log file as an attachment (DO NOT COPY OR PASTE THE CONTENTS INTO THIS FIELD)
label: Screenshots
description: Upload any relevant pictures/screenshots here
placeholder: |
To upload the log, access it from Settings -> About -> Open log location; Or
- Select the `debug.log` file from `%localappdata%\Packages\49306atecsolution.FilesUWP_et10x9a9vyk8t\LocalState`
- Drag and drop the file to upload as an attachment
Relevant pictures
validations:
required: true
required: false
98 changes: 95 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,95 @@
# clash-royale-rl
Clash Royale Reinforcement Learning AI
Python: 3.11!
# Clash Royale Env

<table>
<tbody>
<tr>
<td>Action Space</td>
<td>Discrete(2304)</td>
</tr>
<tr>
<td>Observation Shape</td>
<td>(128, 128, 3)</td>
</tr>
<tr>
<td>Observation High</td>
<td>255</td>
</tr>
<tr>
<td>Observation Low</td>
<td>0</td>
</tr>
<tr>
<td>Import</td>
<td>import clash_royale <br/>gymnasium.make("clash-royale", render_mode="rgb_array")</td>
</tr>
</tbody>
</table>

## Description

Clash Royale as a Gymnasium environment.
Supports Python versions 3.10 and above.

### Installation

```bash
pip install git+https://github.com/MSU-AI/[email protected]
```

### Usage

1. Import it to train your RL model

```python
import clash_royale
env = gymnasium.make("clash-royale", render_mode="rgb_array")
```

The package relies on ```import``` side-effects to register the environment
name so, even though the package is never explicitly used, its import is
necessary to access the environment.

2. Some sample code
```python
# WARNING: This code is subject to change and may be OUTDATED!
import clash_royale
import gymnasium
env = gymnasium.make("clash-royale", render_mode="rgb_array")

obs, _ = env.reset()
while True:
# Next action:
# (feed the observation to your agent here)
action = env.action_space.sample()

# Processing:
obs, reward, terminated, _, info = env.step(action)

# Checking if the player is still alive
if terminated:
break

env.close()
```

## Action Space

Clash Royale has the action space `Discrete(2304)`.

| Variable | Meaning |
|----------|--------------------|
| x | Card x-coordinate |
| y | Card y-coordinate |
| z | Card index in hand |

Corresponding action space index of x * y * z.

## Observation Space

The observation will be the RGB image that is displayed to a human player with
observation space `Box(low=0, high=255, shape=(128, 128, 3), dtype=np.uint8)`.


## Version History

- v0.0.1: initial version release with mock api calls for internal testing

0 comments on commit 6341549

Please sign in to comment.