What is the most efficient way to store data regarding custom position on a plot?

I have a game where players within the game are able to purchase a house and customize the location of the furniture within the house. Additionally, placement of furnitures is not based on a grid-system. However, when a player leaves and rejoins, I want them to be able to load their floor plan on any house of the same template within the game.

My current saving system runs a loop through each parts and groups them into a singular model. Then the primary part of that model is the floorplan of the house. This model is then serialized into a table which then would be stored into the datastore. To load the floorplan, it would deserialize the model and sets the primary part’s cframe equivalent to the new floor’s cframe. However, I refuse to believe that my first attempt on a saving system is the most efficient way to store and load data.

How would you go about saving such a system? What do you think would be the most efficient way regarding a system like this?

1 Like

This is how i’ve done it so I’ve made whatever building the player puts down a model and inside such model theres a hitbox that covers the entire model and is also the primary part so you could store the hitboxes cframe then use setprimarypartcframe and use the saved data

1 Like

What I do is…

Assign a key to each model for my little building system with each key only being like 3 letters. Then I create a table with 4 values, the first 3 are the vector offset from the base area they build on and the 4th value is the Y rotation stored as a (Y)/90 with respect to the base’s rotation. Finally I put it through the HTTP Json encoder and use a Lua compression module I found online to shorten it even further.

This keeps the data’s character count really small so a lot can be stored per user.

Edit: I also do what @Sebastian_Wilson does with the models primary part.

6 Likes