Where Paddlebrook came from, and how a few bits of it work.
Why this exists
This started with me experimenting with binary protocols. I wanted to see how small I could get the messages going back and forth between a server and a browser, and a game seemed like the most fun way to test that. Once I had players walking around on screen, I wanted to build them a proper online world.
I also wanted to see how far I could get drawing everything with code instead of images, partly as a challenge and partly because I'm no artist. That's still the rule: nothing you see in the world is an image file.
It's just me working on it, so I wanted something I could realistically keep on top of. A small, cosy world felt manageable in a way a huge one never would, and it leaves room to keep adding to it bit by bit.
It started as Club Duck
The first version was called Club Duck. It had a plaza, a chat bar, a few puzzle games you could win gold from, and houses you could visit. It looked basic, but it proved the important part: lots of players moving around together, all kept in sync by one server.
Club Duck, back in the early tech alpha.
Paddlebrook kept the bits that worked and I started the world again from scratch. This time it's slower and cosier, with a pond to fish in, bugs to catch, a museum to fill and a house to do up.
Drawn in code
Every character, tree, fish and armchair in Paddlebrook is a piece of code that draws it. It's more work than drawing a picture, but it means a player can wear any hat in any colour, and the trees can go orange in autumn without anyone repainting them. The music and sounds are generated as well, including the little voices the characters talk in.
Paddlebrook now.
Smooth on purpose
Drawing everything with code has a cost: every blade of grass and pebble has to be drawn again for every frame, sixty times a second. So the ground is painted once into big tiles, and each frame just puts those tiles back on the screen. Only the things that move, like the ducks, the water and the trees swaying, are drawn fresh. On a slow computer that nearly doubled how smoothly it runs.
The server's in charge
The server runs the world in small steps, about eight a second. Your browser doesn't get a say in anything important. It asks to walk somewhere or cast a line, the server decides what happens, and it sends back only what changed, packed as small as I could get it (which was the whole point to begin with). It also means you can't give yourself gold by poking around in the browser.
No cheating at the puzzles
Up at the Mountain Lookout there's a shelter with two puzzles in it, peg solitaire and the fifteen puzzle, and the first one you solve each day pays 500 gold. So they have to be fair.
You play them in your browser, so every move is instant. When you finish, your browser sends the server the moves you made, and the server plays them all through again itself, from the board it gave you, before it pays out. It shuffles the fifteen puzzle for you too, so nobody can start with one that's nearly done.
The puzzle shelter at the Mountain Lookout.
Your fish are yours
Everyone gets their own fish and bugs, so nobody can take the one you were going for. They never actually get sent over the network. Your browser and the server both work them out from your name and the time, and they always agree. When you fish, all your browser tells the server is where you cast and when you clicked. The server already knows what was down there.
One clock for everyone
There's one clock for the whole game. The seasons, the rain, what's in the shops today, which fish are out and the verse the owl's reading in the church all come from the time and nothing else, so there's nothing to store and nothing to get out of sync.
The seasons
Paddlebrook follows the real calendar. From September to November it's autumn: the trees turn orange and gold, and the leaves come down and cover the grass. From December to February it's winter, with snow lying in drifts and settled on top of the trees and the rocks. The rest of the year it's green, with flowers out everywhere.
It isn't just the look, either. Different fish and bugs come out as the months go round, so there's always something new to find, and something you'll have to wait a whole year to see again.
Spring and summerAutumnWinter
Four packages, and that's it
The whole game leans on just four outside packages: Express for the web pages, ws for the live connection, EJS for the page templates, and one to compress what gets sent. The database and the password hashing are both built into Node itself, so there's nothing else to install, and nothing else to go out of date.