Save and Load game, please help me I have a smooth brain

Hi,

I have no idea what I’m doing when it comes to saving and loading a game, it sounds simple, it’s made to sound simple, there are various tutorials on various ways you can do it, I’ve got a cluster f*ck of a setup now that hardly works, I need a professional.

What I want to do…

  1. At the Main Menu, I can click New Game and it will start a new game at the Player Start and once loaded, it will then save the current location and set variables for the player like ‘hasredkey’ or ‘hasbluekey’ to no for example.

  2. When the player overlaps a collision box I want the game to save, the current location, the state of the world e.g if doors are open or closed and variables like the keys again, perhaps the player has one or two now they should be saved.

  3. When the player exits to the main menu, a continue button will appear, when the continue button is clicked it will load the location, variables and game state.

  4. If the player has a save already and hits new game, it should overwrite this save and create a new one.

For the life of me I can’t work this out properly.

What I can do currently…

  1. Start new game, start at the playerstart
  2. Save game appears to work as I have a manual button to trigger it at the moment
  3. Continue game spawns the player at the 0,0,0 position instead of where it should have saved the last location

I’m asking a lot here so I am willing to pay for a service if required but thought I should at least see if anyone is up to the task here

main menu widget (where new game and continue is)

Save Game Function (also inside main menu bp)

Load Game Function (also inside main menu BP)

3 Likes

Hey @judgejames!

My suggestion is that should be loading your game from a game instance to ensure that the data is not lost between levels. Check out this in depth non-Epic affiliated tutorial that would give a better setup for your save/load:

Let me know if the above works for you.

4 Likes

This is great, I followed it, but the only thing he doesn’t cover is actually using it from say a main menu, he just runs it from the straight from player, if he had that, it would be a near perfect tutorial!

So how do I implement this when clicking ‘New Game’ and then as a returning player clicking ‘Continue Game’?

This doesn’t create an error but it just sits at the loading screen and nothing happens, I’ve tested with a print string at the end but it never gets there seems to fail at the CAST TO

I also have this in the Player itself

2 Likes

I think you should ensure that when the player clicks “New Game,” any existing save is overwritten. For loading, make sure the player spawns at the correct location and that the world state and variables are restored. Double-check your save function to ensure it captures all necessary data accurately, and your load function properly restores it. Testing thoroughly can help identify any bugs or issues. If you’re struggling, consider reaching out to a professional game developer for assistance.

1 Like

@husyn02 That’s why I’m here, to get game dev assistance, and I’m seeking specific help as I described above.

1 Like

Trying a different solution, this is closed

Follow here if interested: Saving variables to save game

2 Likes