I would like to make a checkpoint system and save/load system where there are “n” levels with “n” checkpoints each, and everytime the player gets to one checkpoint, it automatically saves what level and what checkpoint the player has arrived to, so it can load it and spawn the player at the checkpoint the next time they play.
I’m making C++ classes for almost every actor in the game, and then make a blueprint class derived from them to actually use in the game, this icludes the gamemode and game instance.
So, what’s the best (or simplest) way i can do this? Tell me if this is a good idea:
I was thinking about using box triggers and writing in their C++ class some code that checks if the player has overlapped them, and then, as a cast of the gamemode class, i override the preferred Player Start (not sure how) with the one associated with the last triggered checkpoint.
Since saving the game in C++ is way out of my league, how would i use the SaveGame node in Blueprints (inside which BP class?) to make a save file that can be read when the game is launched and just saves at what checkpoint the player has arrived? I tried looking at some tutorials but i cant really understand how saving works and loading works
Lets start with the savegame here two simple cool thingshttps://youtube.com/watch?v=_4usRrTiqakhttps://docs.unrealengine.com/en-US/InteractiveExperiences/SaveGame/index.html
Thats pretty simple, you have to create a savegame My_Savegame blueprint(project), put inside the variables you want to save.
Than in the blueprint, you Create a savegame of the type My_Savegame , and set the values, and save it to a saveslot (An external file )
you have to give a proper name"Game01checkpoints".
Once you want to load it, you first search if there is a saveslot named “Game01checkpoints”
if exist, you can load it ,
once loaded you can use his values.
The Part of detect the plaer checkpoint and save is pretty much what you have said,
you can create an event (if the checkpoint is kill someone for example)
or use a collisionbox, to get the player location, and status, and life… and save it to the gameinstance (that last until you close unreal)
when you want, you can get all info and save them.
When loading the game you have to first,
Load a jolly level, before any level, to know which one you have to load
check if exist a savegame for your game,
if exist ,read the player checkpoint, level ,name…points
Set the gameinstance variable accordingly,
Laiunch the level X
Once the level X is loaded, it should check the checkpoint and spawn/move your char in the correct place