# Singleplayer worlds This rfc only addresses how voxygen handles multiple singleplayer servers. A singleplayer world is all saved state that defines a singleplayer server. It's rtsim state, server config including whitelist and bans, player data database and a map. # Motivation 1. This would make it much more available to generate and play on different maps. 2. You can have different worlds without having to move things around in the file structure. And with rtsim becoming more advanced you might want to play around with it without messing up your main world. # Explanation ## Versioning A version of this system expects a certain file system structure, and certain files to exist within a world folder. We want to be able to migrate to future versions, so we keep the older versioned loaders in the codebase to be able to migrate. And we also need some file to keep track of which version we are loading. That file could be in `userdata/singleplayer/version` or `userdata/voxygen/version`. Version 0 would be what we currently have, where there's just one singleplayer world. This version won't have the file to tell what version we are loading. So if that file is not found we try to load version 0 (and maybe if that fails we try to load version 1 and so on). ## Version 1 For version 1 we can take a pretty simple approach of keeping all the data in that worlds folder. - userdata/singleplayer/ - world_default/ # Existing world migrated from version 0 - rtsim/ - saves/ - server_config/ - world.bin - world_foobar/ - rtsim/ - saves/ - server_config/ - world.bin In `server_config/settings.ron` we'd save the `GenOpts` of the world, even after it has been generated. If there is a world generated we'd override that setting before passing it when starting the server. And if the `map_file` field in settings is None and we don't have a map in the world folder, we copy the default map to the world folder so that someones singleplayer map doesn't change if we change the default one. ## UI In the voxygen main menu, after you press singleplayer you're taken to a list of your worlds where you can select one to play. You can also create new worlds here, or choose to regenerate the map of an existing one. # Drawbacks ## Storage space In this implementation each world would contain it's own map. And with maps at 10x10 size being 16MB it might be too much for some users. And this issue gets worse with larger map files. ## Implementation complexity Committing to having backwards compatability does increase complexity in the implementation. # Prior art ## Minecraft Minecraft works in a very similar way, where a singleplayer world is really just a server. So each world holds its own map and player data. # Unresolved questions