Animal Adventures
A game by Rosemary. Pick an animal, eat food, earn leaves, and explore six worlds in 3D. It runs in the browser on a tablet, phone or computer.
Play it: https://muellercodes.github.io/animal-adventures/
How it plays
- Start animals: duck, swan, chicken, tree frog, lizard (black with yellow spots), garter snake and bunny. All of them are free, and you can switch any time.
- Growing up: every new animal starts as a baby. Birds, lizards and turtles hatch from an egg (tap to crack it open), and the others are born. Babies grow by eating, and a bird has to be more than half grown before it can fly. You can give each animal a nickname.
- Real animal moves: bunnies, frogs and squirrels hop, snakes slither, ducks waddle and paddle, and the duck, swan, owl and parrot can fly. Animals that swim can go in the water, where the fish are. Frogs, lizards, squirrels, raccoons and cats can climb trees. Dogs and cats sit down when they stand still for a while, a dog wags its tail when it's happy, and a cat walks with its tail up.
- Taking care of your animal: your tummy goes down over time. If it stays empty too long your animal catches a cold (sneezing, no running or flying) until it eats, sleeps or sees the vet.
- Food: apples fall under apple trees, acorns under oaks, pine cones under pines, berries by bushes, carrots grow in the garden and fish swim in the ponds. Food your animal can eat glows. Walk up to it and tap Eat. Every animal has a favorite food that's worth more. Food your animal can't eat does nothing to you.
- Leaves: leaves are the money in the game. You earn them by eating (1 leaf, or 2 for a favorite) and by finding a new world for the first time (10 leaves).
- Shop: spend leaves on 16 more animals, from a squirrel (150 leaves) up to a horse and a moose. The others are a hedgehog, weasel, turtle, pig, cat (a brown tabby), goat, dog (a golden retriever), fox, otter, raccoon, owl, deer and parrot. There's also a pretend leaf store where you can "buy" leaf packs. A grown-up has to answer a times-table question first, and no real money is involved.
- Worlds: Land (a farm with a barn, fenced pens, a garden, orchard, pond and lake, Maple Town, a city and small towns), Sky Lands (floating islands, only for grown-up animals that fly), Forest, Swamp, Jungle and Meadow.
- Endless worlds: every world keeps going in every direction. The hand-made part is in the middle, and past it the game makes new woods, fields, lakes, ponds, giant trees, orchards and farms (with a barn, a farmhouse and penned animals) as you go. In the Map, tapping the world you're in takes you back to its start.
- Wild animals: each world has wild animals that wander, graze, rest at night and run (or fly) away if something big comes at them too fast. Out in the wilds new ones turn up around you. Play as the same kind of animal and some of them will tag along with you.
- Farm animals and fences: horses live in a paddock, pigs in a muddy pen, goats in a pen with a climbing platform and chickens in a coop run. Fences stop animals (fliers go over), and gates swing open when you walk up to them.
- Day and night: a day lasts 12 minutes and a night lasts 10. The sun moves across the sky, sunsets glow, and at night the stars and fireflies come out. Owls can see better in the dark.
- People: friendly people walk around the Land and the Meadow. Animals can't talk to people, so nobody asks you anything. Someone who likes your animal kneels down and holds out a hand. Walk up to them and they pet you, then they head home: follow them and they adopt you. Walking away means no. Your person follows you around, pets you and brings you snacks.
- Homes: when someone adopts you, you get a home in the village. Like real pets, the lizard, frog, snake and turtle live in a glass tank, the parrot in a big bird cage, and the bunny and hedgehog in an indoor pen. Other small animals, like the dog and the cat, are indoor pets with a bed. Farm animals (duck, swan, chicken, pig, goat, deer, horse, moose) live in a pen in the back yard. Every home has a food bowl. The Home button takes you there, and you can sleep at home to skip the night.
- Maple Town: Maple Street grew into a big town with Elm, Birch, Oak, Pine and Cedar Streets, 27 houses, shops (a general store, bakery, cafe, post office, library, hardware store, ice cream shop, diner and flower shop) and a town green with a bandstand. People pop into the shops during the day, and you can go in too.
- The city: east of Maple Town, Maple Street runs straight into the city's Main Street. The city is six blocks by six around a big park, with named avenues and streets (First Avenue to Sixth Avenue, North Street to South Street, Main Street and Park Street). Apartment towers, office skyscrapers and brick shop buildings fill the blocks, with alleys behind them (dumpsters, trash bags, crates, pallets, gas meters, puddles and an alley cat now and then), parking lots and small plazas with cafe tables and food carts. Stores line Main Street and the side streets (pet store, vet, bakery, toy store, grocery, ice cream, cafe, flowers, books, clothes, pizza, pharmacy, music, shoes, barber and deli), each with a clerk inside. The streets have parking lanes full of parked cars, parking meters, crosswalks, traffic lights on the busy crossings and stop signs on the others, street signs, lamps, street trees in iron grates, hydrants and trash cans. In the middle is a big park with a fountain, a pond with ducks, a bandstand, a playground, paths, benches and trees. People walk the sidewalks (some walk their dogs), wait for the walk light, go in and out of the stores, sit on benches and at cafe tables, buy hot dogs and ride the bus.
- Cars and buses: cars, trucks and motorcycles drive on the right, stop at red lights and take turns at the other crossings. They always stop for animals and people in front of them, and honk if you just sit in the road. Three buses run a loop from the Maple Town green to the city and around the park. When a bus stops with its doors open, walk up to the front door and tap Get on the bus; at any stop, tap Get off.
- Small towns: Pinecrest, Willow Creek, Fox Hollow, Bramble and Clover sit all around the city, each with a main street, houses, a couple of shops and a few people out walking. Country roads join them to the city.
- Places on the map: in the Land, the Map also lists places you can jump straight to: the farm, Maple Town, the city, the city park and each small town.
- Town life: the people of Maple Street have jobs. In the morning they leave home: some walk out of town to work and come back in the evening, the teacher and the kids go to school (go inside and you can sit in on class), and at recess and after school the kids play on the swings, slide, sandbox and seesaw and run over to pet animals they see. The farmer picks carrots in his garden, feeds his animals and checks his traps, and the fisher checks the fish traps in the pond and the lake. At night everyone goes home.
- Traps: weasels and other pests sneak into the farmer's garden to eat his carrots, so he keeps wire box traps baited with a carrot around it. When a pest walks in, the door snaps shut and the farmer takes it to the animal pound. Small animals can get caught too, so watch where you walk. Fish swim into the fish traps (look for the orange floats).
- Animal control: if a small animal walks around town without its person, Officer Kim may try to catch it and take it to the pound. Run away, or stay with your person or in your own yard. At the pound, a pet with a home has a collar: the pound calls the number on it and your person comes to take you home. Without a collar you wait in a kennel until someone adopts you (or tap Let me out).
- Adoption fair: by the meadow path there's an adoption fair with tents, balloons and pens. A scout looks in the woods for animals that don't have a home, like a wild otter or snake, and brings them to the fair, and people come by to adopt them. If your animal doesn't have a home, the scout may kneel down for you too, or you can walk into an empty pen and wait for someone to come meet you.
- Houses, barns and the animal pound: doors swing open and you walk through. You can go into the houses during the day and into barns any time (horse stalls, hay, a loft ladder). Big animals don't fit through house doors, but they fit in barns. At the end of Maple Street is the animal pound, with animals in cages, kennels and a vet who makes sick animals better. Go into a kennel and wait, and a visitor may come and kneel at the door; walk out to them to go home with them.
- Holidays: in the fall the leaves change color and drift down. From October 1 to November 2 there are pumpkins and jack-o'-lanterns, and at night you can go trick or treating at the houses for candy.
- Playing together: when you're signed in, the game is always online. Everyone else who is signed in and in the same world shows up as their animal, walking, swimming and flying around with you, and you hear their Call. Their label only says what animal they are (never a name), nothing anyone types is shared, and there is no chat. The paw pill at the top shows how many other players are in your world.
- Sound: animal calls, footsteps, wind, birds, crickets, frogs and a little music, all made by the game itself. Both can be turned off in Settings.
Controls
On a phone or tablet: drag on the left side to walk (push farther to run), drag on the right side to look around, pinch to zoom. Tap Jump, and tap it again in the air to fly. While flying, hold Flap to go up and Land to come down. A purple button shows up when there's something to do right where you are (Go in, Go out, Go home, Sleep, Climb, Let go, Let me out, Trick or treat, See the vet, Get on the bus, Get off). Call makes your animal's sound.
On a computer: WASD or the arrow keys to walk, Shift to walk slowly, Space to jump (press again in the air to fly, hold to flap up), E to eat, F to do the purple-button thing, V to call, C to land, drag with the mouse to look around and scroll to zoom.
Saves
The game saves on the device by itself, and a small "Saved" sign shows when it does. If you make an account (a name and a password, no email), your game also saves online so you can keep playing on another device. The newest save wins.
The backend is a tiny Cloudflare Worker with a D1 (SQLite) database and one Durable Object per world that relays where everyone's animal is over WebSockets, the same setup as Emberblood. It fits in Cloudflare's free tier and doesn't get paused or deleted when nobody plays for a while. Passwords are hashed with PBKDF2-SHA256, sessions are random tokens stored only as hashes, and nothing personal is collected.
Project layout
game/shell.html page markup and styles
game/src/00_core.js game data (animals, food, prices) and helpers
game/src/35_envkit.js 3D scenery: trees, plants, barn, grass, water, sky, clouds, food
game/src/35_envkit.js (also houses and rooms, the pound, the school, a playground, traps, the adoption fair, pens, pumpkins, nests and eggs)
game/src/36_city.js city and town buildings: towers, shop buildings, store fronts and the insides of the stores
game/src/37_street.js the street kit: lamps, traffic lights, benches, bus stops, park pieces, road surfaces, cars and buses
game/src/40_animals.js the 23 animals as 3D models (grown-up and baby) with walk, hop, swim, fly, climb and eat animation
game/src/45_people.js the people
game/src/49_plan.js where Maple Town, the city, the park, the small towns and the roads go, and how the ground is shaped there
game/src/50_world.js the six endless worlds: terrain tiles, water, where things grow, landmarks, the village, pens and gates
game/src/60_actors.js movement, wild animal and people behavior, homes, food
game/src/62_town.js town life: jobs, school, traps, animal control, the pound calling your person, the adoption fair
game/src/63_traffic.js cars and buses: lanes, traffic lights, taking turns, stopping for animals, bus stops, riding the bus
game/src/64_citylife.js city people: sidewalks and crosswalks, shopping, park benches, the bus, store clerks, small town walkers
game/src/65_audio.js all the sounds and music (Web Audio, made in code)
game/src/68_net.js playing together: sends your animal to the server and draws everyone else
game/src/70_game.js rendering, camera, controls, day and night, menus, saves
game/vendor/ three.js r149
game/assets/ pre-rendered menu pictures (made by tools/assets.py)
game/models/ sculpted animal models (made by tools/blender, embedded by build.mjs)
tools/blender/ the Blender pipeline that sculpts, bakes and exports those models
game/config.json address of the cloud save API
build.mjs builds docs/index.html
docs/ the published site (GitHub Pages serves this folder)
worker/ Cloudflare Worker API + D1 schema
Everything 3D is built from code when the game loads, using three.js. The exceptions are the animals (all but the swan), whose bodies are sculpted by script in Blender (see tools/blender) and embedded in the page as small meshes with color and normal maps. Buildings in town are merged into a few big meshes when the world loads, and the city's towers, street furniture and cars are drawn instanced, so a big town stays smooth.
Building
node build.mjs # uses game/config.json
API_BASE=http://127.0.0.1:8787 node build.mjs # point at a local worker
API_BASE= node build.mjs # no cloud saves
Then open docs/index.html, or serve the folder (npx serve docs).
To redraw the animal icons and world pictures in the menus after changing a model or a world:
NO_ASSETS=1 API_BASE= node build.mjs && python3 tools/assets.py && node build.mjs
Running the backend
cd worker
npm install
npx wrangler login
npx wrangler d1 create animal-adventures # copy the database_id into wrangler.toml
npx wrangler d1 execute animal-adventures --remote --file=schema.sql
npx wrangler deploy
The live game uses https://animal-adventures-api.muellercodes.workers.dev. Allowed browser origins are set by ALLOWED_ORIGINS in wrangler.toml (localhost is always allowed for testing).
License
MIT. See LICENSE.