Staring at an empty /src folder was a bit liberating, so I started by regenerating typescript from my lexicons and got to work.

The new engine would be built from the ground up composing items directly onto the canvas, no more react performance issues. So far so good but then...

pets/cat.png

I was scrolling through the large asset pack I'd bought when I realized that I had some pet assets - wouldn't it be cool if I could have a cat in my room, they could wander around, sit on chairs, play with toys...

NPCs were going to be a whole new challenge - moreover I wanted people to be able to make their own pets. What was this going to look like?
Ultimately what I decided on was a fairly simply addition to the engine. The idea of tracking per-tile attribute values. These could be anything, heat, sound, light, water. The pets (
critters I was calling them) would be attracted or repelled by these attributes. Critters would have inertia and by customizing these parts of their "personality" you'd be able to create all sorts of behavior.

So critters gave rise to changes in the item schema, when you light a fire in the fireplace it emits light and heat. Put out the fire and the room darkens and cools off. The light attribute would allow some dynamic lighting in the room, but that would also now require ambient light - so the room schema changed.

The rendering engine kept pace with all of this, so I felt vindicated in my choice to rewrite.


As I added dynamic lighting I realized my walls were broken. Previously walls had just been floor tiles that your character couldn't enter. But now with light we had a problem. Walls generally should be lit, but if there is another room on the other side of the wall it should not, unless of course it's a half wall, or a railing or... and then of course we forgot entirely about ledges, these are effectively "one-way" walls, but not for light.

So rather than a set of booleans indicating if a tile could be occupied we moved to a bitmask - each tile would define for each edge if players could enter along that edge, or if attributes could propagate along that edge. 8 bits, 0 - 255, 1 bit for each side for physical barriers, 1 bit for each side for attribute barriers.

Walls are fixed, critters are supported, dynamic lighting is supported. Finally we're almost done.


Of course now our rooms would be much more complicated. and it was possible now to create "traps", areas where a user could enter but not exit. We needed to think about how we picked spawn locations for users when they loaded a room. So it was time to rethink exits. When going between 2 rooms you'd generally move from the exit of one room to the corresponding exit into another room. But when you just load a room it's unclear where you'd be coming from. I imagined a house exit - a special kind of exit that was really just an enterance, after all there was nothing outside of a house. As I started to play with the exit schema I wondered "what if rooms could connect to themselves?", elevators, teleporters, secret areas, and all sorts of cool things could be built with this. Then I thought "what if rooms could connect to a different user's rooms?"

This was a bit of an epiphany. If an exit pointed at an arbitrary room it could point to itself or point to any other room. You could build that hallway from the matrix with doors that connect one-way to other rooms. You could have a room representing a neighborhood that had exits to different people's houses. The houses themselves could exit back out the the neighborhood. With enough people building houses and connecting rooms you could walk through the entire at proto network. This felt right - it was a departure, not one that fundamentally changed the feel of the game, but it added a sense of discovery that wasn't really there before.

As I imagined all the possibilities the inventory and it's limitation on the number of items became an obvious problem. The limit was largely arbitrary driven by a desire to create a need to curate things as part of the game. However that same limitation would be fighting against this idea of rooms that are intended as shared spaces – Parks, Arcades, and whatever else people could dream up. I raised the inventory cap, once, twice, and then deleted the "self" keyed record entirely. The inventory still exists as a way to bookmark items, wearables, rooms, etc. it's no longer a hard cap.

Now as I sketched out my idea for a shared park living on an official cozy-corner PDS I imagined a pier jutting out into the water, you could go out the the end and fish... or could you, how would we support that?

Next up, my journey to add Lua.