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 dev, then open the address it prints. The game does not run by double-clickingindex.html, because browsers block JavaScript modules onfile://. -
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 in the browser.
| You want to change | Edit |
|---|---|
| The pace, the card flights, the particles and the other feel numbers | FEEL in src/config.js |
| The sound mix | AUDIO in src/config.js |
| The names of the characters and how they bluff | PEOPLE in src/ui/cast.js |
| The faces of the characters | assets/img/avatars/ |
| The rivals and the level of each Circuit table, the matches per table | TABLES and MATCHES_PER_TABLE in src/ui/cast.js |
| The 3 stars of a match | starsFor in src/ui/screens.js |
| Which house rules start on |
houseRules in src/ui/panels.js and DEFAULT_HOUSE in
src/game/rules.js
|
| The value of a hand and of the raises (Paulista, Mineiro) | SCALES in src/game/rules.js |
| The rules and the computer players | src/game/ |
| Every text and every language | src/lib/locales/ and src/lib/locales.js |
| The voice lines | assets/audio/voz/ and LINES in src/audio/voice.js |
| The sound effects and the music |
assets/sfx/, assets/music/ and SFX_IDS in
src/audio/sfx.js
|
| The backgrounds of the title, the menu, the tables and the Circuit | assets/img/bg/ |
| The cards, buttons, panels and the trophy | assets/img/cards/ and assets/img/ui/ |
| Logo, name and colours |
assets/img/logo.webp, index.html, src/lib/locales/,
css/base.css
|
| The name of the save in the browser | STORAGE_PREFIX in src/config.js |
3. Change a feel number
Open src/config.js. FEEL holds every time (in milliseconds) and every effect number
of the game. These are some of the most useful:
// src/config.js, inside FEEL fastFactor: 0.55, thinkMin: 900, // ms a rival or the partner "thinks" (turn ring on) before acting thinkMax: 1400, afterPlay: 650, // pause after each card lands, before the next player acts trickHold: 1500, // the finished trick stays on the table, winner lifted and glowing, the others dimmed handGap: 1200, // end of a hand: the table stays before the note and the next deal confetti: 90, confettiPhone: 60, maxParts: 260, // living particles at most maxPartsPhone: 140,
thinkMin and thinkMax are how long a computer player thinks before it acts,
afterPlay is the pause after each card, trickHold is how long a finished trick stays
on the table and handGap is the pause at the end of a hand. Change one number at a time, save,
and play a hand to see it.
fastFactor (0.55) multiplies these times when the player turns on Fast game in Settings: a
smaller number makes Fast game quicker. confetti and confettiPhone are the pieces of
confetti of a win, and maxParts and maxPartsPhone are the most particles on screen
at once (on a computer and on a phone).
The numbers of FEEL only change how the game looks and feels. They never change a rule, a card or
a score.
4. Rename a character and change its faces
The 11 characters are PEOPLE in src/ui/cast.js. Each line has an id (the key in
front, for example zeca), the name shown on screen and a persona for the computer:
bluff (how often it bluffs) and bold (how boldly it calls and accepts), both from 0
to 1:
// src/ui/cast.js
export const PEOPLE = {
nena: { name: 'Dona Nena', persona: { bluff: 0.3, bold: 0.5 } },
zeca: { name: 'Zeca', persona: { bluff: 0.5, bold: 0.6 } },
tico: { name: 'Tico', persona: { bluff: 0.2, bold: 0.3 } },
bira: { name: 'Bira', persona: { bluff: 0.7, bold: 0.6 } },
lola: { name: 'Lola', persona: { bluff: 0.4, bold: 0.7 } },
kadu: { name: 'Kadu', persona: { bluff: 0.6, bold: 0.8 } },
'tia-cida': { name: 'Tia Cida', persona: { bluff: 0.3, bold: 0.4 } },
'seu-juca': { name: 'Seu Juca', persona: { bluff: 0.5, bold: 0.5 } },
'vo-zuleica': { name: 'Vó Zuleica', persona: { bluff: 0.8, bold: 0.4 } },
doutor: { name: 'Doutor', persona: { bluff: 0.6, bold: 0.7 } },
'madame-zap': { name: 'Madame Zap', persona: { bluff: 0.9, bold: 0.8 } },
};
export const PARTNER = 'nena';
To rename a character, change only name and save. The name is not translated: it appears on the
table, on the Circuit and when the cards are revealed. Keep the id, because it names the face pictures and the
voice folders.
Faces: every character has 4 pictures in assets/img/avatars/:
<id>-idle.webp (calm), <id>-cocky.webp (confident),
<id>-nervous.webp and <id>-cheer.webp (celebrating). They are WebP with
a transparent background, 480 x 480 pixels (Dona Nena 480 x 528). Draw the 4 faces on the same canvas with the
head in the same place, and replace the files keeping their names.
Dona Nena is your partner (PARTNER). Her cheering face is also on the Champions screen, and the
end of a match uses three more pictures in assets/img/fim/: dupla.webp (you and your
partner win), bico.webp (she pouts after a loss) and jogador.webp (a 1 vs 1 win).
5. The rivals and the level of a table
The Circuit is TABLES in src/ui/cast.js: one line per table, with its number
n, the ids of its two rivals and the level of the computer (easy,
normal or hard):
// src/ui/cast.js
export const TABLES = [
{ n: 1, rivals: ['zeca', 'tico'], level: 'easy' },
{ n: 2, rivals: ['bira', 'lola'], level: 'easy' },
{ n: 3, rivals: ['kadu', 'tia-cida'], level: 'normal' },
{ n: 4, rivals: ['seu-juca', 'vo-zuleica'], level: 'normal' },
{ n: 5, rivals: ['doutor', 'madame-zap'], level: 'hard' },
];
export const MATCHES_PER_TABLE = 10;
To change who plays at a table, put two other ids of PEOPLE in rivals. To make the
table easier or harder, change level. Quick Match always uses the rivals of table 1, with the
level chosen by the player; in 1 vs 1 the rival is the first one of the pair.
Each table has its own place: its name is the text key table_1 to table_5 in the
language files, and its pictures are the backgrounds of that place (section 13). Keep 5 tables: a 6th one
would also need its own backgrounds, its own text and a new entry in
PLACES (src/ui/scenery.js).
6. The number of matches per table
MATCHES_PER_TABLE (10), at the end of the same block, is the number of matches of every table.
The Circuit shows them in a grid of 5 columns, the last match of a table opens the next table, and the total
of stars (3 per match) is counted from it.
Use a multiple of 5, so the rows stay full: 5 gives one row and 10 gives two. With more rows, look at the Circuit in a phone-sized window to check that it still fits. A player who already played keeps the stars of the matches that still exist.
7. The rule of the stars
The stars of a Circuit match are starsFor in src/ui/screens.js:
// src/ui/screens.js
export function starsFor(won, stats) {
if (!won) return 0;
return 1 + (stats.ran ? 0 : 1) + (stats.behind >= 4 ? 1 : 0);
}
A win gives 1 star, plus 1 when your team never folded during the match (stats.ran), plus 1 when
you won after being 4 or more points behind (stats.behind). A loss gives 0. To make the third
star easier, change 4 to 3. Keep the result between 0 and 3: the result panel and
the Circuit draw 3 stars.
The stars are saved for each match, and only a better result replaces them. Quick Match gives no stars.
8. Which house rules start on
For a new player the three house rules start on. The first values come from houseRules in
src/ui/panels.js:
// src/ui/panels.js
export const houseRules = () => ({ covered: true, eleven: true, ironHand: true, ...load('rules', {}) });
Change true to false for a rule that should start off: covered is
Face-down cards, eleven is Hand of eleven and ironHand is Iron hand. The player can
still switch each one in Quick Match > House rules, and that choice is saved (a player who already chose
keeps it). The same house rules are used in the Circuit.
DEFAULT_HOUSE in src/game/rules.js holds two more settings, used in every match:
// src/game/rules.js
export const DEFAULT_HOUSE = { covered: true, eleven: true, ironHand: true, tieAll: 'nobody', scale: null };
tieAll decides a hand whose three tricks are all tied: with nobody (the default)
nobody scores, with mao the team of the player who played first in that hand takes it.
scale: null keeps the normal values of each style (next section). The names of the rules shown to
the player are the text keys rule_covered, rule_eleven and
rule_ironHand.
9. Paulista and Mineiro values
The value of a hand and of each raise is SCALES in src/game/rules.js:
// src/game/rules.js
export const SCALES = {
paulista: { base: 1, raises: [3, 6, 9, 12] },
mineiro: { base: 2, raises: [4, 6, 10, 12] },
};
base is what a hand is worth with no call, and raises are the values of the calls,
in order. The first call is always TRUCO; the next ones are named after their value (the text keys
num_4, num_6, num_9, num_10 and num_12). The
hand of eleven is played for the first raise, and folding it gives the base. For example, to play Paulista
with the Mineiro values, copy the mineiro line into paulista.
Every value must be bigger than the one before it. A value with no text key shows only its number, and the
voices only have lines for 6, 9, 10 and 12. A match loads in advance only the lines of its own style (readyVoices
in src/audio/voice.js leaves out dez in Paulista and nove in Mineiro),
so when you mix the values of the two styles, change that line too. The How to Play pages describe the normal
values (help4 and help6), so change those texts too. The Circuit is always played in
Paulista, and a match goes to 12 points.
10. Texts and languages
-
Every text is in
src/lib/locales/, one file per language (en.js,pt.js,es.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. -
The names of the characters are not texts (they are in
src/ui/cast.js), so they are the same in every language. The voices are Portuguese for the Portuguese interface and English for every other language. -
The language comes from
?lang=at the end of the address (for example?lang=ja), then from the saved choice, then from the browser, and finally English. The player changes it in Settings > Language. -
New language: copy
en.jsto a new file and translate it, then insrc/lib/locales.jsimport it and add its code toLANGS, its own name toLANG_NAMESand the import toSTRINGS. It will use the English voices. Japanese, Korean and Chinese use the fonts of the device; other alphabets need a font (see section 14).
// src/lib/locales.js export const LANGS = ['en', 'pt', 'es', 'fr', 'de', 'it', 'nl', 'pl', 'tr', 'ru', 'id', 'ja', 'ko', 'zh'];
11. Replace or remove a voice line
The voice lines are MP3 files in assets/audio/voz/pedidos/<id>/ (Portuguese) and
assets/audio/voz/pedidos-en/<id>/ (English), one folder per character. To replace a line,
record a new MP3 and save it with the same name in the same folder.
| File | When it plays |
|---|---|
truco |
The first call of a hand (always the Portuguese file). |
seis, nove, dez, doze |
The raises to 6, 9, 10 and 12 (nove only in Paulista, dez only in Mineiro).
|
aceito |
Accepting a call, or playing a hand of eleven. |
corro |
Folding. |
ganhei-mao, perdi-mao |
Sometimes, at the end of a hand: the winning side says ganhei-mao; in 1 vs 1, a rival who
lost the hand says perdi-mao.
|
provoca |
Sometimes, when a rival wins a trick. |
vitoria |
The end of a match, said by the winning side. |
Your own calls and answers are said with the voice of your partner, Dona Nena, also in 1 vs 1. How often the
optional lines play is in FEEL: tauntChance (0.3) for the tease and
handTalkChance (0.45) for the end of a hand.
To silence one line for everybody, open src/audio/voice.js and remove the from part
of that line in LINES, for example provoca: { rank: 1 },. A line without
from is never played and its files are not loaded. Players can also turn all the voices off in
Settings > Voices.
// src/audio/voice.js
const LINES = {
truco: { rank: 4, from: { pt: 'pedidos', en: 'pedidos' } }, // the same word, the same shout, in every language
seis: { rank: 4, from: BOTH },
nove: { rank: 4, from: BOTH },
dez: { rank: 4, from: BOTH },
doze: { rank: 4, from: BOTH },
aceito: { rank: 4, from: BOTH }, // an answer is never lost under the tail of the request: it cuts it
corro: { rank: 4, from: BOTH },
vitoria: { rank: 3, from: BOTH },
'ganhei-mao': { rank: 2, from: BOTH },
'perdi-mao': { rank: 2, from: BOTH },
provoca: { rank: 1, from: BOTH },
};
12. Replace a sound effect or a music track
The sound effects are MP3 files in assets/sfx/, listed in SFX_IDS in
src/audio/sfx.js. Replace a file and keep its name. These are the ones the game plays:
// src/audio/sfx.js export const SFX_IDS = [
| Files | When they play |
|---|---|
click |
Buttons, panels and switches. |
pick |
Choosing a card, Cover, Signal and See the cards. |
nope |
Something that is not possible now (a locked match, Cover in the 1st trick), and a fold. |
playOpp |
A trick taken by the rivals, and cards that leave the table. |
pop, stack |
The turned card, the calls and the raises. |
star |
A trick taken by your team, a trump on the table, the stars of the result. |
win, lose |
A hand or a match won or lost. |
play |
Your own card landing on the table. |
deal |
The start of each deal. |
unlock |
A new table of the Circuit opening. |
A card landing on the table (besides play), the rising notes and the soft whoosh between screens
are made by the code in sfx.js. To add an effect, put the MP3 in assets/sfx/, add
its name to SFX_IDS and play it from the code with sfx('name').
The level of all the effects is AUDIO.sfx in src/config.js, and the level of the
voices is AUDIO.voice. The player sets the Effects volume in the Sound panel, and the voices
follow it.
Music: assets/music/menu.mp3 plays on the menu, the Circuit and the Quick Match setup, and
assets/music/mesa.mp3 at the table. To replace a track, save your MP3 with the same name. It
loops by itself with a 2.5-second crossfade at the seam, so a track whose end matches its start loops best. To
change which track plays where, or to play no music, edit this line of src/main.js (null
means no music):
// src/main.js setMusic(name === 'table' ? 'mesa' : 'menu'); // one loop for the menus, a quieter one at the table (it starts on the first tap)
The music level is AUDIO.music (0.45) in src/config.js, and
AUDIO.duck (0.35) is how low the music goes while somebody speaks. The player sets the Music
volume in the Sound panel; the music starts only after the first tap.
13. Replace a background
The backgrounds are WebP pictures in assets/img/bg/. Replace a file with another of the same name
and the same size:
| Files | Where they show |
|---|---|
inicio-deitado-*, inicio-pe-* |
The title screen, and the menu on wide windows. |
menu-pe-* |
The menu on tall windows. |
jogo-deitado-*, jogo-pe-* |
The table of the Corner Boteco (table 1 and Quick Match). |
jogo-<place>-deitado-*, jogo-<place>-pe-* |
The table of the other places: noite (Night Bar), praia (Beach Kiosk),
feira (Street Fair) and laje (Rooftop).
|
circuito-<place>-deitado, circuito-<place>-pe |
The Circuit screen of each of the 5 places (1672 x 941 and 941 x 1672 pixels), with
boteco too.
|
deitado is for wide windows and pe for tall ones. The title, menu and table pictures
come in two shapes, wide and tall, so one of them always covers the window: keep the
sizes of the originals (for example jogo-deitado-wide.webp is 5040 x 941 and
jogo-deitado-tall.webp is 1672 x 1672). The table is painted in the same pixels in every table
picture, because the cards are laid over it; where the stage sits inside each picture is written in
src/ui/scenes.js.
The lit bulbs of the tables are drawn at the points of BULBS in src/ui/scenery.js,
in pixels of each picture. If your new picture has its lamps elsewhere, change those points or empty that
list. The snacks on the table are assets/img/mesa/coxinha.webp, suco.webp and
amendoim.webp.
14. Logo, name and colours
-
The name in the browser tab is the
titletext of each language file (src/lib/locales/<code>.js), written by the game when it starts. Also change the<title>line ofindex.html, which shows while the page loads, and thealtof the logo in the same file. The colour of the browser bar on phones istheme-colorinindex.html. -
The logo is
assets/img/logo.webp(1000 x 482 pixels, transparent background), shown on the title and on the menu. Save yours at the same size. -
Colours: the first lines of
css/base.cssdefine the main colours (--navy,--teal,--orange,--yellow,--magentaand their darker-dversions). The buttons, bands, panels and tiles are pictures inassets/img/ui/(btn-*.webp,band-*.webp,panel.webp,tile-*.webp), so to change their look you replace the pictures. The text on them is live text, so the same button works in every language. -
Cards: the court cards are
assets/img/cards/J-red.webp,Q-red.webp,K-red.webpand the same names with-black. The number cards are drawn by the code with the suit picturesassets/img/ui/suit-c.webp,suit-h.webp,suit-s.webpandsuit-d.webp(plus a white-wset for dark backgrounds). The back of the cards isassets/img/ui/back.webp. -
Font:
css/base.cssloads Fredoka fromassets/fonts/(SIL Open Font License). To use another font, put its WOFF2 files in that folder, point thesrcof the@font-facelines to them, and keep its license text inTHIRD-PARTY-LICENSES/.
15. The save prefix and starting over
The progress stays in the browser of each player, under names that start with
trucoshowdown: (STORAGE_PREFIX in src/config.js), for example
trucoshowdown:circuit for the stars. If you publish another game made from this one, or two
versions on the same domain, change the prefix so the saves do not mix. A new prefix starts with fresh
progress for everybody.
To start over, delete these keys in the developer tools (F12), under Application, Local Storage, or clear the site data in the browser.
16. Publish your version, also in a subfolder
-
In
source/, runnpm testandnpm run build. This writessource/dist/. -
Back up the game on your website, then upload the contents of
dist/in place of the old files. -
Keep the folders as they are. The game works in any folder of your site, also in a subfolder such as
https://your-domain.example/games/truco-showdown/, because every address inside it is relative. - If you deleted or renamed a file, delete the old one on the server too.
- Clear the browser cache to see the new version (see the buyer guide).
Support: willian@polargames.com.br