1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to save...

Discussion in 'C' started by cpulocksmith, Dec 20, 2008.

  1. cpulocksmith

    cpulocksmith New Member

    Joined:
    Jul 23, 2008
    Messages:
    289
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    student
    Location:
    canada
    ok well, i have a question. as some of you may know i am trying to make a dungeon like text based game in c++. and so far it is going along quite will, with help from the fine people at this site. but i have one question that i think is going to be a pain. how would i save a game. i really have no idea how to save a game so that you could come back to it latter and you would be at the same position and have the same stats and items. since i realy have no idea and i have search the internet for the answer and fail i now turn to you people to point me in the correct direction. and i feel that i am not going to like the next little peace of code i am going to have to write with this new info i hope you can provide me.

    thanks locksmith...
     
  2. neo_vi

    neo_vi Member

    Joined:
    Feb 1, 2008
    Messages:
    722
    Likes Received:
    15
    Trophy Points:
    18
    Occupation:
    Software engineer
    Location:
    Earth
    Home Page:
  3. cpulocksmith

    cpulocksmith New Member

    Joined:
    Jul 23, 2008
    Messages:
    289
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    student
    Location:
    canada
    well i went through both of those links you gave and i did find some stuff useful but i still really dont know what it is i am supposed to do. if it helps any i am using a unix and not windows.
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Just write whatever information you feel is necessary to a file, and include in the program the logic to read that file and restart the player from a specific point in the game rather than at the beginning.

    Tip: Write it out in text format first, then it's easy to read and to edit. Binary files can be a pain but once you've got it sorted you can switch to a binary format if you like.
    Tip 2: sort out the file read logic first, using hand-crafted savegame files. Once you know what you need in the file you can then write the file write logic.
     

Share This Page