Hi all,
I wish to ask about this function. I’m following the documentation and saw that this function asks for these. I plan to make some highscores, the top 10 will be displayed so is the player gets better, the game will overwrite the older data. Now, if I create a save with the exact same slot name and ID, it will mean that there will be only one highscore?
If so, it means that on every attempt I try to save, like after a level, I will have to read the highscores, check how this score fits and overwrite that using the slot name and ID?
Also, I have multiple game modes. Shall I create different save classes for each?
Thanks again for your help, I will check it out.
Greetings again @agiro,
first of all let’s clear doubts
a save game saves some variable you want (read,write) in a slot ,a slot when created saves values as specified , if not specified it uses there default values. you will only need one slot until you want your game to be like PROTOTYPE , KINGDOM RUSH.
so how to make the system you specified , let’s get to that now,
1.make an save game object
2.open the save game objects BP to add whatever variables are to be saved(in this case ,a float array)
arrays are being used for making it fast and tidy(also to be able to avoid making large number of variables).
for loading save game
for saving the game score ,it’s complicated so that it appears in ascending order (replace current score with the score player get’s)
make sure slot name is same everywhere
this has not been tested by me so there may be a few errors test this out and let me know.
Hope it helps!
Did you got it working? it’s not easy to figure it out at start but once you do ,it will be the easiest of all other things.you can use basic float(not the array) for starting but that will require a bit more work than this although the logic will be very simple.
Heh awesome you are, checking in on me
I suspended save game for a little time, I was designing the main menu UI and the how to play slideshow. I will tend to the save game afterwards and that will be the last step as all my levels are functioning, the game will be ready
@Prithvi Singh I tried to make it work, using your instructions and the one found online https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/
Unfortunately it does not work.
What I wanted to do is after a successtul level, load the saves, check where the new score fits, if it can, move everything else below it one rate back and insert, if can’t then don’t. I do save the scores afterwards.
When I try to check in my highscores widget what happens, it says I don’t have the save slot, even if I just created it. Any ideas?
By the way I did not build the game. I have the main menu on a different level than the actual playing levels. So I played the level, completed it, it should have saved it. Then close app, select main menu, start the game and read highscores, where it should load, but it says, does not exist.
check if the create save game object is triggered even once. that’s all needed to make an saved game slot (the one i added in loading save game) .
i forgot to add this in between (casting to the save game object when created) but i don’t think it will be needed as i never made it and it worked well
http://https://docs.unrealengine.com/latest/images/Gameplay/SaveGame/Blueprints/SaveGameBP_1.jpg
make sure to check if this is created in your game while testing in viewport PIE
i answered something related to save game back here but was totally different
I have no .sav file and it did not create. Wonder why
This is the rig. It fails to cast as there is no save it says.
first you need to make sure wherever you play , once the create save game object node must be triggered ,once it’s triggered you can test without triggering it every time,( no need to build the game to test save game just make sure that thing shown in image above is there in your project files, can be of any name but the format should be .sav)
It does go through that node “create save game object” can even be casted but to no avail. Please check my node setup a comment above (I organized this two comments real poor )
i guess you have not made your own save game , even if you have you are not using it , that’s the default one you are using i guess
even if you are, give it some other name.
please check the photos above
@Prithvi Singh advancement, but still bad
The main issue was one that you said, then I realized I have to make string save slot names RIGHT INSIDE the save game file, because my slots were “” strings. So now I could write and read the file, but my datas were not in there = I had “0” in there.
try the i method i showed because from the image i can make out that you are creating totally new saved games each time (does save game exists is way ahead and create save game object is always triggered , it should be triggered only if saved game is not there)
in this question i explained the basic save structure , does save game exist must come first and then the others,
Now I have it check for a save beforehand and after completing the level it pops up some error, trying to write to a non existent slot.
https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/
In the link I already posted they say it is just an instance (the create save game object) so one can access his/her save files.
I might have misunderstood it, you say one does not have to automatically call that create save game object function?
create save game needs to only be called for the first time player is playing the game so that there is an copy of values you specified which are overwritten(save game to slot) as player proceeds and called after wards(load game from slot) and removed (if remove from slot)is called
try removing the created file i pointed out above (save>saved game> [your slot])
for removing it just go in the file and delete that one manually (don’t remove from recycle bin)
try to run the game as the player will , from menu where slot will be created and then proceed to the level.where it will be saved or rather overwritten.
Yes, I think I got it now, I have the slot’s name both in my levels and in my savegame BP. I first check if does save game exist, the string input is the name I stored in my level (I stored it so I don’t have to create over and over again).
Now, branch: if exists, then load it, cast it, check for errors, then put my values in it, then save it with my save game to slot. Am I right?
So it is NOT like in widgets that I create them all the time?
By the way I still have to implement it, doing it right now.
yes, you are right.but when level changes the variable in your level won’t exist (level BP changes and variables of object can’t remain in level as explained earlier ) , so load it for each level or save it in game instance( and load it again when values change)
by the way, the value from save game are loaded way to quickly if information is less (only 10 high-score right?) loading takes time if your game is large like it have upgrade ,health ,status ,enemies killed etc , mine craft will have high amount of variable i guess.
About that, so I have 5 time values and an avegrage. this 6 means 1 score. To get this easy, I store the 5 time values as appended string, and keep a float that is the average, as I measure the scores by the avg. I decided to have the top 5 instead of 10 so it can fit nicely without scrolling on one screen,