I have one month to make an MMO: Day 11
I didn’t may any ground today, but also didn’t slip backwards.
This is going to be another short blog post since I’ve been focusing on the back-end code implementation, so there’s not many interesting things to look at or any interesting plans or tech being deployed. I’ll keep this short.
Bootstrapping
I’ve finished the dialogue parser, and have added it to the player node, ready to be integrated with the entity storage. But I realized that I could’nt actually integrate it until the game client can actually load the NPC that has that dialogue. And before it can load the NPC, the data must be in the database. This means I need a new bootstrapping script for both dialogues and entities.
I’ve mentioned bootstrapping a few times already, but haven’t really explained what it is. The origin of the term is probably “to pull oneself up by one’s bootstraps”, which used to mean doing a seemingly impossible task (like trying to float by grabbing the back of your jacket and pulling upwards). But today in the world of computers, it’s used in several places, usually meaning something that provides an initial piece of code or data needed to start some long-running process.
In my case, I’m using it to refer to the act of seeding the state of the world into the Redis database: The MMO can’t function with an empty Redis database, it needs information about the world and its entities to be in there. So the first thing that must done after Redis starts up with an empty database (or indeed after code updates that require the database to be started over due to incompatible data structures), is to load it with the information about the world. It’s this act of initially loading, is what I’m referring to.
The main source of data for bootstrapping is the Firestore database. A set of scripts run to pull data out of Firestore, do a bit of processing (usually generating database IDs), and insert them into Redis. Right now, bootstrapping will create the following data into Redis. Note a lot of this is placeholder:
It’s possible to see a few different kind of data in Redis after the bootstrap: maps, dialogue, and entities. The entity and dialogue bootstrapping is new today. I’ve written a new bootstrap script for the dialogues, and adjusted the maps parser to pull out the entities, and create entries for them into the Redis data.
This is what a typical entity might look like in Redis: it contains the x, y, and chunk positions; and some object and type properties; and in this case the dialogue entry associated with it.
As the game progresses, the entity may need to store more local data about it, perhaps its own HP, or inventory or gold. That data will be stored in this structure, and later periodically persisted to Firebase to survive server reboots (which means more bootstrapping will be needed, as well as entity backup scripts)
Entity Node
In addition to the I’ve created a new entity node, similar in design to the player node, but acting as the “brains” or computer-control of the entities. I don’t have many pictures, it’s all code at this point, so here’s a stock photo to fill this gap.
For now, I’ll spin up a single entity node that just process the data for every entity. But as the game expands, I will need to start looking auto-scaling the deployment, so that nodes expand as needed. But that’s much much further down the line, I can make do with manually spinning up a few.
Day 11 Task Summary
I’m still around one day behind on this sprint. I’m going to be deciding soon whether to extend the sprint by a day; or just try to shorten the next sprint.
I’m still unable to check of NPC dialog scripting/parsing because it relies on the rest of the pieces coming together.
Another dry day of backend programming. I hope to wrap this up soon so I can return to working on the game client.