Cozy Corner DevLog #2

This post originally appeared on my Pardy Time DevLog

I started work on Cozy Corner along two streams, the engine and the lexicons.

The Engine began life as an isomorphic 2d / 2.5d engine. I'm certainly not the first person to build such a thing, so why I decided to build one myself rather than just using a popular version is beyond me. However for whatever the reason that is the approach I took.

It look me about a half of a day of tweaking to realize that an isomorphic engine was not what I wanted, I'd found some free assets and cobbled together a simple room and while I knew the art could be better the feel was all wrong.

I threw everything out and started over again building a top-down engine.

I was mostly inspired by video games from my childhood – Pokémon Blue (my brother had Red) being the one I'd spent many long car rides playing on my gameboy.

With my style locked it was time to find some real artwork - I can sling code with the best of them but I'm not much of an artist - fortunately itch.io exists and I can buy someone else's artwork.

So thank you Shubibubi for having made a whole set of topdown assets that fit the cozy vibe I'm looking for.

It was all coming together pretty quickly. By the end of the first day I'd gotten something that resembled a game, it even had pathfinding. I could make a little room and walk a little person around it. I even cobbled together a primitive relay server so multiple people could walk around the same room.

It was all looking great except for one thing... Performance.

I'd made a decision – I'm not sure why – to build the rendering engine using React as a core component. At the root we'd create a canvas and load it into react's context. Then components in the component tree would grab the canvas and draw on it. With a simple room with a few items it was bearable but it started to slow down as the number of items, and the complexity of rendering those items grew. I thought about going in and trying to find performance improvements but in the end I asked myself, "Why am I using React here?" and without a clear answer I deleted all the engine code and started again.

The Lexicons were something I'd already spent time thinking about but I knew that the first thing any good lexicon needs is a namespace. I wanted my game to have a cozy vibe and it turns out that cozy-corner.at was available so at.cozy-corner became the namespace.

With that out of the way I had 3 specific lexicon's in mind:

All of these would have literal "self" keys. Houses would contain rooms that people could visit, rooms would contain items.

Your avatar would have wearables so you could customize your look.

Your inventory would be core to the game - Anything you wanted to wear, any items in your rooms. They would need to be in your inventory, and your inventory would have a fixed size.

Of course the inventory size would be entirely enforced by the app view - but that's ok. The game pressure wouldn't come from finding rare items, it would come from curating specific items.

One thing I hit on early with the item schema was the idea of attaching media (image, video, and later audio) these would be blobs stored on your pds - when someone interacted with the item we'd draw an overlay and show the media item. It meant that you could hang a picture on a wall and when people interacted with it they'd see a painting you'd done in real life, or a photo you'd taken. A room would be a curated space, a place where you could get a sense of the creator.

I also wanted people to attach other bits of their creativity to items. Rather than just media blobs I added support for items opening other at-proto records. That everything was going to be at-proto records specifically was very important to me, it felt like a way to become part of a community of people building on this shared infrastructure. It also meant that users could "bring their own app views". So if you want to view posts on bluesky, blacksky, or eurosky you have that choice. The game just opens your chosen tool in a iframe.
Out of the box we'll support bluesky posts, leaflet blogs, and tangled repos.

And so we had our initial lexicons. An avatar with wearables, a house with rooms, rooms with items, and items with interactive attachments. Items and wearables were records allowing people to author their own. An inventory would hold all the things you'd collected.

For the most part this hasn't changed - except for in a few major ways.

Next up I write the engine again, delete all the lexicons, have an epiphany, and then delete it all again.