Skip to content

About

Mine it, smelt it, forge it, sell it. A first-person blacksmith incremental game in the browser, built with three.js.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Forgeworks

Mine it. Smelt it. Forge it. Sell it. Then build a crew to do it for you.

A first-person blacksmith incremental game that runs in your browser. You start with bare hands in a small forge yard: swing the pick, carry ore to the furnace, keep the fire up, hammer ingots into gear, and haul it to the market stall. Gold buys better tools, new patterns and hired hands, until the whole yard runs itself.

It is in the spirit of hands-on sims like A Needle In A Haystack: Sorting Game: nothing is automated until you have done it yourself, and automation has to be earned.

The forge yard in first person: miners at the rock face, stokers at a stone furnace, smiths at the anvil, and a status panel showing a rush on swords

Get it running

git clone https://github.com/brendonlow/forgeworks.git
cd forgeworks
npm install
npm run dev

Then open http://localhost:5173 and click to step into the yard.

Requirements: Node 20.19 or newer, and a browser with WebGL 2. npm run build writes a static site to dist/ that any file server can host.

If it runs slowly, open the notice board with Tab, go to Forge, and lower Graphics quality. The game also lowers it by itself if the frame rate stays under 30.

Controls

Input Action
W A S D Walk
Mouse Look
Left click or E Use what the crosshair is on (hold to work or pick up)
Q Put back what you are carrying
R At the anvil: change the pattern you forge
Tab Open or close the notice board (also clickable at the market), 1 to 6 switch its tabs
Esc Release the mouse

The loop

Where What you do Result
Rock face Hold to mine Ore drops onto the pile
Ore pile Hold to pick up Ore in your hands, up to your carry limit
Furnace Click to load ore, hold to pump the bellows 2 ore smelt into 1 ingot, as long as the fire is kept up
Anvil Click to set ingots down, then hammer. R changes the pattern Ingots become the piece you chose, on the rack
Market counter Click while carrying finished goods Gold, at whatever the market will bear

The fire. Nothing smelts in a cold furnace. Pumping brings the fire up in a few seconds and it dies over about 40. Until you hire a stoker, tending it is your job.

Sparks fly off the anvil as a sword is forged, with finished axes hanging on the rack behind

Patterns and the market

The anvil can forge seven patterns. Bigger pieces are worth more per ingot and per hammer blow, but cost more to learn and need better-trained smiths.

Pattern Ingots Work Value Pattern cost Opens at Smiths need
Nails 1 0.6 0.45 known Copper Apprentice
Horseshoes 2 1.0 1.0 known Copper Apprentice
Daggers 2 1.5 1.45 400 Copper Journeyman
Axes 3 1.9 2.1 1,800 Copper Journeyman
Swords 4 2.6 3.1 15,000 Iron Artisan
Shields 5 3.0 4.0 200,000 Steel Expert
Breastplates 8 4.6 6.8 5,000,000 Silver Master

Every pattern sells into its own market:

price = metal base price x pattern value x appetite x rush / (1 + glut / depth)
  • Glut. Each piece sold adds to that pattern's glut and pushes its price down. The glut drains away over a couple of minutes. Selling one thing forever earns about half what a spread of patterns does.
  • Appetite drifts between 0.7 and 1.4 for each pattern.
  • Rushes. Now and then one pattern fetches 2 to 3 times as much for a few minutes.
  • Depth is how much the town absorbs before the price halves. The ledger and your merchants deepen it.
  • Merchants sell whatever is fetching the most. Customer orders ignore the market.

The notice board Market tab listing seven patterns with prices, market mood gauges, and a rush on swords

Progression

Automation arrives in stages and has to be earned.

