Skip to content

Commit c20b271

Browse files
committed
Update readme
1 parent 2ff8533 commit c20b271

File tree

2 files changed

+41
-54
lines changed

2 files changed

+41
-54
lines changed

DOCUMENTATION.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,52 @@ Throughout the project I've attempted to document and leave comments. Go ahead a
55
In the root of this project you'll find configuration files as well as three folders:
66

77
- [src →](src/) The web root.
8+
- [content](src/content) contains cards, dungeons, encounters and monsters etc.
89
- [game](src/game) contains the core game logic
9-
- [content](src/content) uses methods from the game engine to build cards, dungeon and monsters
1010
- [ui](src/ui) is the example web interface to actually play the game
1111
- [public →](public/) Copied to the web root as-is
1212
- [tests →](tests/) Contains all tests for the game engine. Nothing for the UI. Run `npm test`.
1313

14-
## Src
14+
## Coding style
1515

16-
This is the full source code of the game _and_ UI. The game logic does not concern with the UI.
16+
- JavaScript (ES modules)
17+
- Web components and Preact HTM for rendering
18+
- Immer for immutable state updates
19+
- Error handling: Use try/catch sparingly; prefer validation and early returns
20+
- JSDoc for documentation
21+
- No semicolons, single quotes, tabs
1722

1823
### Game
1924

2025
#### Game State
2126

22-
The full game state is always stored in a single, large "game state" object. It is everything needed to reproduce a certain state of the game. Everything is synchronous. It does not care about your UI. The state is always modified using "actions".
27+
The full game state is always stored in a single, large "game state" object. It is everything needed to reproduce a certain state of the game. It does not know about your UI. The state is modified using synchronous "actions".
2328

2429
#### Actions
2530

2631
An action is a function that takes a `state` object, modifies it, and returns a new one. There are actions for drawing a card, dealing damage, applying a debuff... everything you want to do, there's an action.
2732

28-
See all actions in [actions.js](src/game/actions.js). Most have comments and corresponding tests you can check.
33+
See all (mostly well documented) actions in [actions.js](src/game/actions.js).
2934

3035
#### Action Manager
3136

32-
As said, actions return a new state. They don't modify the original state. To keep track of all the moves (actions) made, we use the "action manager" to queue and dequeue them.
37+
As said, actions return a new state. To keep track of actions made, we use an "action manager" to queue and dequeue them.
3338

3439
Run `enqueue(action)` to add an action to the list.
3540
Run `dequeue()` to update the state with the changes from the oldest action in the queue.
3641

37-
> Note, you don't pass an action directly to the action manager. Rather you pass an object. Like this: `{type: 'nameOfAction', damage: 5, ... more properties}`.
42+
> Note, you don't pass an action directly to the action manager. Rather you pass a description, like so: `{type: 'nameOfAction', damage: 5, ... more properties}`.
3843
3944
#### Cards
4045

41-
You have a deck of cards. Cards have different energy cost and can trigge other game actions when they are played.
46+
You have a deck of cards. Cards have energy cost, have target(s), can deal damage and block, trigger game actions, apply powers (de/buffs) when played and have conditions that decide when they can be played.
4247

43-
1. Cards start in the "draw pile".
44-
2. From there they are drawn to the "hand"
45-
3. ...and finally, once played, to the "discard pile".
48+
Cards move from the "draw pile" into your hand, and once played to the discard pile.
4649

47-
Once the draw pile is empty, and you attempt to draw, the discard pile is reshuffled into the draw pile.
50+
If the draw pile has fewer cards than you attempt to draw, the discard pile is shuffled into the draw pile.
4851

4952
Cards also have a `target` property to suggest which targets the card should affect.
5053

51-
For more advanced cards, you can define (custom) actions to run when the card is played. To limit when a a card can be played, use "conditions" (see the source code).
52-
5354
#### Powers
5455

5556
Cards can apply "powers". A power is a status effect or aura that usually lasts one or more turns. It can target the player, a monster or all enemies. A power could do literally anything, but an example is the "Vulnerable" power, which makes the target take 50% more damage for two turns.

README.md

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,57 @@
11
# Slay the Web
22

3-
A digital, single player deckbuilding roguelike card game for the web based on Slay The Spire,
3+
A single player deck-building roguelike video card game for the web based on Slay The Spire,
44
a fantastic video game designed by [MegaCrit](https://www.megacrit.com/).
55

6+
### [Play on slaytheweb.cards](https://slaytheweb.cards/)
67

7-
### [Play on slaytheweb.cards](https://slaytheweb.cards/)
88
### [Chat on #slaytheweb:matrix.org](https://matrix.to/#/#slaytheweb:matrix.org)
99

1010
<a href="https://slaytheweb.cards"><img src="https://i.imgur.com/m9CRCsa.png" alt="Screenshot of Slay the Web" width="640"></a>
1111

12+
## Background
13+
1214
After many runs in the Spire, I got into the theory behind the game. Inspired by the STS modding community, I thought it'd be fun and a great learning experience to try and implement the core logic of the game in JavaScript for the web. And that is what _Slay the Web_ is: a kind of stable, UI agnostic game engine with an example UI for the web.
1315

14-
## State of the game
16+
## Updates
1517

16-
December 2023. The core mechanics seem to work. There is a [dynamic map](https://slaytheweb.cards/map-demo) you can navigate with different rooms and monsters. You can fight against them using your cards and their powers.
18+
See the CHANGELOG.md file.
1719

18-
There are many things that would make it more fun to play:
20+
## Development
1921

20-
- new cards
21-
- new powers
22-
- more monsters
23-
- expand the map into multiple "worlds" (or acts...)
24-
- better UI and animations
25-
- optimize UI for mobile
22+
TLDR;
23+
24+
1. Clone the repository
25+
2. Run `npm install` followed by `npm run dev` to open a local development server.
2626

27-
See the [open issues](https://github.com/oskarrough/slaytheweb/issues). Have an idea? Please [open a new issue](https://github.com/oskarrough/slaytheweb/issues/new).
2827

2928
## Documentation
3029

3130
If you're interested in contributing to the game or merely curious how it works:
3231

3332
- [The documentation](DOCUMENTATION.md)
3433

35-
Or browse the code. Especially the game logic includes tons of comments (written in JSDoc).
34+
Or browse the code. Especially the game logic includes tons of comments.
3635

37-
## Development
36+
See the [open issues](https://github.com/oskarrough/slaytheweb/issues).
37+
Have an idea? Please [open a new issue](https://github.com/oskarrough/slaytheweb/issues/new).
3838

39-
TLDR;
40-
41-
1. Clone the repository
42-
2. Run `npm install` followed by `npm run dev` to open a local development server.
43-
44-
The `src/game` folder contains the actual game logic.
45-
The `src/ui` folder is the website UI where you can actually play the game.
46-
The `src/content` folder builds content for the game.
47-
48-
### Coding style
49-
50-
- JavaScript (ES modules)
51-
- JSDoc for documentation
52-
- No semicolons, single quotes, tabs
53-
- Error handling: Use try/catch sparingly; prefer validation and early returns
54-
55-
## Architecture
56-
- `src/game/` - Core game logic
57-
- `src/content/` - Game content definition (cards, encounters)
58-
- `src/ui/` - Frontend components and UI logic
59-
- Use Preact/HTM for components, Immer for immutable state updates
39+
There are many areas that would make it more fun to play:
6040

41+
- new cards
42+
- new powers
43+
- more monsters
44+
- expand the map into multiple "worlds" (or acts...)
45+
- better UI and animations
46+
- optimize UI for mobile
6147

6248
## How to release a new version (aka deploy)
6349

64-
Every commit to the `main` branch automatically deploys to https://slaytheweb.cards via the Vercel service.
50+
Every commit to the `main` branch automatically deploys to https://slaytheweb.cards via the Vercel service.
6551

66-
If you open a PR, it'll give you a preview URL as well for testing.
52+
If you open a PR, it'll give you a preview URL where we can see if things are as expected.
6753

68-
To update `CHANGELOG.md`, run `bunx release-it` and follow the prompts. We do not use GitHub releases.
54+
To update the `CHANGELOG.md`, run `bun run release` and follow the prompts. We do not use GitHub releases.
6955

7056
## References
7157

@@ -100,7 +86,7 @@ To update `CHANGELOG.md`, run `bunx release-it` and follow the prompts. We do no
10086
- https://en.wikipedia.org/wiki/Slay_the_Spire
10187
- https://slay-the-spire.fandom.com/wiki/Slay_the_Spire_Wiki
10288
- https://spirelogs.com/
103-
- https://maybelatergames.co.uk/tools/slaythespire/
89+
- https://maybelatergames.co.uk/tools/slaythespire/
10490
- https://github.com/daviscook477/BaseMod
10591
- https://github.com/Gremious/StS-DefaultModBase
10692
- https://github.com/Gremious/StS-DefaultModBase/wiki
@@ -124,7 +110,7 @@ Licenced from https://mbtype.com/
124110
### Open source artwork
125111

126112
- http://ronenness.github.io/RPGUI/
127-
- https://github.com/game-icons/icons
113+
- https://github.com/game-icons/icons
128114
- https://www.fromoldbooks.org/
129115
- https://www.oldbookart.com/
130116

0 commit comments

Comments
 (0)