Suncrest Archery: 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

Main menu 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 (1000 x 438 pixels, transparent background). To use your own, save it at the same size with a transparent background.
  3. The page icon is assets/ui/icons/target.webp, set by the rel="icon" line of index.html.
  4. The word painted on the scoreboard in the 3D scene (SUNCREST, then the mode name) is in paintScoreboard in src/textures.js.

3. Colors and the look

The look of each biome (fog, light, the color of the ground and the tint of trees and flags) is BIOME_CONFIG in src/world.js, one entry per biome. Colors are written as 0xRRGGBB:

const BIOME_CONFIG = {
  // ...
  autumn: {
    fogColor: 0xe6a76c,
    fogDensity: 0.0052,
    tint: 0xffc993,
    ground: 0xe8c27c,
    sunColor: 0xffbe76,
    sunIntensity: 2.65,
    hemiSky: 0xffbe88,
    hemiGround: 0x6b4b26,
    hemiIntensity: 0.85,
    particleColor: 0xff8232,
    lanternOn: false,
    godRayOpacity: 0.22,
  },
  // ...
};

The glow and color grade of each biome are in setBiomeStyle in src/postfx.js. The text colors of the interface are the variables at the top of css/ui.css, in the block that starts with :root.

4. Replace pictures (reskin)

Replace a file with another of the same name and a similar size. Nothing else needs to change, except for the two sprite atlases (see the rows below).

On screen File
The logo assets/ui/logo.webp (1000 x 438)
The sky, the mountains and the hills of each biome assets/sky/<biome>-sky.webp, <biome>-mountains.webp and <biome>-hills.webp (1536 x 1024) for alpine, autumn, twilight and snow
The clouds assets/sky/cloud-1.webp to cloud-6.webp
The ground (tinted by the biome) assets/scene/alpine-meadow.webp and alpine-lawn.webp (1024 x 1024)
Trees, flags, lanterns, rocks, flowers and signs assets/scene/alpine.webp, a sprite atlas of 2048 x 1024. The rectangle of each sprite is listed in assets/scene/alpine.js: if you move a sprite in the atlas, change its numbers there.
Targets, the wheel, balloons, the bell frame, crystals and the apple assets/scene/objects.webp, a sprite atlas of 2048 x 1024, with its rectangles in assets/scene/objects.js
The two painted boards (scoreboard and distance signs) assets/scene/scoreboard.webp and assets/scene/signpost.webp
The bow assets/bow3d/wood.webp, limb.webp, leather.webp (512 x 512) and feather.webp (512 x 104)
Panels, bands, buttons, plaques, sliders and switches assets/ui/panel.webp, band.webp, btn-gold.webp, btn-green.webp, btn-wood.webp, btn-round.webp, plaque.webp, slider-track.webp, slider-fill.webp, switch-track.webp and switch-knob.webp. They are drawn as 9-slice frames: the corners stay as they are and only the middle stretches. The cut sizes (--k-slice) are in css/ui.css: if the border of your art is thicker or thinner, change them.
The icons (arrow, target, trophy, stars, sound, gear, pause...) assets/ui/icons/*.webp

5. The bow

The bow drawn, seen from the archer

The first-person bow is built in code from simple shapes covered with the pictures in assets/bow3d/. Its feel numbers are FEEL at the top of src/bow.js: its size and place on the screen (scale, riserNdc, rest), how the limbs flex and spring back (limb), the recoil (recoil), the vibration of the string (stringVibe), the nocking animation (nock), the breathing (breathe) and the strength of the shake (tremor).

Left-handed (the bow mirrored) is the default, and the switch in Settings changes it. To make right-handed the default, find suncrest_lefty in src/bow.js and change the line to this.side = load('suncrest_lefty') === '1' ? -1 : 1;.

6. Stages

Stage 4, Autumn Pendulum

The 10 stages are in src/levels.js, in the list CAMPAIGN_STAGES. A stage is a block of text like this one (stage 4). Distances are in meters from the archer, x is meters to the right of the center and y is the height.

{
    id: 4,
    biome: 'autumn',
    arrows: 7,
    goalScore: 300,
    windX: 1.6,
    targets: [{ distance: 27, x: 0, y: 1.65, radius: 0.72, motion: 'pendulum', amp: 0.28, speed: 1.15 }],
    bonuses: [
      { type: 'crystal', distance: 27, x: -2.6, y: 2.1 },
      { type: 'crystal', distance: 27, x: 2.6, y: 2.1 },
    ],
  }
Field What it is
id The stage number, 1 to 10. The tournament plays the stages in the order of the list.
biome The biome: alpine, autumn, twilight or snow. It sets the sky, the light and the colors.
arrows, goalScore The arrows you get and the points you need to pass the stage.
windX The wind in m/s: positive pushes the arrow to the right, negative to the left, 0 is calm.
targets The straw targets: distance, x, y, radius, and motion (static, pendulum or rail) with amp and speed. apple: true puts an apple on top.
type: 'wheel' A wheel instead of a straw target: type: 'wheel' with wheelRadius, targetRadius, count (how many targets), speed and centerCrystal.
bonuses The bonuses: type (balloon, crystal or bell), distance, x, y and, for a crystal, an optional size.

After a change, reload the page and play the stage. The tournament always starts at stage 1: to test a later stage quickly, temporarily move it to the top of the list (npm test will complain about the order, so put it back before you publish).

The Endless mode builds its waves with generateEndlessWave at the end of src/levels.js: the distance grows with the wave (at most 38 m), the wind grows (at most 6 m/s) and the shape of the target follows the wave number (wave 3 of every five a pendulum, wave 4 a rail, wave 5 a wheel). The starting arrows and the arrows won are in startEndless and _finishShotCycle in src/game.js.

Keep the rules: a goal must be reachable with the arrows (at most 100 points per arrow), targets stay between 12 and 40 m and the wind within 6 m/s. npm test checks them.

7. Difficulty, feel and scoring

The result panel with the stars

The most useful numbers, in src/game.js unless another file is named:

Setting What it does
STEADY_HOLD Seconds the bow stays steady and the ring stays green before it shakes (7.2).
TREMOR_RAMP Seconds for the shake to grow to full strength (5.7).
WIND_ACCEL_FACTOR How hard the wind pushes the arrow (0.38). With the strongest stage wind a centered full-draw shot still lands on the edge of the target.
ZERO_SPEED The full-draw launch speed the sight is zeroed for (55): the pin is where the arrow lands on a full draw; a weaker draw falls short.
IMPACT How deep the arrow sinks into the straw, how much it quivers and how many straw strands fly.
Draw speed and perfect draw In _updateGameplay: the draw grows by 1.25 per second and the perfect draw (isSweet) starts at 0.86. In _computeLaunchParams: the arrow speed is 22 to 55 m/s and 4.5% more on a perfect draw.
The rings In _handleTargetHit: normDist limits 0.105 (X-ring, 100 points), 0.22 (bullseye, 60), 0.40 (great, 40), 0.65 (good, 25) and the rest of the target (10).
Bonus points points of each bonus in src/targets.js: balloon 100, bell 120, crystal 150 (the crystal in the middle of the wheel too) and apple 40. A bonus also adds 20 points for each streak step above 1.
Streak and extras In _handleTargetHit: streakBonus (10 per step, at most 50), perfectBonus (10), robinBonus (50, with an extra arrow) and doubleBonus (40, apple and target with one arrow).
Extra arrows _awardBonusArrow: never more than 12 arrows in the quiver; in the tournament only the Robin Hood refund gives an arrow, at most 2 per stage.
Stars starsFor in src/main.js: tournament 3 stars with half of the arrows left or more, 2 with at least 1, 1 otherwise; endless 3 stars from 600 points, 2 from 300.
FEEL in src/bow.js The feel of the bow (see section 5). The field of view is BASE_FOV (54) and ZOOM_FOV (36, at full draw) at the top of src/game.js.

8. Texts and languages

The language list

9. Sounds and music

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

Files When they play
tap, nock Any button press, and the arrow clicking onto the string.
draw The creak of the bow while you draw: a loop that follows how far the bow is drawn.
sweet, release, release-perfect, release-flow The perfect-draw chime and the release of the arrow (normal, perfect draw and golden or sunfire arrow).
hit, hit-bullseye, hit-x, miss An arrow in the target (outer rings, bullseye, X-ring) and an arrow in the ground.
balloon, apple, bell, crystal, robin The balloon, the apple, the bronze bell, the crystal and the Robin Hood split.
flyby, slowmo An arrow whistling past, and the start of the slow-motion arrow camera.
clear, new-best The jingle of a stage cleared (or a new wave in endless), and a new best score.
wind, music The wind loop (louder with a stronger wind) and the music loop.

To add a sound, put the file in the folder and add its name to SAMPLES in src/audio.js; to play it, call this._play('name') in a method of the sound engine. npm test checks that the list and the folder agree.

const SAMPLES = [
  'tap',
  'new-best',
  'nock',
  'sweet',
  'release',
  'release-perfect',
  'release-flow',
  'slowmo',
  'flyby',
  'hit',
  'hit-bullseye',
  'hit-x',
  'miss',
  'balloon',
  'apple',
  'bell',
  'crystal',
  'robin',
  'clear',
  'draw',
  'wind',
  'music',
];

10. Save keys and starting over

The best scores and the settings stay in the browser of each player, under keys that start with suncrest_ (the best tournament total is suncrest_best_campaign). If you host two copies of the game on the same domain, change the prefix in one of them (see the buyer guide).

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

  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