Emerald Break: 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. Your brand: name, logo and icon

Title screen with the logo
  1. The name in the browser tab is the <title> line of index.html, and description is the line below it.
  2. The logo is assets/ui/logo.webp (1097 x 520 pixels, transparent background). To use your own, save it at the same size with a transparent background.
  3. The page icon is assets/ui/ball-8.webp, in the line of index.html that starts with <link rel="icon".
  4. The line under the logo is the key subtitle in each language file of src/lib/locales/.

3. Colors and the look

The 3D table gets its look from pictures in assets/tex/. To change the color of the cloth, open assets/tex/felt.webp in an image editor, change its color and save it with the same name and size. The same picture covers the cushions, so both change together.

:root {
  --ink: #f6eed2; /* text */
  --gold: #e9c463; /* titles and highlights */
  --gold-ink: #2a1c05; /* text on the golden buttons */
  --foul: #ff8773; /* foul messages */
}

The colors of the rings and lights of each ball are in BALL_COLORS in src/config.js, from the cue ball to the 8. The colors of the texts are at the top of css/base.css:

4. Replace pictures (reskin)

Replace a file with another of the same name and the same size. Nothing else needs to change.

On screen File
The room, on upright and on wide screens assets/bg/fundo-pe.webp (941 x 1672) and fundo-deitado.webp (1672 x 941)
The cloth, the wood and the steel of the table assets/tex/felt.webp, wood.webp and steel.webp (512 x 512)
The balls of the 3D scene assets/tex/ball-0.webp to ball-15.webp (1024 x 512)
The cue assets/tex/cue.webp (128 x 4096): the tip is at one end and the handle at the other
The portraits of the players assets/ui/ava-<name>-<mood>.webp, four moods for each person, with a transparent background
The small ball icons of the player cards assets/ui/ball-0.webp to ball-15.webp
Buttons, panels, title bands and player cards assets/ui/btn-*.webp, panel.webp, band.webp, plate.webp and plate-on.webp. Only the middle of these pictures stretches, so keep the corners and the size.
The power bar, the switches, the sliders and the spin ball assets/ui/power.webp, power-fill.webp, toggle-*.webp, track*.webp, knob.webp and spin.webp
The lamp above the table assets/ui/lamp.webp (640 x 601)
Icons and the pictures of How to play assets/ui/ico-*.webp, gl-*.webp and how-1.webp to how-3.webp
Light points, rings, dust and trails of the effects assets/tex/fx.webp (768 x 512): six drawings in two rows of three. Keep each drawing in its place.

5. The opponents

The three opponents to choose from

Open src/core/ai.js. At the top, DIFFICULTY has one line for each opponent: easy is Leo, medium is Maya and hard is Victor. To make one easier, raise aimSigma (how much the aim misses) and powerSigma (how much the power misses). To make one stronger, lower them.

To change a name, change it in two places: in OPPONENTS in src/app/ui.js and in name(p) in src/game/hud.js. Then replace the four portraits of that person.

6. The table

The whole table seen from above

The size of the table is at the top of src/core/table.js, in meters: TABLE_L is the length (1.64) and TABLE_W the width (0.82). Keep the length twice the width. The drawing, the camera and the physics follow these numbers.

The pockets are in the same file: CORNER_MOUTH and SIDE_MOUTH are how open they are. A bigger number makes the game easier. Change one number at a time, in small steps, then run npm test and play a match.

7. Difficulty and game feel

Aiming in the 3D view

Open src/config.js. The most useful numbers:

Setting What it does
FEEL.aim.cueDrag How much the cue turns while you drag in the 3D view. A lower number gives a finer aim.
FEEL.aim.guideMax The longest golden line of the target ball, in meters (0.3). A shorter line makes the game harder.
FEEL.aim.curve How far the dots show the path of the cue ball after the hit, in meters (0.24).
FEEL.pocket.light and FEEL.pocket.aim The brightness of a pocketed ball (0.4) and of a pocket while you aim at it (0.5). Use 0 to turn that light off.
FEEL.slowmo.scale The speed of the slow motion when the 8 that wins the match is about to fall (0.28). Use 1 for no slow motion.
FEEL.sound.pocket The volume of a ball falling into a pocket (0.42).
FEEL.camera The two views: distance, height and how fast the camera follows. The names with Portrait and Tall are for upright screens.

8. Texts and languages

Settings panel

9. Sounds and music

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

Files When they play
ball0.mp3 to ball3.mp3 Two balls hit each other.
cushion0.mp3, cushion2.mp3 and cushion3.mp3 A ball hits a cushion.
cue0.mp3, cue1.mp3 and cue3.mp3 The cue hits the cue ball.
pocket0.mp3 to pocket3.mp3 A ball falls into a pocket.
foul.mp3 A foul.
win.mp3 and lose.mp3 The end of a match.

The game plays a hit louder and brighter when it is stronger, so one good recording is enough. The music is assets/audio/music/lounge1.mp3 and lounge2.mp3. The lists of files are in src/game/audio.js:

const BANKS = { ball: [0, 1, 2, 3], cushion: [0, 2, 3], cue: [0, 1, 3], pocket: [0, 1, 2, 3] /* ... */ };
const TRACKS = ['music/lounge1.mp3', 'music/lounge2.mp3'];

10. Save keys and starting over

The settings stay in the browser of each player, under the key emerald-break.save.v1. If you host two copies of the game on the same domain, change KEY in src/lib/store.js of one of them.

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

11. 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