Mahjong Treasure Quest 1.0.0: customization guide Full buyer guide: English Português Español willian@polargames.com.br

Customize Mahjong Treasure Quest without programming

Step-by-step recipes: pictures, octopus, tiles, logo, texts, difficulty, helpers and coins, sounds, colors, font. Works offline, no JavaScript needed.

Level screen with numbered parts 1 2 3 4 5 6 7 8 9 10
Level screen. 1 level plaque and 2 coin plaque: CSS (.topbar.game-hud .pill), coin icon coin.png. 3, 4, 7, 8, 9 round buttons: ui-icons.png. 5 tiles: icons-1.png (world 2). 6 tray: tray.png. 10 octopus: feliz.png (triste.png when the tray is almost full). Background: world-1.png.

1. Before you start

This guide is for people who do not program. Every change is made in the source/ folder and then copied to game/ with one command (or by copying the files yourself). Keep the folder structure and the file names.

Português: este é o guia de personalização passo a passo (em inglês). Cada receita diz o arquivo exato e o tamanho da imagem. O guia completo em português está em pt.html. Español: esta es la guía de personalización paso a paso (en inglés); la guía completa en español está en es.html.

Free tools

Make a backup first

  1. Copy the whole downloaded folder (or keep the ZIP) before you change anything.
  2. Change one thing at a time and check the game after each change.

See your changes on your computer

  1. Open a terminal inside source/ (see DOCUMENTATION.html, Editable project).
  2. Run npm run serve and open http://localhost:8080/ in the browser.
  3. After each change, reload the page with Ctrl+F5 (Cmd+Shift+R on macOS).
  4. Without Node.js you can use any local web server; double-clicking index.html does not work (browsers block it).

2. Where everything is

Each row is a part of the screen and the file that draws it. Pictures are PNG files with transparency where noted. Keep the same size in pixels (or the same proportions) so the layout stays right.

Menu (start screen)

Part of the screen File (inside source/) Size
Background, landscape (wide screens) / portrait (phones held upright) assets/treasure/world-0.png / portrait-0.png 2172 x 724 / 941 x 1672
Game logo (menu, map) assets/treasure/logo.png 1536 x 1024, transparent
Octopus on the menu assets/treasure/feliz.png 1310 x 1200, transparent
Play button and other big teal buttons assets/treasure/button.png 2172 x 724, transparent
Round buttons (sound, settings, arrows, helpers, coin) assets/treasure/ui-icons.png 1448 x 1086 sheet: 4 columns x 3 rows

Level maps (one per world)

Part of the screen File (inside source/) Size
World 1 Tropical Island, landscape / portrait assets/treasure/world-0.png / portrait-0.png 2172 x 724 / 941 x 1672
World 2 Sunken Ship, landscape / portrait assets/treasure/world-1.png / portrait-1.png same sizes
World 3 Sunken Temple, landscape / portrait assets/treasure/world-2.png / portrait-2.png same sizes
World 4 Treasure Cave, landscape / portrait assets/treasure/world-3.png / portrait-3.png same sizes
Level stops: open / locked / padlock assets/treasure/level-open.png / level-locked.png / assets/ui-kit/lock.png transparent
Stars under each finished level assets/ui-kit/star.png 1312 x 1199, transparent
Sparkles around the current level assets/ui-kit/spark.png transparent
Positions of the 15 stops on the map source/src/app/data.js (STOP_POS, MAP_LAYOUT) percent of the map picture

Level screen (gameplay)

Part of the screen File (inside source/) Size
Background of world 1 / 2 / 3 / 4, landscape assets/treasure/world-0.png / world-1.png / world-2.png / world-3.png 2172 x 724
Background of each world, portrait assets/treasure/portrait-0.png ... portrait-3.png 941 x 1672
Tile pictures of world 1 / 2 / 3 / 4 assets/treasure/icons-0.png / icons-1.png / icons-2.png / icons-3.png 1448 x 1086 sheet: 4 x 3 cells of 362 x 362
Tray (7 slots) assets/treasure/tray.png 2172 x 724, transparent
Level and coin plaques at the top (teal with a gold border) CSS: html body .topbar.game-hud .pill in source/css/04-overrides.css no picture
Octopus: happy (menu, map, level) / victory / sad assets/treasure/feliz.png / vitoria.png / triste.png about 1300 x 1200, transparent
Tutorial hand assets/treasure/hand.png 1536 x 1024, transparent
Coin (counter, coin trail, win window) assets/treasure/coin.png 1536 x 1024, transparent
Helper labels and count badges assets/ui/plaquinha.webp / assets/ui/selo-verde.webp small, transparent

