Saving to load a dat

Talk about making games.

Saving to load a dat

Postby knucklecrunchgames » Sun Jan 12, 2014 5:44 pm

Hello everyone. I wanted to ask a question to finally finish my game

How do I load the dat that the player has saved from another dat.

Example: On mainmenu.dat you press new game, you play and you turn off for now. When you turn on you press load game and you load on the dat you saved on.

How could I do this?

And thankyou for everything everyone :) :) :)
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: Saving to load a dat

Postby Goettsch » Sun Jan 12, 2014 8:21 pm

you already made this question and lcl already asked it,it is impossible to do what you want
viewtopic.php?f=2&t=13134
Support me and open these links:
http://adf.ly/pZps0 (as many times as you can)
http://VisitsToMoney.com/index.php?refId=470333 (open once)
http://Visitors2Cash.com/ref.php?refId=169224 (open once)
My games:
Kingdoms of... http://adf.ly/pZq5O
Goettsch
 
Posts: 124
Joined: Fri Jun 28, 2013 10:00 pm
Score: 5 Give a positive score

Re: Saving to load a dat

Postby knucklecrunchgames » Sun Jan 12, 2014 9:52 pm

Goettsch wrote:you already made this question and lcl already asked it,it is impossible to do what you want
viewtopic.php?f=2&t=13134


Goettsch If your so quick to reply lecturing me then explain how you do it. :evil:
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: Saving to load a dat

Postby skydereign » Sun Jan 12, 2014 10:18 pm

knucklecrunchgames wrote:Goettsch If your so quick to reply lecturing me then explain how you do it. :evil:

All Goettsch is saying is If you already asked a question don't create another topic about it. It is okay to bump the other topic if you didn't get the answer you wanted. That being said if I understand your question, I don't think this is exactly a repeat (though I feel you should have posted it on the other topic). To answer your question you would have one save file (created via saveVars). In addition to saving the player's position, you also need to save which level file they are in. That means every time they transition to a new level file (the new .dat) you must save the name of that .dat, that way in the menu when you want to load a save file you can use LoadGame on that saved file name.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Saving to load a dat

Postby knucklecrunchgames » Sun Jan 12, 2014 10:43 pm

skydereign wrote:
knucklecrunchgames wrote:Goettsch If your so quick to reply lecturing me then explain how you do it. :evil:

All Goettsch is saying is If you already asked a question don't create another topic about it. It is okay to bump the other topic if you didn't get the answer you wanted. That being said if I understand your question, I don't think this is exactly a repeat (though I feel you should have posted it on the other topic). To answer your question you would have one save file (created via saveVars). In addition to saving the player's position, you also need to save which level file they are in. That means every time they transition to a new level file (the new .dat) you must save the name of that .dat, that way in the menu when you want to load a save file you can use LoadGame on that saved file name.



I think I half understand it, but can you make it a bit more simple for me to understand,

thankyou for your time
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: Saving to load a dat

Postby skydereign » Sun Jan 12, 2014 10:53 pm

knucklecrunchgames wrote:I think I half understand it, but can you make it a bit more simple for me to understand,

You understand how to save the player's position in a single .dat file already. All you do is save the variables, that way when you load up the dat file you can load the saved variables and update the player's position to the correct spot.

Now that you have multiple .dat files for the multiple levels, you need to also remember which level file the player is in. To do this you can have one more variable that you keep track while saving and loading. This variable holds the name of the .dat file the player is currently in.

The player starts a new game. As the game loads it saves the name of the file into your save file. If the player wants to take a break, they exit the game and you save their position within the level. Now the player starts the game and selects load game. In the menu it loads the save file and now has the name of the file it needs to load, and calls LoadGame on it. The player then beats the level and moves onto the next one. Just like with level one when the player enters the level it saves the name of the current level file into your save file. That's it.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Saving to load a dat

Postby knucklecrunchgames » Mon Jan 13, 2014 3:58 pm

skydereign wrote:
knucklecrunchgames wrote:I think I half understand it, but can you make it a bit more simple for me to understand,

