-
Notifications
You must be signed in to change notification settings - Fork 23
Replace Unicode emoji rendering with Apple-style 32x32 PNG sprite system including Node.js test support #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3239dc6
Initial plan
Copilot d7de64a
Initial setup: fix render test path for current environment
Copilot d842092
Implement emoji sprite system with 32x32 PNG sprites replacing Unicod…
Copilot 2c37b98
Fix sprite loading for Node.js test environment
Copilot f92f35f
Fix emoji fallback rendering in Node.js test environment
Copilot de25950
Remove white color override in emoji fallback rendering
Copilot c5daf76
Implement Node.js sprite loading for colorful emoji rendering in tests
Copilot 5dbb4fc
Replace Unicode emoji rendering with 32x32 PNG sprite system includin…
Copilot 918761d
Replace emoji sprites with Apple-style designs for better visual cons…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,82 @@ | ||
| # Emoji Sprites | ||
|
|
||
| This directory contains 32x32 pixel PNG sprites that replace Unicode emoji rendering throughout the tribe game. | ||
|
|
||
| ## Naming Convention | ||
|
|
||
| Sprite files use descriptive snake_case names rather than Unicode characters: | ||
| - `crown.png` - 👑 (tribe badge) | ||
| - `skull.png` - 💀 (tribe badge) | ||
| - `handshake.png` - 🤝 (friendly diplomacy) | ||
| - `crossed_swords.png` - ⚔️ (hostile diplomacy or attack action) | ||
|
|
||
| ## Sprite Categories | ||
|
|
||
| ### Tribe Badge Sprites | ||
| Used for identifying different tribes in the game: | ||
| - `crown.png` - 👑 Royal/leadership tribe | ||
| - `skull.png` - 💀 Death/warrior tribe | ||
| - `fire.png` - 🔥 Fire tribe | ||
| - `water_drop.png` - 💧 Water tribe | ||
| - `shamrock.png` - ☘️ Nature/luck tribe | ||
| - `sun.png` - ☀️ Solar tribe | ||
| - `crescent_moon.png` - 🌙 Lunar tribe | ||
| - `star.png` - ⭐ Star tribe | ||
| - `lightning.png` - ⚡ Storm tribe | ||
| - `fleur_de_lis.png` - ⚜️ Noble tribe | ||
|
|
||
| ### Diplomacy Status Sprites | ||
| Used in tribe list UI to show relationships: | ||
| - `handshake.png` - 🤝 Friendly status | ||
| - `crossed_swords.png` - ⚔️ Hostile status | ||
|
|
||
| ### Player Action Sprites | ||
| Used for player commands and autopilot actions: | ||
| - `raised_hand.png` - ✋ Gather action | ||
| - `meat.png` - 🍖 Eat action | ||
| - `heart.png` - ❤️ Procreate action | ||
| - `crossed_swords.png` - ⚔️ Attack action (reused) | ||
| - `seedling.png` - 🌱 Plant action | ||
| - `megaphone.png` - 📢 Call to attack | ||
| - `trident.png` - 🔱 Split tribe | ||
| - `right_arrow.png` - ➡️ Follow me | ||
| - `man_feeding_child.png` - 👨👧 Feed child | ||
| - `bullseye.png` - 🎯 Autopilot move | ||
|
|
||
| ### Status Indicator Sprites | ||
| Used in UI status bars and displays: | ||
| - `calendar.png` - 🗓️ Time indicator | ||
| - `meat.png` - 🍖 Hunger indicator (reused) | ||
| - `heart.png` - ❤️ Hitpoints indicator (reused) | ||
| - `strawberry.png` - 🍓 Food indicator | ||
| - `robot.png` - 🤖 Autopilot indicator | ||
|
|
||
| ### Visual Effect Sprites | ||
| Used for floating visual effects during gameplay: | ||
| - `baby_bottle.png` - 🍼 Child fed effect | ||
| - `shield.png` - 🛡️ Attack deflected effect | ||
| - `muscle.png` - 💪 Attack resisted effect | ||
| - `explosion.png` - 💥 Hit effect | ||
|
|
||
| ## Usage in Code | ||
|
|
||
| ### Main Files Using Sprites: | ||
| - `src/game/render/render-effects.ts` - Visual effects rendering | ||
| - `src/game/render/ui/render-tribe-list.ts` - Tribe badges and diplomacy | ||
| - `src/game/render/ui/render-buttons.ts` - Player action buttons | ||
| - `src/game/render/ui/render-top-left-panel.ts` - Status indicators | ||
| - `src/game/ui/ui-types.ts` - Emoji mappings configuration | ||
|
|
||
| ### Sprite Loading: | ||
| Sprites are loaded through `src/game/sprites/sprite-loader.ts` which preloads all images and provides a sprite cache for rendering functions. | ||
|
|
||
| ### Rendering: | ||
| The `drawSprite()` function replaces `ctx.fillText()` calls for emoji rendering, supporting the same positioning and scaling used by the original emoji system. | ||
|
|
||
| ## Technical Notes | ||
|
|
||
| - All sprites are 32x32 pixels with transparent backgrounds | ||
| - PNG format for best quality and transparency support | ||
| - Sprites use distinctive colors and shapes for clear recognition | ||
| - Fallback system in place for missing sprites (shows colored circle with letter) | ||
| - Compatible with existing floating effect animations (fade, rise up, etc.) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot this wont' work for render.test.ts
also could you run the test and commit the rendered output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the sprite loading issue for Node.js test environment. The
preloadSprites()function now gracefully skips sprite loading when running in Node.js (like inrender.test.ts) and falls back to Unicode text rendering. I've run the test and committed the updated render output. The tests all pass (31/31) and use the expected fallback behavior. See commit 2c37b98.