Deckwood: Card Battle: Customization Guide

Step-by-step changes for people who do not program. Everything works with a free text editor.

1. Before you start

  1. Make a copy of the whole download. If something goes wrong, you can go back to it.
  2. 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.
  3. Work inside source/. To see your changes, open a terminal in that folder and run npm run dev, then open http://localhost:5180/. The game does not run by double-clicking index.html, because browsers block JavaScript modules on file://.
  4. No terminal? Edit the files of game/ directly, upload them to your host and reload the page.

2. What to edit for what

Main menu of the game

Work inside source/. This table says where each part of the game lives. Change one thing at a time and look at the result in the browser.

You want to change Edit
A card: cost, attack, life, ability, family data/cards.js
The campaign: opponent life and level, terrains, boss powers, difficulty, challenges, prizes data/campaign.js
The numbers of the rules: life, deck size, hand size, acorns RULES at the top of src/game/rules.js
The starting cards STARTER in src/game/campaign.js
Every text and every language src/lib/locales/<code>.js
Pictures: cards, bosses, maps, tables, card backs, logo The files in assets/ (same name, similar size)
Sounds and music assets/audio/ and the lists in src/audio/audio.js and src/config.js
Speeds, times and sizes of the animations FEEL in src/config.js
Colors and fonts css/base.css
The name in the browser tab and the page icon index.html
The name of the save in the browser GAME.save in src/config.js

3. Change a card (cost, attack, life, ability)

The deck builder with cards of one family

Open data/cards.js. Every card is one line. This is a critter of the Forest family:

{ id: 'shellby', name: 'Shellby', fam: 'forest', type: 'creature', cost: 2, atk: 1, hp: 4, ab: 'shield' }

Change the numbers after cost, atk (attack) and hp (life). The cost goes from 1 to 8 acorns. ab is the ability or null: shield, cheer, thorn, heal, fly, double, grow, taunt or gasp (Last Breath). A critter has at most one ability.

Do not change the id of a card: the picture is named after it and the save of a player keeps it. Change name to rename a critter (the name is the same in every language). A trick has fx instead of attack and life: a list of effects such as { k: 'dmg', n: 2 } (2 damage to an enemy critter). The comments at the top of the file list every effect.

Save the file, reload the page and open the Album: the card shows its new numbers. Then run npm test. A few checks play real cards and compare with the numbers of the original ones, for example the check called "shield swallows the first blow only" expects Shellby to have 4 life. If npm test names a check after your change, that check still expects the old number: open tests/rules.test.mjs, find the card name and write the new number.

4. Add a new card

A family has 12 cards (9 critters and 3 tricks, or the mix you choose) and the campaign hands them out one by one, family by family, in the order of the list. To keep the balance, replace a card you do not need. To make a 61st card, follow these steps:

  1. Add a line to data/cards.js, inside the family it belongs to (the order of the list is the order of the prizes). Pick a new id with small letters only.
  2. Add the picture assets/cards/<id>.webp: 512 x 512 pixels, WebP with a transparent background, the critter centered. The frame, the cost and the numbers are drawn by the game.
  3. A trick also needs its name in every language file of src/lib/locales/: the key c_<id>. A critter has its name in name.
  4. Run npm test. Two checks count the cards on purpose: "60 cards, 12 per family, unique ids" and "the 48 prizes cover every card outside the starter". In tests/rules.test.mjs change the 60 to your new total (it appears 3 times) and, in the first check, the 12 of the family that got the new card. A new card of the Forest family joins the starting cards by itself; a card of any other family becomes one more prize (also change the 48 to your number of prizes). Then play: the new card appears in the Album.

Limits: a deck is exactly 20 cards, with at most 2 copies of one card. The hand holds 7 cards. A card cost above 8 can never be played.

5. Swap the picture of a card

A card with its picture and frame

The picture of a card is assets/cards/<id>.webp. Make a new picture of 512 x 512 pixels with a transparent background (the critter alone, with a little margin), export it as WebP with the same file name, and replace the old file.

The frame, the family medal and the numbers are separate pictures (assets/ui/frame-<family>.webp), so one picture works for every frame. The same picture is the face of the opponent on the map and in the duel when that critter is the rival. To check it, open the Album and then play a duel against it.

6. Change a boss

The story screen before a boss duel

Each world ends with a boss: moss, croak, marola, frost and caw. Their pictures are in assets/chars/ (<boss>-idle, -taunt, -angry, -nervous and five faces -face-neutral, -face-happy, -face-hurt, -face-angry, -face-sad, 320 x 320) and in assets/screens/ (<boss>-bow and <boss>-wave). Replace them with the same names. The poses are about 1000 x 900 pixels with a transparent background.

The name is the text b_<boss> and the line of the power is bp_<boss> and bp_<boss>_d in every language file. The power itself is in data/campaign.js, in bossPowers. This is the power of Baron Caw:

bossPowers: {
  // ...
  caw: { k: 'hit', n: 2, every: 3 },
  // ...
},

k is the kind of power: tough (his critters get +n life), heal (his hero heals n), blast (n damage to each of your critters), freeze (your strongest critter freezes) or hit (n damage to your hero). every is the number of his turns between uses. Change n or every, and also change the numbers written in the texts of the power.

The life and level of a boss are the last column of the tables hp and level of the same file (see the next section). If you change a power, the check called "boss powers: every 3 turns of the boss, at the start of its turn" in tests/rules.test.mjs still expects the old numbers: write the new ones there.

7. Worlds, duels, life, difficulty, terrains and challenges

The map of a world

Everything about the campaign is in data/campaign.js, and every field has a comment. The most useful ones:

Field What it does
hp The life of the opponent, one row per world and one column per duel (the last column is the boss), at Normal. This is how you make a duel easier or harder.
level How well the computer plays: 1 easy, 2 normal, 3 boss (halves are allowed).
terrain One terrain per world, on one lane of the table: mud (-1 attack), sand (nobody flies), ice (arrives frozen), spark (+1 attack) or null.
bossPowers The power of each boss (see section 6).
difficulty Easy, Normal and Hard: they multiply the opponent life (hp), change its level, and Hard gives a crown.
lifeStar, challenges, lostMax, turnsDiv, turnsAdd, powerTimes The stars: how much life you must keep for the second star, which challenges exist for the third star and how strict each one is.
daily and arena The life and level of the Daily Challenge, and how the Arena grows and heals you between duels.
milestones The total stars that unlock a golden frame.

The player life is 20 and it is written in three places: hp in RULES (src/game/rules.js), playerHp in GAME (src/config.js) and the number 20 in the line const me = duel.meHp || 20; of src/battle/view.js (the life shown when a duel opens). Change the three to the same number. The names of the worlds are the texts world_0 to world_4. After a change, play the duel you changed and run npm test: it plays the 40 duels with an automatic player and checks that every opponent deck is legal.

8. The starting deck

The player starts with the 12 cards of the Forest family, 2 copies of each. This is the line in src/game/campaign.js:

export const STARTER = Object.fromEntries(CARDS.filter((c) => c.fam === 'forest').map((c) => [c.id, 2]));

The player starts with all the cards of the family you name here and wins every card of the other families as a prize. So do not just change the word 'forest': the prizes skip the Forest family (see prizeOrder in the same file). The safe change is to add extra cards to the start. Put the card and the number of copies in front, like this:

export const STARTER = { dewdrop: 1, ...Object.fromEntries(CARDS.filter((c) => c.fam === 'forest').map((c) => [c.id, 2])) };

Here the player also starts with 1 copy of Dewdrop. A deck needs 20 cards, so keep the 12 Forest cards at 2 copies each (with fewer copies the starting deck cannot be built). Players who already have a save keep their old cards.

9. Texts and languages

The language list

10. Logo, name, colors and fonts

The title with the logo

11. Sounds and music

Every effect is an MP3 in assets/audio/. Replace a file and keep its name.

Files When they play
ui-tap, ui-open, ui-close, toggle, nope Buttons, panels, switches and a refused play.
card-draw, card-pick, card-back, deal, flip, shuffle Drawing, picking up, putting back and dealing cards.
summon, summon-big, hit, hit-big, hero-hit, die A critter arriving, the blows and a critter falling.
heal, buff, cheer, freeze, thaw, shield-break, thorn Abilities and tricks.
boss-moss, boss-croak, boss-marola, boss-frost, boss-caw The little tune of each boss when it arrives.
win, lose, star, reward, confetti The end of a duel and the stars.
m-menu, m-battle, m-battle-b, m-menu-b, m-boss The 5 music tracks: the menu and the map, three for the duels and one for the bosses.

To add a sound, put the MP3 in the folder and add its name to SFX in src/audio/audio.js. The levels and the minimum time between repeats of each sound are gains and gap in src/config.js. The music of each duel is chosen from duelTracks in the same file.

12. Feel numbers

A duel

Open src/config.js. FEEL has every number that changes how the game feels. The most useful:

Setting What it does
FEEL.speed and FEEL.fast The speed of all the duel animations (1.12), and how much faster the Fast duels option is (1.6). Raise speed for a quicker game.
FEEL.card How long a card takes to be drawn, to fly, to be picked up and to return, and how much the hand opens.
FEEL.attack The pause between lanes, the lunge of a critter and the freeze of the screen (hit stop) on a heavy blow.
FEEL.turn How long the turn banner shows and how long the rival thinks before it plays.
FEEL.shake and FEEL.hero How much the screen and the heroes shake on a hit.
FEEL.particles The most particles on screen (fewer on touch devices).
FEEL.audio The master volume, the music level and how the music ducks, the maximum number of sounds at once.

13. Story pictures and the thank-you page

A page of a story

The short stories that open worlds 2 to 5 use 2 pictures each: assets/story/story-<family>-1.webp and story-<family>-2.webp (1024 x 1024). Their texts are the keys ws_<family>_1 and ws_<family>_2, and the title is world_<n>.

After the last boss a final scene shows assets/story/final.webp with the text final1 under the title finalTitle, then a thank-you page with the texts thanks and madeWith. Change those texts in every language, or put your own studio name in madeWith. The game does not show any studio name by itself.

14. Card backs and tables

The Style screen

The classic card back is assets/ui/card-back.webp, and the back of each world is assets/ui/back-<family>.webp plus back-champion.webp (720 x 1008 pixels). The tables are assets/bg/table-<family>.webp (1600 x 1600, no transparency). Replace the files with the same names.

The player unlocks a back and a table by beating each boss, and the champion back by finishing the campaign. The rule is in unlocks in src/app/store.js. The golden frames come from perfect worlds and from the star milestones.

15. The save and starting over

The progress stays in the browser of each player, as one object under the key deckwood.v1 (GAME.save in src/config.js). If you publish a very different version of the game, change that name so old saves do not mix with the new one.

To start over, delete this key in the developer tools (F12), under Application, Local Storage, or clear the site data of the browser.

16. Publish your version

  1. In source/, run npm test and npm run build. This writes source/dist/.
  2. Back up the game on your website, then upload the contents of dist/ in place of the old files.
  3. Keep the folders as they are. If you added a new file or folder next to index.html, add its name to PARTS in source/tools/build.mjs.
  4. Clear the browser cache to see the new version (see the buyer guide).

Support: willian@polargames.com.br