1. Before you start
- Make a copy of the whole download. If something goes wrong, you can go back to it.
- Install a free code editor such as Visual Studio Code (or Notepad++ on Windows). For pictures, the free GIMP or Krita open and export WebP files. For sounds, the free Audacity exports MP3.
- Work inside
source/. To see your changes, open a terminal in that folder and runnpm run serve, then openhttp://localhost:5180/. Reload the page after every change (Ctrl+F5). - No terminal? Edit the files of
game/directly, upload them to your host and reload the page.
2. What to edit for what
Work inside source/. This table says where each part of the game lives. Change one thing at a time and look at the result before the next change.
| You want to change | Edit |
|---|---|
| Every text and every language | src/locales/<code>.js |
| The name of the game | <title> in index.html, title in every src/locales/ file and test/locales.test.mjs |
| The colours of the buttons, panels and scenery | css/base.css (top lines) and the pictures of assets/ui/ |
| The logo and the icons | assets/ui/logo.webp, assets/ui/icon-32.png, icon-180.png and assets/icons/*.webp |
| The forest friends | assets/cats/ and CATS in src/config.js |
| The sceneries of the 10 worlds and the menu | assets/bg/ |
| Logs, lanterns, ice, bluish mist and flowery vine | assets/game/ |
| Sound effects, forest animal voices, music and ambient sound | assets/sfx/, assets/music/, assets/amb/ and the lists in src/audio/ |
| The helps per level and the limits of the stars | HELPS and stars() in src/game/rules.js |
| The levels | tools/generate-levels.mjs and src/game/levels/world-N.js |
| Speeds, jumps, effects, voices and volumes | FEEL in src/config.js |
| The names of the save in the browser | SAVE and PREFS in src/lib/storage.js |
3. Texts and languages
- Every text is in
src/locales/, one file per language (en.js,pt.js,es.js,zh-Hans.js...). Change the text between the quotes and keep the key in front of it.{n}and similar words in braces are filled in by the game: keep them. - All 14 files must have the same keys. Run
npm testafter a change: it tells you which file misses a key or has an empty text. - The first visit uses the language of the browser; the player changes it in Settings, under Language, and the choice is saved. You can also test a language by opening the page with
?lang=jaat the end of the address. - New language: copy
en.jsto a new file, translate it, add it to the listLANGSinsrc/locales/index.js(the code and the name written in that language), and change the number 14 and the list of codes intest/locales.test.mjs. Japanese, Korean and Chinese use the fonts of the device; other alphabets need a font (see section 4).
4. Colours and interface pieces
The buttons, panels, plates, ribbons and sliders are pictures in assets/ui/. The panels, the long buttons and the plates are stretched in the middle and keep their corners (nine-slice pictures): when you replace one, keep its size and its corners. The corner numbers are in the border-image lines of css/base.css and css/panels.css.
| Picture | Size and what it is |
|---|---|
assets/ui/pill-violet.webp, pill-pink.webp (and -down) | 318 x 153, corner 76. The big buttons, normal and pressed. |
assets/ui/plate.webp, band.webp, row.webp | 258 x 129 (corner 60), 342 x 109 (corner 38) and 507 x 128 (corner 58). The plates, the ribbon of a title and the rows of settings. |
assets/ui/panel.webp | 337 x 340, corner 64. The frame of every panel. |
assets/ui/btn-round*.webp, close.webp | About 254 x 261. The round buttons (sound, settings, back) and the close button. |
assets/ui/slider-*.webp, toggle-on.webp, toggle-off.webp | The volume sliders (corner 40) and the switches (312 x 169). |
assets/ui/tile*.webp, world-banner.webp, badge.webp | The level tiles (346 x 274, locked and current), the world banner and the badge of the helps. |
Colours: the first lines of css/base.css define the main colours (--violet, --violet-dk, --pink and --sky), and the colour of the browser bar on a phone is theme-color in index.html. The colour of the light, the ring and the sparkles of each forest friend is catColor in src/config.js.
Fonts: css/base.css loads the font Fredoka (Latin letters) and Nunito (Cyrillic) from fonts/. To use another font, put its files in fonts/, change the @font-face lines and keep its license text in THIRD-PARTY-LICENSES/.
5. Sounds and music
Every effect is an MP3 in assets/sfx/, named <id>-<number>.mp3. The game picks one of the versions at random. Replace a file and keep its name and its format (MP3, mono). The number of versions of each id is in src/audio/sfx-files.js.
| Ids | When they play |
|---|---|
pegar, soltar, voo, pousar | Lifting a forest friend, dropping it, its flight and its landing. |
grupo, entrega, balao-sobe, balao-chega, vitoria, estrela, confete, combo | A complete group, the delivery to the lantern, the lantern rising and arriving, the win, the stars, the confetti and the combos. |
nao, sem-jogadas, dormir, acordar, misterio, neblina, neblina-conta, gelo-trinca, gelo-quebra, gelo-tinido, novelo, curinga, balao-revela | A move that is not allowed, no moves left, forest friends that sleep and wake, and the twists of the worlds (mystery forest friends, bluish mist, ice, flowery vine, rainbow fox, surprise lantern). |
desfazer, embaralhar, nuvem-extra, dica-mao, contagem | The three helps, the pointing hand of the tutorial and the count. |
botao, painel, fechar, tela, chave, destravar | Buttons, panels, changing screen, the locked level and the unlock. |
m-<animal> and v-<animal>-<say>, v-susto, v-feliz, v-nao, v-bocejo, v-ronrom, v-triste, v-tonto, v-coro | The sounds of each forest animal (m-fox-1...), its 5 voice sounds (levantar, voar, pousar, recusar, comemorar: lift, fly, land, refuse and cheer) and the shared reactions. |
Music: assets/music/menu.mp3 is the menu and jogo-1.mp3 to jogo-10.mp3 are the 10 worlds (the link between world and file is FEEL.music.world in src/config.js). Replace a file keeping the name. The notes of some effects follow the key of the music: src/audio/music-meta.js has the key of each track, and if you use a track in another key, set tune: false in FEEL.music or write the new key there.
Ambient sound: assets/amb/amb-w1.mp3 to amb-w10.mp3 loop under each world. The length of each loop, in seconds, is in src/audio/amb-files.js, and every file carries 0.1 second of the same sound before and after the loop. If your new file has another length, write the new loop length there.
Volumes: the player has two sliders, Music and Effects. The forest animal voices and the ambient sound follow Effects. FEEL.mix in src/config.js has the base level of each (master, sfx, music, voice, amb) and groups lowers or raises a whole kind of effect (jogada, marco, mecanica, ui, miado, fala, reacao).
mix: {
master: 0.9,
sfx: 0.85,
music: 0.42,
voice: 0.75,
gap: 0.04,
sfxJitter: 0.03,
voiceJitter: 0.06,
voiceRest: 0.15,
voiceDuck: 0.7,
crossfade: 0.8,
pan: 0.35,
groups: { jogada: 0.55, marco: 1, mecanica: 0.65, ui: 1, miado: 1, fala: 0.45, reacao: 1 },
ids: { 'balao-sobe': 0.45 },
amb: 0.5,
ambFade: 1.5,
merge: 0.12,
maxVoices: 10,
},
To add an effect, put the MP3 in assets/sfx/ as <id>-1.mp3, add its id and its number of versions to SFX_FILES in src/audio/sfx-files.js and play it from the code.
6. Levels
The 100 levels are data: src/game/levels/world-1.js to world-10.js, 10 levels each. A level is one line with its number n, its clouds (the forest friends of each log from the left to the right end, with the extra fields cap for the seats, hid, ice, tie, fog and fogT for the twists), the queue of lanterns (the forest friend each one wants), the qhid positions of surprise lanterns, the par and the sol (a list of moves, [from, to], that solves the level). The forest friends are numbers: the position in CATS in src/config.js, and 16 is the rainbow fox.
{"n":11,"clouds":[{"cats":[5]},{"cats":[5,5,3,0],"hid":[0,1]},{"cats":[3,3,4]},{"cats":[0,0,0],"hid":[0,1]},{"cats":[4,4,4]},{"cats":[5,3],"hid":[0]}],"queue":[4,0,3,5],"par":6,"sol":[[1,3],[2,4],[1,2],[5,2],[0,1],[5,1]]}
Worlds 2 to 10 are made by tools/generate-levels.mjs; their files say so at the top. Run npm run levels to make all of them again, or npm run levels -- 4 for only world 4. The generator shuffles from a solved board, then the real rules and the solver check that the level can be solved, keep the best solution as sol and its length as par.
To change how a world feels, edit its recipe in spec() in tools/generate-levels.mjs: how many kinds of forest friends, the seats of each log, how many shuffles, the range of the par, the chance of hidden forest friends and how many ice, wild, flowery vine or surprise pieces. Then run the generator for that world and npm test.
export function spec(w, i) {
const f = (i - 1) / 5,
g = (i - 7) / 2,
four = (n, more = []) => Array(n).fill(4).concat(more);
if (w === 2) {
if (!i) return { types: 4, caps: four(6), hid: 0.6, k: 7, par: [4, 9], target: 6 };
if (i < 7) {
const t = lerp(5, 6, f);
return {
types: t,
caps: four(t + 1),
hid: 0.3 + 0.25 * f,
k: lerp(20, 45, f),
par: [9, 28],
target: lerp(11, 15, f),
};
}
return { types: 6, groups: 7, caps: four(8), hid: 0.45, k: 50, par: [12, 30], target: lerp(15, 17, g) };
}
// ... the other worlds
}
Do not edit a level by hand in worlds 2 to 10: the generator writes the files again and the test that regenerates them would fail. A level you write yourself must keep n right and a correct par and sol, because the stars and the tests use them.
World 1 is the fixed start of the game, and a test checks its file byte by byte. If you really want to change it, edit the file, run npm test, and replace the value W1_HASH in test/levels.test.mjs with the new one that the failing test prints.
The game is built around 10 worlds of 10 levels. A new world also needs a scenery, a music track, an ambient loop, a name for the map and changes in the code of the map: that is custom work.
7. Helps, stars and rules
Open src/game/rules.js. At the top there is HELPS = { undo: 5, shuffle: 1, extra: 1 }: how many times each help can be used on one level. Change the numbers to give more or fewer. The helps start full on every level.
export const HELPS = { undo: 5, shuffle: 1, extra: 1 };
export function stars(moves, par) {
if (moves <= par * 1.3) return 3;
if (moves <= par * 1.8) return 2;
return 1;
}
The stars come from stars(moves, par) in the same file: up to 1.3 times the par gives 3 stars and up to 1.8 times gives 2. Write other multipliers to make the stars easier or harder. Run npm test: some checks use these limits.
SHOWN = 3 is how many lanterns are shown at a time. The rules (tap, undo, shuffle, addCloud) are pure functions with tests: change them only if you also change the tests and the solver.
8. Feel numbers
Open src/config.js. FEEL has every number that changes how the game feels. The most useful:
| Setting | What it does |
|---|---|
FEEL.liftY, liftTime, flightBase, flightMax, arc | How high a forest friend is lifted, how long it takes, how long a flight lasts and how high its arc is. |
FEEL.squash, squashTime, shakeAmp | The soft squash when a forest friend lands and the shake of a move that is not allowed. |
FEEL.deliverFlight, balloonRise, balloonEnter | The flight of a group to the lantern and how long a lantern takes to rise and to arrive. |
FEEL.combo, land, meowScale | How close in time two deliveries must be to make a combo, and the musical notes the landings and animal sounds climb. |
FEEL.fx | The particles: the most on screen (fewer on touch devices), the sparks of each moment and the confetti of a win. |
FEEL.win, hitstop | The slow motion of the last delivery, how long the lantern celebrates and the short freeze of the image on a complete group. |
FEEL.voice | How often the forest animals make a sound, speak or answer each other, and the minimum time between two sounds. |
FEEL.vibe, FEEL.mix, FEEL.quality | The length of each vibration in milliseconds, the volumes, and when the game lowers its own effects on a slow device. |
The numbers only change how the game looks, sounds and feels. They never change a rule or a level. Change one number at a time and play a level to see it.
9. Reskin: your own forest friends, scenery and logo
A reskin means replacing the art and keeping the code. The rule is simple: replace the picture keeping the file name and the size (or the same proportion). The game finds every picture by its name, so a new picture with a new name is never loaded.
Forest friends: every forest friend has 9 faces, a peek head and 8 poses, all in assets/cats/. Faces: <animal>-<face>.webp with the 9 faces idle, blink, happy, wow, sleepy, worried, dizzy, sad and yawn. Poses: <animal>-p-<pose>.webp with the 8 poses crouch, dangle, leap, fall, curl, stretch, wave and cheer. Peek head: <animal>-peek.webp. That is 18 files for each of the 17 forest animals. Every face and every pose is 256 x 256 pixels with a transparent background and the base of the forest animal at the same height (the bottom at pixel 250 of 256): the faces swap without the body moving. The peek head is a head with a straight cut at the bottom (about 232 to 256 pixels on a side; it shows over the edge of a basket or a panel).
The forest friends are the list CATS at the top of src/config.js: the position of a name in the list is the number of that forest friend in the levels, so keep the order (16 regular forest animals, then the rainbow fox last). To rename a forest friend, rename its 18 files, change the name in CATS and in the lists that follow it, and change the sound ids (m-<animal> and v-<animal>-... in assets/sfx/ and src/audio/sfx-files.js).
export const CATS = ['fox', 'skunk', 'bunny', 'squirrel', 'fawn', 'raccoon', 'bat', 'hedgehog', 'frog', 'bear', 'owl', 'mouse', 'wolf', 'lynx', 'snail', 'ladybug', 'rainbow'];
Where else the names appear: catColor and persona in src/config.js (one entry per forest friend, same order); MEOW_LIKE in src/audio/ids.js (the sound a forest animal falls back to); the forest friends of the menu in index.html (data-cats and data-cat); the forest friends shown in the how to play cards (src/ui/howto.js) and the forest friends of the level map and the world banner (W_CAT and SIT in src/ui/map.js and src/ui/juice.js). Search for the old name in src/ and index.html.
The file assets/cats/poses.json holds, for each forest friend and pose, the box of the body inside the 256 pixel frame (w, h and y): the game uses it to place the pose over the log. If a new pose has another shape, measure it and write the numbers.
Sceneries: assets/bg/w1-p.webp to w10-p.webp (portrait, about 941 x 1672), w1-l.webp to w10-l.webp (landscape, about 1672 x 941) and w1-xl.webp to w10-xl.webp (ultrawide, about 2560 x 1099), one set for each of the 10 worlds, and the same three shapes for the menu: menu-p.webp, menu-l.webp and menu-xl.webp. The game picks the shape that fits the window. Keep the proportions: a different proportion is cropped or stretched. bg-p.webp, bg-l.webp and bg-xl.webp are plain back-up backgrounds shown while a scenery loads. front-bottom.webp, front-left.webp and front-right.webp are the logs in front of the scene.
| File | Size and what it is |
|---|---|
assets/game/cloud.webp, cloud-mini.webp | 848 x 141 the log with 4 seats; 276 x 125 the tiny log. |
assets/game/cloud-2.webp, cloud-3.webp, cloud-5.webp | 436 x 136, 641 x 144 and 1024 x 131: the logs of 2, 3 and 5 seats (world 7). Their proportions are in AR in src/render/layout.js. |
assets/game/balloon-purple.webp, balloon-pink.webp, balloon-mint.webp | About 376 x 640. The three lanterns. The white disc where the wanted forest friend is drawn is in FEEL.balloonDisc in src/config.js: if you change the lantern, measure the centre and the radius of the disc and write the numbers. |
assets/game/balloon-q.webp, balloon-far.webp, win-balloon.webp, basket.webp | 252 x 256 the surprise lantern; 158 x 235 the far lantern in the distance; 684 x 1000 the lantern of the win panel; 284 x 207 the basket. |
assets/game/ice.webp, ice-crack.webp, fog.webp, mystery.webp, yarn-tie.webp, yarn-snap.webp | 512 x 380 (ice and its crack), 463 x 249 (bluish mist), 264 x 264 (the "?" forest friend), 384 x 127 and 384 x 104 (the flowery vine and its break). |
assets/ui/logo.webp | 1024 x 527, transparent background. It shows on the loading screen, the start screen and the menu. Also change the alt text in index.html. |
assets/ui/icon-32.png, assets/ui/icon-180.png | 32 x 32 and 180 x 180 pixels, PNG. The icon of the browser tab and the icon of a phone home screen (index.html has the two lines that use them). There is no web manifest. |
assets/icons/*.webp | About 190 x 170 pixels each: sound, music, gear, pause, play, undo, shuffle, extra log, home, language, vibration, full screen, hand, check, lock, arrows and replay. |
assets/fx/*.webp | The sparkles, glows, hearts, stars, confetti, ice shards, puffs and the small things that float in each world (amb-*.webp). Replace them keeping the names; they are moved and tinted by the code, never redrawn. |
Also change in a reskin: the name of the game (<title> in index.html, title in every file of src/locales/ and the matching line in test/locales.test.mjs), the colours (section 4), the icons above, the save names (section 10) and the texts that name the forest friends or the logs. The sounds follow the same rule: same name, same format (section 5).
- Replace the pictures keeping names and sizes.
- Reload with Ctrl+F5 and look at the menu, the level map and one level of each world.
- Run
npm test: it checks that every picture, sound and text that the game asks for exists. - Clear the cache of your host or CDN when you publish (see the buyer guide).
10. The save and starting over
The progress stays in the browser of each player, under two keys: mushroom-glade-save (unlocked level, current level, stars) and mushroom-glade-prefs (language, volumes, Reduce motion, Vibration, Tips), both in src/lib/storage.js. If you publish a very different version of the game, change both names so old saves do not mix with the new one.
To start over, delete these keys in the developer tools (F12), under Application, Local Storage, or clear the site data of the browser.
11. Publish your version
- In
source/, runnpm test. When it passes, your version is consistent. - Back up the game on your website, then upload the files
index.html,css/,fonts/,src/andassets/ofsource/in place of the old files. - Keep the folders as they are. Do not upload
test/,tools/,package.jsonor the documentation. - Clear the browser cache to see the new version (see the buyer guide).
Support: willian@polargames.com.br