Vein Crew size Training Tool level Newly available
Copper 1 Journeyman 5 Bunkhouse, miner, stoker, masterwork technique, order book, daggers, axes
Iron 2 Artisan 9 Smith, prospector's lamp, swords
Steel 3 Expert 13 Merchant, shields
Silver 4 Master 17 Retiring, foreman, breastplates
Mithril 5 Grandmaster 21 Steward
  • Bunkhouse. You cannot hire anyone until you build one.
  • Apprentices are slow. A new hire works at half your pace. Two rounds of training bring a crew level with you; after that each rank is +20%.
  • Wages. Crews are paid by the minute. If you cannot pay, they down tools until you hold a full minute of wages.
  • Rank perks. Miners strike double ore, stokers get bonus ingots, smiths turn out the odd masterwork and follow harder patterns, merchants haggle.
  • Tools (pickaxe, bellows, hammer, ledger): +12% per level. Past the speed floor the surplus becomes batch size.
  • Pack and boots raise how much you carry and how fast you walk.
  • Retire from Silver onward for permanent legacy bonuses. Renown, perks, techniques and patterns stay; the bunkhouse does not.

Things only you can do

  • Masterworks. Once learned, the anvil shows a strike meter. Click while the marker is in the sweet spot. A piece forged mostly from perfect strikes sells for 3 times as much. Holding the button still works and makes plain gear.
  • Customer orders. Accept an order on the notice board, then carry the goods to the counter yourself before the clock runs out. Orders pay 2.5 to 4 times a calm-market price and earn renown. Merchants leave enough on the rack to fill them.
  • Rich veins. Now and then the rock face shows a rich vein for 30 seconds. Mine it by hand for triple ore and a gem worth 15 horseshoes.
  • Goals and renown. Goals pay renown. Renown buys perks that survive retirement: a foreman and steward who buy upgrades for you, a bigger order book, a wider sweet spot, better order and gem payouts, more frequent rich veins.

Pacing

npm run sim [hours] [veins] plays the game with a simple bot and prints when each milestone lands. The bot buys the cheapest thing on offer, tends the fire, forges whatever pays best per ingot, and does no masterworks, orders or gems.

Milestone Bot time
Bunkhouse and first miner about 1 h 10
Iron about 1 h 45
First smith about 2 h 15
Steel about 3 h 15
First merchant (full chain automated) about 3 h 20
Silver about 4 h 15
Mithril about 5 h 25
Adamant about 6 h 15

A player who saves for the bunkhouse instead of buying every cheap upgrade can hire a miner in about 20 minutes, but an apprentice on wages adds little until the rest of the chain keeps up. All numbers live in src/game/economy.js.

Layout

  • src/game/ rules with no DOM or three.js: economy.js holds every tuning number, engine.js the jobs and purchases, player.js what your hands do for each target, market.js supply and demand, orders.js customer orders, goals.js the goal ladders, state.js save/load, tiers.js the metal list.
  • src/ui/hud.js crosshair, prompts, yard status and the shop overlay.
  • src/scene/ the three.js yard, first-person controller and view model. PBR materials, image-based lighting, soft shadows and post-processing, with three quality tiers (the game lowers the tier by itself if the frame rate stays under 30).
  • public/textures/, public/env/ CC0 textures and sky from ambientCG and Poly Haven. Sources are listed in public/textures/CREDITS.md. CONTRACT.md documents the snapshot/input/event API between game and scene.
  • tools/pacing-sim.mjs the bot behind npm run sim.

Tinkering

  • window.forge is a console hook. forge.state.gold = 1e6 gives you gold.
  • forge.fakeInput = { locked: true, target: 'rock', held: true } drives the rules without the mouse. forge.scene.debug.lookAt('anvil') places the camera.
  • Add ?noscene to the URL to run the rules and HUD with no 3D at all.
  • Progress is saved in your browser's localStorage. The Forge tab has a wipe button.

Credits

Built with three.js and Vite. Textures are from ambientCG and the sky from Poly Haven, all CC0. The full list is in public/textures/CREDITS.md.

About

Mine it, smelt it, forge it, sell it. A first-person blacksmith incremental game in the browser, built with three.js.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages