Skip to content

About

2D open world in the browser: infinite procedural map, villagers and deer with autonomous decisions

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Field

A 2D open world that runs in the browser. The world is infinite and procedurally generated from a seed. Villagers and deer make their own decisions based on their needs, personality and surroundings, and settlements grow over time.

Live: https://lemonhub-io.github.io/open-world/

Controls

Key Action
WASD / arrows Move
E Gather from the tile you face
T Talk to the nearest villager and see what they are doing
G Give a berry to the nearest villager
Q Eat a berry
B Build a house on the tile you face (5 wood 2 stone)
R Store your goods at the nearby settlement
Esc Pause menu (save, new world)

The game autosaves to the browser's localStorage.

Touch and small screens

  • Drag anywhere on the map to move with a floating stick
  • Tap or click the map to walk there, tap a tree, bush or rock to gather it, tap a villager to talk
  • The buttons at the bottom right cover every keyboard action, Gather repeats while held
  • Phones and small windows get a compact HUD and larger tiles, tablets and desktops keep the full layout
  • The game pauses and saves when the app goes to the background

Run locally

No build step. Open index.html in a browser, or serve the folder:

python3 -m http.server 8000

Layout

  • index.html and style.css - page shell and flat HUD
  • js/util.js - hashing, noise and seeded random
  • js/world.js - terrain, resource nodes, settlements
  • js/ai.js - utility-based agent decisions, pathing
  • js/render.js - canvas drawing and day/night lighting
  • js/game.js - game loop, input, save and HUD
  • .github/workflows/pages.yml - deploys the site to GitHub Pages on push to main

About

2D open world in the browser: infinite procedural map, villagers and deer with autonomous decisions

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages