2
\$\begingroup\$

Background

Our team is creating an adventure platformer, and I have been tasked with creating a Save Game system.

Our game features the usual progression systems, and is relatively linear.


Approach

I have began my approach by using the EMS Easy Multi-Save plugin for Unreal.


Problem

We have a 'Switch' system:

  • Player takes cube to switch.
  • cube gets used by switch
  • switch can now be activated.

In stage 2, where the cube is used by the switch - the actor for the cube is destroyed in Unreal, and the switch's model is changed to one with a switch.

The EMS plugin does not provide plug-and-play functionality for keeping track of destroyed actors, which means I must do this myself.


Example problem scenario

  • Player approaches area with switch and cube.
  • Player saves game (cube present and switch deactivated)
  • Player picks up cube and takes to switch (cube destroyed and switch activated)
  • Player loads prior save game
  • Scene reloads with switch in the correct state, however the cube is no longer present (it has been destroyed by Unreal and is no longer tracked by EMS)

Problem solving approach

Reading around, I have been given the idea of creating my own class that keeps track of destroyed actors when they are destroyed.

This class can be saved by EMS, and then can reload these destroyed actors if needed when a game is loaded.


Question

There is a lack of real advice for the task at hand here, so I wanted to come here and ask for people's advice and opinions on the best approach to making Destroyed Actors within Unreal compatible with Save Games.

\$\endgroup\$
  • \$\begingroup\$ I am using something like UUID for actors that has to be saved but maybe destroyed - so I am saving the whole actor with its uuid, when I loading the game - I am associating loaded actors to those i have in scene, if the actor is not present in scene I have a boolean that specifies if I have to spawn it or just not load it at all. I don't know if it is the best approach - but... it just works. \$\endgroup\$ – ColdSteel Dec 17 '19 at 16:19
  • \$\begingroup\$ hmm. Could you give me the shorthand explanation of UUIDs? \$\endgroup\$ – Natalo77 Dec 19 '19 at 9:40
  • \$\begingroup\$ GUID (or UUID) is an acronym for 'Globally Unique Identifier' (or 'Universally Unique Identifier'). It is a 128-bit integer number used to identify resources. docs.unrealengine.com/en-US/BlueprintAPI/Guid/index.html \$\endgroup\$ – ColdSteel Dec 19 '19 at 9:51
  • \$\begingroup\$ Hm. And I assume these are unique to the object within my game. For instance, an object I place in my level will have the same UUID regardless of whether I re-open the editor, re-open the map, load it on a different computer, package it and then load it etc.? \$\endgroup\$ – Natalo77 Dec 19 '19 at 11:41
  • \$\begingroup\$ No they are not persistent, but you can manage a map - the uuids will be persistent on load games. \$\endgroup\$ – ColdSteel Dec 19 '19 at 15:57
1
\$\begingroup\$

I'am the developer of EMS. There have been several different approaches in handling destroyed Actors with my plugin.

  1. Fake destruction by turning the Actor off. Disable collision, tick and hide it. Just save a bool to check and turn it off again on the Actor Loaded event.

  2. Maintain a list of Actors in your level blueprint(Or your own class) that is saved/loaded, a simple name array will do it. On destruction, the Actor is added to the list. On level start, you iterate through the list and destroy the Actors in it. If you have a huge amount of Actors, you might want to defer destruction using Lifespan.

I hope this helps.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.