Contents
1 Overview
Campfire Heroes is a complete HTML5 merge defense game in a hand-drawn fantasy world, seen from above. The player spends mana on hero cards, places the heroes on the tiles around the campfire and merges two equal heroes of the same level into a stronger one. Monsters arrive from several directions, shown by arrows before each wave, and the heroes must keep them away from the camp tent.
The journey has 5 camps with 10 waves each: Whispering Woods, Autumn Grove, Snowy Night, Misty Swamp and Ashlands. Wave 10 of every camp is a boss: the Troll King, the Stone Golem, the Jade Dragon, the Swamp Hydra and the Ash Lord. There are 8 heroes, each with its own role (Archer, Knight, Ice Mage, Bomb Dwarf, Bard, Cleric, Lancer and Druid), 16 kinds of monsters, elite monsters, weather that changes the fight, and Champions: a hero merged up to level 5 gains a special move that costs mana.
The campaign can be played on Easy, Medium or Hard. Each wave gives up to 3 stars and coins; coins buy permanent upgrades for the camp, the heroes and the Flare. The game also has achievements, a Bestiary of the monsters already met, boss practice, a playable tutorial and an endless mode that opens after the first boss. It has music for each camp, sound effects, 14 interface languages and layouts for phone, tablet and desktop. It is drawn on a 2D canvas with plain JavaScript: no game engine and no library.
2 Installing on your website
Installing takes a few minutes if you have FTP access or a file manager in your hosting panel.
- 1. Extract
campfire-heroes-static-1.0.0.zipon your computer. -
2. Connect to your hosting by FTP or its file manager and open the folder where the game should live, for
example
public_html/games/campfire-heroes/. -
3. Upload only the contents of the
game/folder, so thatindex.htmlsits directly inside the target folder. -
4. Keep
assets/,css/andsrc/besideindex.html, with names and letter case unchanged. -
5. Open
https://your-domain.example/games/campfire-heroes/in a modern browser.
source/ folder, the documentation/ folder or the ZIP itself.
Players need no Node.js, PHP, database or account.
3 Requirements
-
Any static web hosting with HTTPS (or HTTP). Opening
index.htmldirectly from the disk (file://) does not work, because browsers block JavaScript modules there. - A current browser: Chrome, Edge, Firefox, Safari or Opera, on desktop or mobile. The game draws on a 2D canvas and plays sound with Web Audio, both built into these browsers.
-
About 70 MB of space on the server. The game makes no request to other websites: the fonts, pictures,
sounds and music are all inside
game/. -
Node.js is only needed to run the tests or to rebuild the game from
source/(see the development section).
4 How to play
Place a hero: drag a hero card from the bar at the bottom onto a free tile around the campfire, or tap the card and then the tile. Each card costs mana, which refills over time. When the journey has more heroes than the bar shows, the bar scrolls.
Merge: drop a card on a level 1 hero of the same kind, or drag a hero on the field onto an equal one of the same level. The merged hero is one level higher, up to level 5. A hero can also be dragged to another tile, and swapped with another hero.
During a wave: the Flare button burns and pushes back the monsters near the camp (it costs mana and needs a few seconds to recharge). The 1x button changes the speed and the pause button opens the pause menu. Between waves, Repair mends the tent for mana and Next wave starts the wave early. On a touch screen, spread two fingers on the field to zoom in and pinch to zoom out; with a mouse, use the wheel.
Keyboard: the arrow keys select a tile, Enter confirms and Escape cancels; with the cursor on the field, the number keys choose a card. The 0 key or Home resets the zoom. Progress is saved automatically at the end of each wave: coins, stars, upgrades and the wave reached. If the camp falls, the wave can be tried again, and the next try offers a reinforcement that makes it easier.
5 Screens
Marks on the screenshot
- Play
- Camp and wave
- Heroes
- Bestiary
- Upgrades
- Sound: music and effects volume
- Settings
Marks on the screenshot
- Pause
- Game speed
- Wave and camp
- Camp health and stars
- Coins
- Mana
- Hero cards
- Flare
- Sound: music and effects volume
- Settings
6 Files and folders
game/ is the ready-to-host game. source/ has the same editable files plus the
tests, a local preview server and the build command. The code is plain JavaScript ES modules with no compile
step and no npm dependency.
game/ upload these contents to your web host
index.html every screen and panel
css/ look of the interface
src/main.js starts everything: screens, input, sound, frame loop
src/game/data.js START HERE: heroes, monsters, prices, upgrades, balance
src/game/campaign.js the 5 camps, their waves and bosses, the 3 difficulties
src/game/rules.js, src/game/combat.js the rules of a match
src/game/meta.js, src/game/journey.js progress, coins, stars, travel between camps
src/game/waves.js, src/game/bosses.js, src/game/bosses2.js waves and bosses
src/render.js, src/scene.js, src/actors.js, src/hero.js, src/fx/ drawing
src/ui/ screens and panels (HUD, cards, menus, map, tutorial)
src/audio/ sound engine and the sound of each event
src/feel.js, src/feel-mix.js, src/feel-*.js look-and-feel numbers, sound mix
src/save.js saving in the browser, developer test mode (off)
src/debug.js the panel of the developer test mode
src/i18n.js, src/i18n/ the 14 languages, one file of texts each
assets/heroes/, assets/enemies/ sprites (WebP frames)
assets/field/, assets/props/, assets/objects/, assets/camp/ scenery
assets/ui/, assets/icons/ interface pictures, the logo, the font (ui/fonts/)
assets/story/, assets/journey/ story pictures and the journey map
assets/sfx/, assets/music/ sounds (MP3, WAV) and music (MP3)
assets/manifest.json frames, size and feet point of every sprite
assets/sfx/manifest.json every sound, its volume and timing
assets/AUDIO-AND-ART-CREDITS.txt credits of the sounds, music and art
DOCUMENTATION.txt short note that points to this guide
source/ the same editable files, plus:
package.json, package-lock.json
README.md, DO-NOT-UPLOAD.txt
tests/ npm test (17 checks)
tools/build.mjs copies the game into dist/
tools/serve.mjs local preview server (npm run dev, npm run preview)
tools/check-node.mjs checks the Node.js version before the commands
documentation/index.html this guide (offline, 14 languages)
documentation/customization.html step-by-step customization guide
documentation/img/ the screenshots of the guides
DOCUMENTATION.html shortcut to this guide
CUSTOMIZATION.html shortcut to the customization guide
START-HERE.txt, CHANGELOG.txt
THIRD-PARTY-LICENSES/ the Fredoka license and the credits
-
src/game/data.js: the first file to edit.UNITShas the heroes (card cost, health, damage, attack rate and range),HERO_UNLOCKthe wave where each hero joins,ENEMIESthe monsters,REWARDthe coins paid,UPGRADESthe permanent upgrades,CHAMPthe Champion moves andBALthe general balance (mana, camp health, Flare, stars). -
src/game/campaign.js: the 5 camps (CAMP: scenery, boss, monsters, wave patterns and elites) and the 3 difficulties (CAMPAIGN_MODES).src/game/waves.jsbuilds the waves,src/game/bosses.jsandsrc/game/bosses2.jsare the bosses. -
src/game/rules.jsandsrc/game/combat.js: the rules of a match (mana, placing, merging, attacks).src/game/meta.jsandsrc/game/journey.js: progress, coins, stars, upgrades and the travel between camps.src/main.jsstarts the game and connects screens, input, sound and the frame loop. -
src/render.js,src/scene.js,src/actors.js,src/hero.jsand the files ofsrc/fx/draw the field, the heroes, the monsters and the effects. The files ofsrc/ui/are the screens and panels.src/audio/is the sound. The files whose names start withfeelhold the look-and-feel numbers. -
index.html: the page with every screen.css/: the look of the interface.src/i18n.jsandsrc/i18n/: the languages, one file of texts per language.src/save.js: saving and the developer test mode. -
assets/: heroes, monsters (enemies/), scenery (field/,props/,objects/,camp/), effects (fx/), interface (ui/,icons/), story pictures (story/), the journey map (journey/), sounds (sfx/), music (music/) and the font (ui/fonts/).assets/manifest.jsonlists the frames of every sprite andassets/sfx/manifest.jsonevery sound.
7 Internal names in the code
Some names in the files are not the words on the screen. They are only names: players never see them. The table of this section tells you which file is which.
-
In the code the heroes have neutral names:
shooteris the Archer,guardthe Knight,frostthe Ice Mage,splashthe Bomb Dwarf,boosterthe Bard,healerthe Cleric,piercerthe Lancer androoterthe Druid. Their pictures usearcher,knight,icemage,dwarf,bard,cleric,lanceranddruid. -
The monsters too:
gruntis the Goblin,runnerthe Wolf,brutethe Ogre,spitterthe Skeleton,swarmthe Slime andflyerthe Bat.bosstoboss5are the five bosses.energyis the mana,pulseis the Flare,baseis the camp andcellsare the tiles. -
A wave of the journey is a
levelfrom 1 to 50: camp 2, wave 3 is level 13.w1tow5are the sceneries of the five camps. In the saved settings,normalis the Medium difficulty. -
A few file names are Portuguese:
css/herois.css(heroes),css/combate.css(combat),src/fx/pes.js(feet),src/fx/inimigos2b.js(enemies),src/fx/clima.js(weather),src/fx/cena2a.js(scene), and the story picturescampina(meadow),outono(autumn),neve(snow),pantano(swamp) andcinzas(ashes).
8 Customizing
CUSTOMIZATION.html in the main folder of the download, or
documentation/customization.html.
Brand: the name in the browser tab is the <title> line of index.html. The
logo is assets/ui/logo.webp (900 x 689 pixels, transparent background); it appears on the
loading screen, the start screen and the menu.
Pictures: replace a file in assets/ with another WebP of the same name and the same size.
Sprites are separate frames, for example assets/heroes/archer-0.webp;
assets/manifest.json tells the game the size of each frame and where the feet are.
Balance: card costs and hero strength are UNITS in src/game/data.js; the coins are
REWARD and the prices of the upgrades upgradeCost and
unitUpgradeCost in the same file. The monsters and elites of each camp are CAMP in
src/game/campaign.js, and the three difficulties are CAMPAIGN_MODES.
Feel: FEEL in src/feel.js holds sizes, camera and timings; the other files whose
names start with feel hold the numbers of the combat effects, the hero animations and the
interface. MIX in src/feel-mix.js is the sound mix.
Sounds and music
The sound effects are the files of assets/sfx/, listed in
assets/sfx/manifest.json with their volume (gain) and the shortest time between
two plays (minGap). Replace a file and keep its name. A sound with several takes has numbered
files, for example bow_shot-1.mp3 to bow_shot-3.mp3.
The music is in assets/music/: music_camp.mp3 plays in the menus,
music_battle.mp3 in camp 1 and in the endless mode, music_world2.mp3 to
music_world5.mp3 in camps 2 to 5, music_boss.mp3 with the bosses of camps 1 to 3
and music_boss_b.mp3 with the bosses of camps 4 and 5. Which track plays where is
world and bossTrack in src/feel-mix.js.
campfire-heroes.save.v1 and the settings under
campfire-heroes.settings.v1; the zoom, the hero looks already shown and the tips already seen
have their own small keys that start with campfire-heroes.. If you host two copies of the
game on the same domain, change these names in src/save.js, src/zoom.js,
src/looks.js and src/ui/alerts.js of one of them.
9 Languages
The game has 14 languages: English, Portuguese, Spanish, French, German, Italian, Dutch, Polish, Turkish, Russian, Indonesian, Japanese, Korean and Chinese. The first visit uses the browser language; the player can change it in Settings.
Each language is one file in src/i18n/ (en.js, pt.js,
es.js...): a list of key: text lines. Change the text after the colon and keep the
key and the words between braces such as {n}. A key that is missing in a language shows the
English text. The list of languages is in src/i18n.js.
There is no address switch for the language: the first visit uses the language of the browser and the player changes it in Settings, where it is remembered. Japanese, Korean, Chinese and Russian use the fonts of the device.
10 Saving and resetting
- The journey, the coins, the stars, the upgrades, the achievements, the settings and the language are saved automatically in the browser of each player (localStorage), at the end of each wave. Nothing is sent to a server.
-
The progress is stored under the key below and the settings under
campfire-heroes.settings.v1. A few small keys that start withcampfire-heroes.keep the zoom, the hero looks already shown and the tips already seen. - To start over, delete this key in the developer tools (F12), under Application, Local Storage, or clear the site data in the browser.
campfire-heroes.save.v1
11 Development (optional)
This section is only for changing the code. The game/ folder already contains the finished
game, so installing it needs no Node.js. The game has no npm dependencies and no compile step:
npm run build only copies the files into dist/.
1. Install Node.js. Open https://nodejs.org/en/download and choose the latest Node.js 26 LTS installer for your system (minimum 26.13.0). npm is included.
Windows: run the .msi installer, keep npm and Add to PATH enabled, finish the installation and reopen Command Prompt. macOS: run the official .pkg installer and reopen Terminal. Linux: follow the instructions on the same page for your distribution.
2. Check the installation. Run node --version and npm --version separately. Both
must print a version number, and Node.js must be 26.13.0 or newer. If a command is not found, reopen the
terminal and check that Node.js is in PATH.
node --version
npm --version
3. Extract the complete ZIP first and open its source/ folder, where
package.json is. Windows: type cmd in the address bar of that folder in File Explorer. macOS
and Linux: open Terminal and use cd with the path of the folder.
4. Run the commands below one by one. npm ci checks the lock file (nothing is downloaded, the
project has no dependencies). npm test runs the checks of the rules, a robot that plays the
first camp, the 14 languages and the package; it takes under a minute.
npm ci
npm test
5. Preview: npm run dev starts a local server; open http://localhost:5180/ in your browser,
play for a while, and stop the server with Ctrl+C.
npm run dev
6. Build: npm run build empties source/dist/ and copies index.html,
css/, src/ and assets/ into it. dist/ is what you
publish; while the source is unchanged it is identical to game/.
npm run build
7. Publish: back up the game on your website, then upload the contents of dist/ in place of the
old files, keeping the folders. If you deleted or renamed a file, delete the old one on the server yourself.
Clear the cache afterwards.
npm test, means Node.js is too old. If PowerShell
blocks npm.ps1, use Command Prompt or run npm.cmd.
DEBUG_MODE to true in
src/save.js. A small DEBUG button then appears at the left of the screen, with shortcuts:
more coins, win the wave, lose, jump to any wave, unlock every wave, let a robot play and fill the mana.
While the test mode is on, nothing is saved. Set it back to false before you publish.
12 Updating and clearing the cache
Clearing the cache without losing progress
Progress is stored in this browser, not on the server. Clearing cached images and files, or doing a hard reload, keeps your progress.
Computer: press Ctrl+F5 on Windows and Linux, or Cmd+Shift+R on macOS. Phone: in the browser settings, choose the option to clear cached images and files.
Do not choose cookies and site data, or clear site data, for the game's address. That deletes the local save.
13 Licences and credits
The game code, the artwork, the sound effects and the music are supplied under the license of the item you purchased.
Third-party parts, with the complete license text in THIRD-PARTY-LICENSES/: the Fredoka font
(SIL Open Font License 1.1, also in assets/ui/fonts/). The game uses no library. The sounds,
the music and the artwork were made for this game; see assets/AUDIO-AND-ART-CREDITS.txt.
14 Common problems
-
Blank page or a game that never opens: the game was opened from the disk or a file is missing. Use a web
host and keep every file and folder of
game/next toindex.html. - No sound: browsers start audio only after the first tap, click or key press. Check both volumes in the Sound panel and the volume of the device.
-
A blank page after you edit a code file: there is a typo in the file. Open the browser console (F12) to
see the line, and run
npm testbefore publishing. - The game feels slow on an old phone: turn on Less motion in Settings, and keep the speed at 1x.
- The old version still appears after an update: clear the cache (see the section above). Two copies on the same domain share their progress: give each copy its own save keys.
-
The game asks to try again while loading: a picture could not be loaded. Check that the whole
assets/folder was uploaded, with the same names and letter case, and reload.
15 FAQ
Does the game need a database or a server language?
Does it use a game engine?
Is there online play or a ranking?
Can I add a hero, a monster or a camp?
src/game/data.js and the camps are CAMP in
src/game/campaign.js. Changing their numbers is easy (see the Customization Guide). A new
hero or monster also needs its pictures in assets/, its entry in
assets/manifest.json and its name in the language files, so it is a job for a programmer.
Does it work on phones?
Can I change the prices and the difficulty?
cost in UNITS, the upgrade prices are
upgradeCost and unitUpgradeCost, both in src/game/data.js, and the
three difficulties are CAMPAIGN_MODES in src/game/campaign.js.
16 For AI assistants
If you ask an AI assistant to help you change this game, give it the prompt below together with your request. It describes the project so the assistant works on the right files and does not break the rules of the game.
You are helping me change "Campfire Heroes", a finished HTML5 merge defense game (version 1.0.0). Read these facts before you edit anything.
PROJECT
- Plain JavaScript ES modules, HTML and CSS, drawn on a 2D canvas, sound through Web Audio. No bundler, no compile step, no library, no npm dependencies.
- The editable project is source/ (the same files as game/, plus tests and tools). Edit source/, never game/ or source/dist/.
- npm run build copies index.html, css/, src/ and assets/ into source/dist/ and nothing else. Upload the CONTENTS of dist/ (or game/) to a static web host.
- Node.js 26.13.0 or newer is needed only for: npm ci, npm test, npm run dev (http://localhost:5180/), npm run build, npm run preview.
GAME
- Rules: src/game/. data.js has UNITS (the 8 heroes: cost, hp, dmg, rate, range), HERO_UNLOCK, ENEMIES, REWARD, UPGRADES, CHAMP and BAL (mana, camp health, Flare, stars). campaign.js has CAMP (5 camps of 10 waves, boss on wave 10, elites) and CAMPAIGN_MODES (easy, normal, hard). rules.js and combat.js run a match; meta.js and journey.js keep progress between waves; bot.js and bot2.js are robot players for the tests.
- Names in the code are neutral: shooter = Archer, guard = Knight, frost = Ice Mage, splash = Bomb Dwarf, booster = Bard, healer = Cleric, piercer = Lancer, rooter = Druid; grunt = Goblin, runner = Wolf, brute = Ogre, spitter = Skeleton, swarm = Slime, flyer = Bat; energy = mana, pulse = Flare, base = camp, cells = tiles. A wave of the journey is a level from 1 to 50.
- src/main.js connects the screens, the input, the sound and the frame loop. Drawing: src/render.js, src/scene.js, src/actors.js, src/hero.js, src/fx/. Screens and panels: src/ui/. Sound: src/audio/ (engine.js plays, director.js decides what each game event sounds like).
- Look-and-feel numbers: FEEL in src/feel.js and the other feel files; the sound mix is MIX in src/feel-mix.js. Do not change the rules to change how something looks.
- Sprites: separate WebP frames in assets/, described by assets/manifest.json (frames, size, anchor = the feet). Sounds: assets/sfx/manifest.json. Music: assets/music/.
- Texts: src/i18n/<lang>.js, one object of key: text per language (14 languages), with {placeholders}. A missing key falls back to English. Add every new text to the 14 files.
- Saving: localStorage keys campfire-heroes.save.v1 (progress) and campfire-heroes.settings.v1 (settings), in src/save.js; small keys in src/zoom.js, src/looks.js and src/ui/alerts.js.
- Developer test mode: DEBUG_MODE in src/save.js shows the panel of src/debug.js (coins, win or lose the wave, jump to a wave, robot player). Nothing is saved while it is on. Keep it false when publishing.
RULES FOR YOU
1. Make the smallest change that does what I ask. Do not rename or move files.
2. Run npm test after every change and fix what it reports. Run npm run build at the end.
3. Test through a web server (npm run dev), never from file://.
4. Add no network request, CDN, analytics, advertising or external font. Keep THIRD-PARTY-LICENSES/ and the license in assets/ui/fonts/.
5. Keep comments in English and keep the last line of each own JavaScript and CSS file: // End of <path> (complete file).
MY REQUEST:
(write what you want here)
Replace the last line with what you want, for example: make the Archer cheaper, give more coins per wave or
change the color of the buttons. Always run npm test after the change.
17 Support
Questions or problems: write to willian@polargames.com.br with your purchase code, the browser
and a short description or screenshot.
Support request
When you write to support, include the browser and device, the game version, the page address, the steps that caused the problem, a screenshot and the first error shown in the browser console. Never send passwords, payment details or secret keys.