-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: achievements and global save (#47)
* feat: global save data system * achievements working * changelog, docs and package version
- Loading branch information
Showing
59 changed files
with
887 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
description: Narrat games can have players unlock achievements | ||
--- | ||
|
||
# Achievements | ||
|
||
The achievements system allows players to unlock achievements, which appear in their own UI. | ||
|
||
Possible achievements can be defined in a `achievements.yaml` file: | ||
|
||
```yaml | ||
categories: | ||
- id: default | ||
title: Achievements | ||
- id: secret | ||
title: Secret Achievements | ||
|
||
defaultAchievementIcon: img/achievements/trophy.png | ||
|
||
achievements: | ||
win_game: | ||
name: Won the game | ||
description: You got this achievement by being a true ultimate pro gamer | ||
icon: img/items/bread.webp | ||
secret_achievement: | ||
name: Secret boss found | ||
description: You beat the secret boss | ||
icon: img/items/book.webp | ||
secret: true | ||
category: secret | ||
|
||
notifyNewAchievements: true | ||
|
||
secretAchievements: | ||
censorDescription: true | ||
censorName: false | ||
hideUntilObtained: false | ||
``` | ||
The location of `achievements.yaml` should be set in `config.yaml`: | ||
|
||
```yaml | ||
achievements: data/achievements.yaml | ||
``` | ||
|
||
Then achievements can be unlocked in game scripts: | ||
|
||
```narrat | ||
main: | ||
"There is a boss" | ||
choice: | ||
"Kill the boss?" | ||
"Yes": | ||
"You kill the boss" | ||
unlock_achievement win_game | ||
"No, run away": | ||
"You run away" | ||
``` | ||
|
||
## Achievements UI | ||
|
||
The achievements UI will automatically appear as a tab in the game menu if the game has any achievements defined. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions
38
packages/narrat/examples/games/default/data/achievements.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
categories: | ||
- id: default | ||
title: Achievements | ||
- id: secret | ||
title: Secret Achievements | ||
|
||
defaultAchievementIcon: img/achievements/trophy.png | ||
|
||
achievements: | ||
win_game: | ||
name: Won the game | ||
description: Get this achievement by being a true ultimate pro gamer | ||
icon: img/items/bread.webp | ||
find_book: | ||
name: Bookworm | ||
description: Find the book in the hidden room | ||
icon: img/items/bread.webp | ||
chapter_1: | ||
name: Chapter 1 | ||
description: Finish chapter 1 | ||
icon: img/items/book.webp | ||
chapter_2: | ||
name: Chapter 2 | ||
description: Finish chapter 2 | ||
icon: img/items/book.webp | ||
secret_achievement: | ||
name: Secret boss found | ||
description: Beat the secret boss | ||
icon: img/items/book.webp | ||
secret: true | ||
category: secret | ||
|
||
notifyNewAchievements: true | ||
|
||
secretAchievements: | ||
censorDescription: true | ||
censorName: true | ||
hideUntilObtained: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.