Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Making a Save Function

This topic is 5314 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve looked through tons of VB6 books, and I can''t figure out how the heck to make a save function for a game. I''m making an RPG right now, but it''s going to be pretty pointless to collect tons of items and slaughter hundreds of fiends if you can''t even save the game. Does anybody know how? -NeoMage

Share this post

Link to post
Share on other sites
You just save all data in binary mode in a certain order, then you load that data in the same order later. If you got resizeable arrays you save the size before the actual array data, and then create the array from that size before you load the data. With VB''s built in functions this is pretty simple if your game data is limited to single variables, arrays and user-defined types.

If you don''t know about the functions to do file operations, check Open, Close, Put/Write and Read statements in the help file. It was a while since I did these VB things myself so I can''t offer any more specific help.

Share this post

Link to post
Share on other sites
Like the guy said above, just save all the data you want to remember.

for an RPG (level, character stats, area, etc). You can even save it as text data if you want. You just have to make sure you load it all in the same way you sent it out when you want to load.

Name the file something like the main characters name, so yu can distinguish between different players.

Share this post

Link to post
Share on other sites
You need to use VB''s Open, Put and Get statements, which you can use to write binary files:
Open MyFilename For Binary As #1

Dim MyBoolVar As Boolean
Dim MyIntVar As Integer

MyBoolVar = FALSE
MyIntVar = 42

Put #1, , MyBoolVar
Put #1, , MyIntVar

Close #1
Just use the Put statement to write to a file, and the Get statement to read from a file...

Windows 95 - 32 bit extensions and a graphical shell for a 16 bit patch
to an 8 bit operating system originally coded for a 4 bit microprocessor,
written by a 2 bit company that can''t stand 1 bit of competition.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!