Windows (pause, settings, win, lose)

Part of the screen File (inside source/) Size
Frame of the Settings and Pause windows assets/treasure/panel.png 1448 x 1086, transparent
Lanterns on the Pause window assets/treasure/lantern.png 1086 x 1448, transparent
Frame of the win window / lose window assets/treasure/win-frame.png / lose-frame.png about 1320 x 1190, transparent
Buttons inside windows assets/treasure/button.png 2172 x 724, transparent
Stars on the win window assets/treasure/star.png 1283 x 1226, transparent
Treasure chest on the win window (opens and drops coins) assets/treasure/icons-0.png (top-right cell, the chest tile) + assets/treasure/coin.png; animation: .chest-art in source/css/04-overrides.css cell of 362 x 362

3. Recipe A: replace a picture (any background, button or decoration)

  1. Find the part of the screen in the table above and note the file name, for example assets/treasure/world-1.png.
  2. Open that file in Photopea (File > Open). Paint over it or paste your own picture into the same canvas, so the size in pixels stays the same.
  3. Keep the transparent areas transparent (buttons, octopus, tiles, tray). Backgrounds have no transparency.
  4. Export as PNG with exactly the same file name (File > Export as > PNG) and save it over the old file in source/assets/treasure/.
  5. Optional: make the file smaller with Squoosh (OxiPNG), keeping the same size in pixels.
  6. Reload the game (Ctrl+F5). Check the landscape and the portrait version of the screen (resize the browser window or use the phone mode of the browser, F12).

4. Recipe B: change the logo and the game name

  1. Logo picture: replace assets/treasure/logo.png (1536 x 1024, transparent) as in Recipe A. It appears on the menu and on the map.
  2. Name in the browser tab: open source/index.html and change the text inside <title> and the content of <meta name="description">.
  3. Name read by screen readers and in the language texts: open source/src/i18n.js, search for title: and change it in every language you use.
  4. Change the save prefix if you publish a different game based on this one: STORAGE_PREFIX in source/src/config.js.

5. Recipe C: change the octopus mascot

  1. The octopus has 3 poses in assets/treasure/: feliz.png (happy: menu, map and level screen), vitoria.png (victory: win window) and triste.png (sad: tray almost full and lose window).
  2. Replace each one as in Recipe A, keeping the size and a transparent background. Keep the character in the same place inside the picture, with its base near the bottom.
  3. Which game situation uses which pose is set in source/src/app/worlds.js (mascotPoses): the left side is the situation, the right side is the pose.
  4. The tutorial hand is assets/treasure/hand.png (keep the fingertip in the same place, the game points with it).

6. Recipe D: change the tile pictures

Each world has one tile sheet: assets/treasure/icons-0.png (world 1) to icons-3.png (world 4). A sheet is 1448 x 1086 pixels with 4 columns x 3 rows of 362 x 362 cells, transparent background. The game cuts the cells and centers the visible drawing in each tile.

  1. Open the sheet in Photopea. Turn on View > Show > Grid or draw guides every 362 pixels.
  2. Paint one picture per cell, leaving a small transparent margin. Each of the 12 pictures must be clearly different from the others: the player matches them by sight.
  3. Export as PNG with the same name.
  4. Optional: the names of the 12 pictures (used only inside the code) are in source/src/config.js, WORLDS[n].icons, in the same order as the cells: left to right, top to bottom.
  5. The burst colors when a trio disappears are ICON_COLORS in source/src/config.js (one color per cell).

