Warning This framework is deprecated since game version 1.6 in which a spiritual successor was adapted into the base game.
A framework to save and load the world state in Enfusion engine powered games.
This framework is built on top of the Enfusion Database Framework. The persistence logic is responsible for collecting and translating the world state (relevant game entities and scripted instances) into DB entities which the DB framework can then store. On server restart all changes from the last session are requested from the DB and the save-data is applied back onto the world so players can continue to play.
- ✅ Many game mechanics persisted by default
- ✅ Entity transform, hitzones, inventories and attachment slots
- ✅ Vehicle passangers, engine status, fuel, lights and turrets
- ✅ Weapon chambering status and magazine (with ammo count, also on UGL's)
- ✅ Character stance, weapon and gadget raise status
- ✅ Player quickbar
- ✅ Date/Time and weather
- ✅ Gargabe manager lifetime
- ✅ Auto- and shutdown save (HUGE benefit to game modes that often crash. People can continue to play!)
- ✅ Convert a gamemode into a persistent one as an afterthought without extensive re-writes.
- ✅ Easily extract and apply the essential information needed to restore the state instead of "dumb" full copies.
- ✅ Entities
- ✅ Entity components
- ✅ Scripted class instances
- ✅ Persistent GUID's to identify anything across restarts
- ✅ Even works with baked map objects. If they are named the map objects can also be moved and still corretly be identified back onloading. Includes a proxy utlity to name objects form locked parent scenes!
- ✅ Multiple hives in the same DB possible without conflicts but cross player persistence.
- ✅ Built in versioning support for everything to allow for easy migrations.
- ✅ Many convenience functions to e.g. load and spawn back an entity or scripted instance by its GUID
Detailed information on the individual classes and best practices can be found here.
Depending on the use-case the effort to be put into the setup can vary. But for a simple custom game-mode where each player has one character they spawn back with the setup is quick. The following setup can be seen implemented in the unit test project as an example. Open the TestWorld to have a look.
- Add the
EPF_PersistenceManagerComponentto yourSCR_BaseGameModeinherited game-mode entity. - Go into the component attributes and add a
Connection Infoinstance to something likeEDF_JsonFileDbConnectionInfoand enter aDatabase NamelikeMyGamemodeDatabase. For more info on the available database types please read this. - The persistence system is now up and running but player respawns need to be handled. In game modes where the group and loadout selection is used one needs to decide how they want things to behave - if on re-connect the player spawns automatically and only chooses the loadout on first join or death - or if they always have the option to choose a new one. This integreation into the respawn system that suits the need of the game mode is by far the most complicated aspect. For help consider opening a discussion. In this simple example players spawn with exactly one loadout configured through the
Default Prefabattribute on theEPF_BasicSpawnLogicwhich has to be added to the game mode. - With this setup the play mode can be entered in the workbench for testing, the world can be changed, restarted and everything should be loaded back like it was before the restart.