Witchcraft
MMORPG

Big World Data

The procedural worlds contents, from actual temporary local decoration such as foliage that isn't stored, to stored probes, on of the heavier parts are locations and areas as mentioned in the "Map view & Areas system" post. Even if the world will be sparesly filled with actual existing areas and locations, the goal is to create a scalable system as this should become a standard solution for Tesseract.

Storing properties, businesses etc

This tooks me a few weeks to consider and think of, i couldn't decide if i should store the data as model in the database or do it purely statically in the spatial adressable chunk file, the file that stores a larger portion of the world where user created content exists, the actual location interior is stored in a individual file. My main concern was if this will cause a flood of DB queries as players wander around the world so i had to think through the full workflow and where and when queries will be needed. A big main feature are roles on locations which will not only give you a fancy role such as "Mayor", but also come with permissions, to store them thinking ahead of how much player could possibly be in a location getting many roles really made me concern. For a private house it might be less of an issue, but if it applies to towns where every citizen at least has the Citizen role, this could grow to many hundred thousand roles, not related to actual active players but players interacting and living in the citiy over time.

Model duality - caching

To keep quering and accessing simple, and roles more separated i went with the stored location model again. When creating a lot property (where a house is built on), it copies all relevant fields from the location model, the lot property is what is stored in the world chunks, and when viewed in the world is the outerior representation of the house - i will further explain how custom built houses like in Sims can be done for a entire town in another post. So finally as players wander from town to town the lot properties are statically stored in the chunk file with minimal non-growing data, no queries involved.
 
Area/land type of locations that are stored in texel tiles also are going to be stored in this dual manner, however their sparse data with name, type etc is always stored in the canonical tile their origin is in, which makes the technical part more complex, but removes the need for clients to request the names of areas that are viewed on the map, as this would become a bit more query intensive again. Once a area location is updated, renamed for instance, this metadata stored in the canonical tile will be synced as well.

When queries are involved

As of now that means the location model in the DB more or less just sits there as the canonical original, being queryable just like on a maps system, searching in a radius etc. Once a player walks into a town, or on the property of your house the server needs to know the permissions on that place for you. Once location changed the permissions for the location are composited again and cached for as long as you are there, the change frequency of this is relatively low so it greatly reduces queries, on heavy load this could expanded to furthermore statically cache the permissions till changes happen.

Deleting a house, a town, a entire country

House be gone

This is probably something that isn't first thought of, deleting a property/house is more of a minor change but also not trivial. A house can be full of placed items and possibly other players, which need to get yeeted somewhere outside. I want to implement this in a more pleasant way honestly as you might be even part of that house, doing an approval is a bit too much work for now, but i try to not allow an sudden deletion with everyone blasted outside. For now a location will be marked as deleted, with everyone on notified, and once you leave it you can't enter again, there will be a timespan depending on the type of location people have time to leave, otherwise will be kicked out then, again as learned from Discord groups this should make many leave not all at once, this isn't only a experience issue but heavy traffic/query peak issue it can turn into for the server. However, deletion should not be a common issue as there is a lot coins spent on a location with little to no return, depending how it will develop.

Country gone, all gone?

But what is a house compare to an entire area, from a town to a country. This is a part i'm going to work on as this is written, from technical point of view it is doable but can turn into a serious heavy task, from game business point of view this is a question mark as large as a country. Even if locations are all parented, i think i will make areas more individual for players. As admin it will be still a thing to actually flush down a country, with all it's child areas, towns every single lot, item, and roads placed in, but geographhical managment should be more dynamic, even if that means a town one day might be in no-mans-land one day as the country is removed. For every level of area it is possible for the owner to expand their area buying new cells. What i still need to figure out is the relation with sub-areas such as towns in a country, as initially the town owners had a relation with the country owners and locations of any kind can be rented, but so far it should be possible to migrate. Anways, you should never fear loosing something if a town owner doesn't want his town anymore, for every type of location the restrictions and requirements and processes will be different, a town likely will never be deletable unless it is or becomes empty, rather transfer of ownership.

Data deletion, granular removal

Now deleting the entire structure below isn't as easy as i first thought, simply deleting the contained chunk files, more individual removal in the overlapping border chunks, there is data inside that is stored outside, such as locations referenced to the original in DB, the property (house) locations which have a separate file for their interior as well as things that need a careful/reasonable removal such as road networks at the borders. I'm not expecting the game become so massively filled it becomes comparable to realworld structures countries/towns, however i can be wrong and it could grow quite large over time. Deletion here will be treated for any scale, locking what is affected first, and start a thread going through all affected files, decode chunks as all objects that reference something outside must be traversed.

The visual aftermath

It sounds simple talking about such changes, however the replication to clients can become difficult for different scenarios. First of all for deletion just as terraforming obviously i want no players to be in that area, players should not expect such unexpected massive changes of their environment, there might be scenarios it is better than removing but it would not only be a unpleasant experience, but could lead to technical trouble asides of someone peacefully walking on a meadow being yeeted into the orbit from a sudden mountain popping up. At world changes in most cases the servers world cluster with the chunks is modified and surrounding players synchronize with delta updates, in heavy cases like this i will force the server and clients to refresh from the updated files or let it be from those deleted.

Conclusion

Building is one of the biggest aspects of the game and a very important to me personally being inspired from games like Sims and some Tycoon games. Implementing the systems alone already is a heavy task, doing them in a realscale world scale makes it much harder and doing it as MMO probably one of the most complex things i ever made.
Author: Fyrestar
Comments

Copyright © 2024 Mevedia. All rights reserved.