7. Recipe E: change texts and translations

  1. Open source/src/i18n.js. Each language has a block (en: {, pt: {, es: {...). Each line is key: 'text',.
  2. Change only the text between the quotes. Keep the key on the left and placeholders such as {n} (the game puts a number there).
  3. To remove a language from the selector, delete its entry in LANGS at the end of the file (you may keep its block).
  4. Run npm test: the language test tells you if a key is missing in any language.

8. Recipe F: make the levels easier or harder

The number of tiles of each level is in source/src/game/levels.js, in the table TARGET: one row per world, 15 numbers per row (levels 1 to 15 of that world). More tiles = longer and harder level.

  1. Change a number. It must be a multiple of 3 (tiles disappear in trios), for example 33, 36, 39. Keep it at 90 or less: more tiles become too small on phones.
  2. Save and run npm test. The test plays every level with its stored solution and fails if a level cannot be won.
  3. The shape of the board in each world is SHAPES in the same file (diamond, cloud, pyramid).
  4. The tray has 7 slots (TRAY in source/src/game/rules.js). Fewer slots make the game much harder; the tray artwork is drawn for 7.

9. Recipe G: change helpers, coins and stars

  1. Helpers per level: HELPERS = { undo: 3, hint: 3, shuffle: 2 } in source/src/config.js.
  2. Coins: COINS = { match: 1, win: 10 } in the same file (coins for each trio and for each win).
  3. Stars: in source/src/app/screen-modals.js, the line const stars = used <= 0 ? 3 : used <= 2 ? 2 : 1; (no helper = 3 stars, 1 or 2 helpers = 2 stars, more = 1 star).
  4. The game has no shop or real-money purchases; coins are a score that the player collects.

10. Recipe H: replace sounds and music

Sounds are MP3 files in assets/sfx/, music is assets/music/tema.mp3. The list below shows which file plays for each event (set in source/src/audio/sfx.js, FILES).

Event File in assets/sfx/
pick a tile pegar-1.mp3
tile lands in the tray passo-1.mp3
trio disappears caixa-cheia-1.mp3, caixa-cheia-2.mp3
combo combo-1.mp3
coin moeda-1.mp3
covered tile tapped bloqueio-1.mp3
undo desfazer-1.mp3
shuffle milho-1.mp3
hint botao-1.mp3
win vitoria-sem-trinado.mp3
confetti confete-1.mp3
lose tempo-acabou-1.mp3
button click clique-1.mp3
window opens janela-1.mp3
  1. Open your sound in Audacity, cut the silence at the start (short sounds feel faster) and export as MP3 (128 kbps is enough).
  2. Save it with the same file name over the old one, or save it with a new name and change the name in FILES (without .mp3).
  3. Music: replace assets/music/tema.mp3 with a loopable MP3. Keep it small (2 to 4 MB) so the game loads fast.
  4. Players can lower effects and music separately in Settings.

11. Recipe I: change colors and the font

  1. Most colors of the pirate theme are in source/css/04-overrides.css (the last style file wins). Use the search of your editor to find a color code, for example #, and change it.
  2. The outline color of some effects drawn on the board is INK in source/src/config.js.
  3. Font: the game uses Fredoka (assets/fonts/fredoka-latin.woff2 and fredoka-latin-ext.woff2). To use another font, put its .woff2 files in assets/fonts/, change the two @font-face blocks at the top of source/css/01-base.css (the src: url(...) lines) and keep the name Fredoka or replace it everywhere. Include the font license.
  4. Check the menu, a level and the windows after changing colors: some buttons are pictures and do not change with CSS.

12. Recipe J: rename or reorder the worlds

  1. World names are in WORLDS in source/src/config.js (name:). The game does not print them on screen: they are the accessible labels of the map arrows (read by screen readers). The id is internal: leave it as it is.
  2. Each world uses its own tile sheet (icons-0 to icons-3) and its own background (world-N.png landscape, portrait-N.png portrait), used by the map and the level screen (see the table in section 2). To swap two worlds, swap their files.
  3. There are 15 levels per world (WORLD_SIZE) and 60 in total (LEVEL_COUNT in levels.js). Adding a fifth world needs new art for every screen and changes in the code; ask for custom development if you need it.

13. Check and publish your changes

  1. In source/, run npm test (rules, all 60 levels and languages).
  2. Run npm run serve and play a level in landscape and in portrait (F12 > phone mode).
  3. Run npm run build: it copies index.html, css/, src/ and assets/ to game/. If you deleted or renamed files, delete the old ones in game/ yourself.
  4. Upload the contents of game/ to your host, replacing the old files.
  5. If you still see the old version, clear the cache (DOCUMENTATION.html, Updates and cache).

14. If something goes wrong