Saving a structure not relative to its position?

How do games like bloxberg save player built structures without using the position? I have made a building system before but I saved the position along with all the other values. Are they using some service or api that im not aware of?

2 Likes

Im just spit balling here since I’ve never tried anything like this before. But I believe Bloxburg uses a plot kind of thing, so perhaps you want to layout plots and make sure to properly define what is the front, right, left, and back side of a plot.

From there, probably save the properties of the parts (except position)

And for position, instead of setting the actual position property to a data store, maybe store the distance between one side to its corresponding side of the plot its on for every part.

For example, take a part and record the distance between the front side of the part to the front side of the plot and do this for all sides and then when loading it in, properly place the part at the correct distance away from the edges of the corresponding plot.

(Sorry if this didn’t make much sense, I’ve never done this before, but this’d be my best guess atm)

2 Likes

You can save the local CFrame relative to a building block or plane using :ToObjectSpace(). Then when you load it back in onto a plane at a different global location, you would do plane.CFrame:ToWorldSpace(saved_cframe). This is assuming all the planes are the same size, etc.

4 Likes

Thanks for the reply, I understand much better now :slight_smile:

Or plane.CFrame * saved_cframe, which, trust me, you probably will start to prefer once you figure out how CFrame multiplication works.

1 Like