In a game I’m working on right now, I’m looking to implement a feature where players can create their own houses. These houses can be created on demand by the player, and different layouts can be selected on creation. Then, the player can decorate the interior with their own furniture, wallpaper, and so on. The player can also set extra controls, such as who can enter, the max player count, and who has build rights.
The way I’m currently looking to implement this uses the Create Place API:
When a player creates a house, a template place will be copied using CreatePlace, and the house data (layout, furniture, build rights etc.) will be saved into a DataStore.
The template place needs to fetch the latest version of scripts and stuff when it’s started. I’m thinking of using the new (and currently not available) auto updating packages feature for this, since packages can contain more than just scripts, which would be highly useful!
After the template place is copied, the player’s place will get a reserved server which is used to limit the number of instances to a single instance. This is used when teleporting the player to their place.
When the player’s place starts (after all the stuff is fetched), it will read the house data from the DataStore and build the house’s layout and furniture, so everything looks as the player left it previously.
As the player tweaks the settings for the house (changes who has build rights or changes the max player count), or changes the furniture, this gets pushed to the DataStore.
Players will be able to delete their houses too. I have no idea how to do this, except for removing the DataStore info. Help appreciated!
Other players will be able to browse through a list of popular houses, or search for houses. This list should ideally show the number of players currently in each house, prevent people from joining houses with the max number of players in, and let them search houses by name. Again, no idea how to do this! It might have something to do with OrderedDataStores?
Is this a good use of CreatePlace? What would you do differently?
If this is everytime the user changes something read below;
Instead of saving the info on the Data store each time the assets are changed, why don’t you just do it on player removing? This way, it will save ALL the changes made to the house, and you are not calling the datastore and it’s functions as much. This is what I’m getting from this, but if I’m mistaken, please correct me.
The new settings should be available as soon as possible, otherwise the house browsing UI would get outdated information about things like the max player count for a house. I’ll use some form of throttling system in the settings UI, where you can only change the settings once per minute or something similar.
I know how to delete the DataStore information already. I’m more concerned about deleting the created place and reserved server, if that is at all possible.
I could do this, and I might end up doing it anyway, but also if auto updating packages get released it would make working on the game much more convenient!
Of course it’s up to you what you want to do, but you don’t have to create a new place just for a house. This could be implemented in the original place if you wanted.
That seems like a good idea. Or at least saving data marking it as removed if you want it to be recoverable or archived.
If you want to quickly search/sort integers, then yes.