Thread: How do you save...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    731

    How do you save...

    I am atempting to make a very cheesy game with what I know so far. It is just a very simple texted based rpg. But I want the user to be able to save there progress. How do I do that. I am using varaibles for almost everything.

    Thank you!

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    For the duration of a given session use an appropriate container (array/vector, list, etc). For use of information from one session to another, use files.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Look up ifstream and ofstream.

  4. #4
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    alrighty....I'll try.

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    There's lots of different ways to save games. One is to take every last (important) variable in the game, i.e. position, level, number of enemies, each enemy's position and other info, etc. and write it to a file via ofstream, or in other words take a virtual 'snapshot' of the game that you can load at some other time. However, that's prone to abuse (snapshot right before a tough spot, load every time you screw up, snapshot after you've passed). Another is to just save the current level and player attributes, and have them start at the beginning of the level when they load a saved game... But that can be frustrating when you're almost at the end of a level and you have to go.

    The general idea is just to find some way to let the player continue from more or less where they left off, and how you do that is completely up to you as long as it works, and even that's up to you
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    There are also considerations about how easy it is for the user to synthesize a saved game by cracking your file format, but for the most part you just need to learn about file i/o. Data processing can be worried about later.

  7. #7
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    There are also considerations about how easy it is for the user to synthesize a saved game by cracking your file format
    1024-bit encrypted, zipped, encrypted twice and zipped again in another format
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Save vs Save As.... OPENFILENAME flags
    By csonx_p in forum Windows Programming
    Replies: 16
    Last Post: 06-01-2008, 02:42 PM
  2. Replies: 2
    Last Post: 05-09-2008, 07:27 AM
  3. save and save as functions
    By willc0de4food in forum Windows Programming
    Replies: 2
    Last Post: 06-29-2005, 02:49 AM
  4. save webpage? some save some not
    By kryptkat in forum Tech Board
    Replies: 3
    Last Post: 06-07-2005, 09:21 AM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM