x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Save game to slot: ID and slot name?

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?

Product Version: Not Selected
Tags:
more ▼

asked Jul 14 '16 at 07:31 AM in Blueprint Scripting

avatar image

agiro
95 8 12 18

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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 alt text

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). alt text

for loading save game alt text

for saving the game score ,it's complicated so that it appears in ascending order (replace current score with the score player get's)alt text

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!

zsave.jpg (453.0 kB)
zzsave.jpg (387.6 kB)
zzzsave.jpg (470.7 kB)
zzzzsave.jpg (458.0 kB)
more ▼

answered Jul 14 '16 at 12:07 PM

avatar image

Prithvi Singh
560 16 9 14

avatar image agiro Jul 14 '16 at 12:11 PM

Thanks again for your help, I will check it out.

avatar image Prithvi Singh Jul 14 '16 at 04:18 PM

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.

avatar image agiro Jul 14 '16 at 04:48 PM

Heh awesome you are, checking in on me :D 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 :D

avatar image agiro Jul 15 '16 at 11:07 AM

@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?

avatar image Prithvi Singh Jul 15 '16 at 11:28 AM

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
alt text

make sure to check if this is created in your game while testing in viewport PIEalt text

i answered something related to save game back here but was totally different

zzz.jpg (195.9 kB)
avatar image agiro Jul 15 '16 at 11:37 AM

I have no .sav file and it did not create. Wonder why :( [URL=http://s1268.photobucket.com/user/agiro8747/media/issue_zpslagomnfb.jpg.html][IMG]http://i1268.photobucket.com/albums/jj563/agiro8747/issue_zpslagomnfb.jpg[/IMG][/URL] This is the rig. It fails to cast as there is no save it says.

avatar image Prithvi Singh Jul 15 '16 at 11:48 AM

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.

alt text

zzz.jpg (392.4 kB)
avatar image agiro Jul 15 '16 at 12:10 PM

@Prithvi Singh advancement, but still bad :D 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.

avatar image Prithvi Singh Jul 15 '16 at 12:27 PM

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,

avatar image agiro Jul 15 '16 at 12:42 PM

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?

avatar image Prithvi Singh Jul 15 '16 at 01:03 PM



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.

avatar image agiro Jul 15 '16 at 01:12 PM

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.

avatar image Prithvi Singh Jul 15 '16 at 01:41 PM

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.

avatar image agiro Jul 15 '16 at 01:47 PM

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,

avatar image Prithvi Singh Jul 15 '16 at 02:23 PM

well, i had once made an game which had only 1 integer to save (which level the player is on) so i just loaded it and saved it there only ,it was not even noticeable , then the other game which had arrays storing at least 200 materials , that was also quick as most things were done in construction script.

now the method you are using is storing before hand , nice trick but don't forget to update that value just after saving else you will be in trouble.also save it as soon as player finishes the level else sometimes the device is slow or got heavy files ,cache of other apps can make your game crash (or phone hangs) and gamer annoyed that why it didn't save,
. so make sure of these.

avatar image agiro Jul 15 '16 at 02:28 PM

GOT IT WORKING!! a day of distress, but it is worth it. Not all heroes wear cape, you know that? :D All the help very much appreciated. Now I think more or less I understand how the save game works. I had this score, an accuracy of 45%, stored it, no matter how many times I restart the game, the value is there :D If I overwrite it, it get overwritten, I think this satisfies the definition of "working". Once again, a thousand thanks!

avatar image agiro Jul 15 '16 at 02:29 PM

By the way I don't know what I didn't understand at the beginning -_- took me long enough.

avatar image agiro Jul 15 '16 at 02:44 PM

Just another thing, how do I delete my save games? I mean not just one, but all of them? just overwrite with an invalid number?

avatar image Prithvi Singh Jul 15 '16 at 02:58 PM

there is just one slot you have with different value and many variables , rights?

if you want to delete them from blueprint (during the game after build ,like reset game) try this node

if you want to delete them while developing (due to new variables made or some errors ,delete the file manually , delete from slot does the same but this is fast while devloping
alt text

zzz.jpg (344.8 kB)
avatar image Prithvi Singh Jul 15 '16 at 03:48 PM

thanks to you as well , just noticed my name is on the "this week's top karma list"

2nd position :D
(not quit sure how i got there but most of the questions i answered were yours ,so credit goes to you as well!).

avatar image agiro Jul 15 '16 at 03:51 PM

Because you deserve it, that's how :D Hope future or current employers will see it too :D

avatar image agiro Jul 15 '16 at 04:15 PM

@Prithvi Singh yet another question here: The scores now work as they should, but only if a player exits during the game. The scores do not get saved when we hit "retry". On this button we only have a get current level name and an open level. On the exit we have a quit application. What might be the problem?

avatar image Prithvi Singh Jul 15 '16 at 04:29 PM

when are they both triggered? does the save game gets triggered before quit?

avatar image agiro Jul 15 '16 at 04:38 PM

Looks like it was false alert, or I might messed up the rounding (the highscores were saved in float, the output at the ending is percent). Now it saves the scores and orders them as should no matter if the player exits, plays it again, or plays again, but the replay is interrupted. I would call it a success :D

avatar image Prithvi Singh Jul 15 '16 at 04:40 PM

the save game logic(the part used to save the game) must be applied before the level gets restarted or exited to make it work as intended.

avatar image agiro Jul 15 '16 at 11:21 AM

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.

avatar image Prithvi Singh Jul 15 '16 at 11:40 AM

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)

avatar image agiro Jul 15 '16 at 11:42 AM

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 )

avatar image Prithvi Singh Jul 15 '16 at 11:58 AM

please check the photos above

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question