You understand how to save the player's position in a single .dat file already. All you do is save the variables, that way when you load up the dat file you can load the saved variables and update the player's position to the correct spot.

Now that you have multiple .dat files for the multiple levels, you need to also remember which level file the player is in. To do this you can have one more variable that you keep track while saving and loading. This variable holds the name of the .dat file the player is currently in.

The player starts a new game. As the game loads it saves the name of the file into your save file. If the player wants to take a break, they exit the game and you save their position within the level. Now the player starts the game and selects load game. In the menu it loads the save file and now has the name of the file it needs to load, and calls LoadGame on it. The player then beats the level and moves onto the next one. Just like with level one when the player enters the level it saves the name of the current level file into your save file. That's it.


I'm so sorry to waste your time sky, but I still don't understand it.

Where and what codes do I put in, Again, so sorry for wasting your time :(
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: Saving to load a dat

Postby skydereign » Mon Jan 13, 2014 4:06 pm

knucklecrunchgames wrote:I'm so sorry to waste your time sky, but I still don't understand it.

Where and what codes do I put in, Again, so sorry for wasting your time :(

What part don't you understand? The idea is almost exactly like saving the player's position in a file (something that you said you did understand). The only difference is to create one more variable that holds what game file the player is in.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Saving to load a dat

Postby knucklecrunchgames » Mon Jan 13, 2014 4:23 pm

skydereign wrote:
knucklecrunchgames wrote:I'm so sorry to waste your time sky, but I still don't understand it.

Where and what codes do I put in, Again, so sorry for wasting your time :(

What part don't you understand? The idea is almost exactly like saving the player's position in a file (something that you said you did understand). The only difference is to create one more variable that holds what game file the player is in.


I know how to make the variable that holds the position, but What I don't know what code I would use to hold what game file the player is in. I there any ged that explains it or tutorial.

Thankyou for putting up with me. :)
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: Saving to load a dat

Postby skydereign » Mon Jan 13, 2014 4:44 pm

knucklecrunchgames wrote:I there any ged that explains it or tutorial.

No, because all it takes is one line. Do you know anything about strings?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Saving to load a dat

Postby knucklecrunchgames » Mon Jan 13, 2014 4:54 pm

skydereign wrote:
knucklecrunchgames wrote:I there any ged that explains it or tutorial.

No, because all it takes is one line. Do you know anything about strings?


no. what do strings do? :?: :?:
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: Saving to load a dat

Postby skydereign » Mon Jan 13, 2014 6:14 pm

Please do not bump topics until at least a day has passed since the last post. Have a little patience, we can't always answer immediately.
knucklecrunchgames wrote:no. what do strings do? :?: :?:

Strings store text. You can create them the same way you create other variables for saving. For what you need (saving the name of the file) you just do this.
Code: Select all
strcpy(string_variable, "nameoffile.dat");
// now saveVars will save string_variable into the save file
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Saving to load a dat

Postby knucklecrunchgames » Mon Jan 13, 2014 6:34 pm

// now saveVars will save string_variable into the save file


Does this mean when you press load game it will load the dat the player saved on?
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: Saving to load a dat

Postby skydereign » Mon Jan 13, 2014 6:39 pm

knucklecrunchgames wrote:Does this mean when you press load game it will load the dat the player saved on?

Think about it. When you call LoadGame you pass in a string holding the file name of the file you want to load. I told you how to store a string into a variable so that you can save it. To access that variable so you can use it for LoadGame, you'll have to call loadVars. You should reread my posts and see if you understand what I was telling you now.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Saving to load a dat

Postby knucklecrunchgames » Mon Jan 13, 2014 6:42 pm

skydereign wrote:
knucklecrunchgames wrote:Does this mean when you press load game it will load the dat the player saved on?

Think about it. When you call LoadGame you pass in a string holding the file name of the file you want to load. I told you how to store a string into a variable so that you can save it. To access that variable so you can use it for LoadGame, you'll have to call loadVars. You should reread my posts and see if you understand what I was telling you now.


when I put this code in an error comes up. What do I put it in?

load game or level 1, level 2 ect
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Next

Return to Game Development

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron