Thread: Lowest value

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2008
    Posts
    118
    Rep Power
    7

    Lowest value


    In my Zelda game I have a map.
    This map can have 10 floors possible. Each floor can have 100 rooms(10x10).

    A room value will either be a 0(not visited), and 1(visited).

    When I enter another dungeon those values are deleted, which is annoying. So I need to save those values.

    If I wasn't using binary I would use something like this, right?

    start with a value of 0. Then if the room is visited add 1. Then double the value each time.

    val *= 2;
    val++;//if room is visited

    However since the values will get real large, I'll need binary, so would it work like this?

    -double binary value
    -increase binary value by 1


    -------------------------------------
    If your confused at all, then let me ask you this simple question.
    If you had 10 floors with 100 rooms on each floor, how would you save those values?
    Last edited by KingOfHeart; June 12th, 2011 at 05:47 PM.
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,663
    Rep Power
    1958
    Can you explain more about how you have the floors and rooms configured now?

    For the floors i would use an Array setup.

    If the rooms is accessed randomly, you want to use each bit individually. take a look at how Bitwise operation works.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2008
    Posts
    118
    Rep Power
    7
    I use an array already.
    Let me explain it another way.
    When the game is closed out, all arrays are deleted.
    I can save global values though.

    I would like each global value to save an entire level data, however that value will get quite large. Now by using binary that number will be a lot smaller.
  6. #4
  7. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,663
    Rep Power
    1958
    Can you post any code that tells us what and how you have it now?
    How do you save the global value?

    What exactly does the Global values contain? What data type is it?

    Have you tried to use binary? encountered any problems with it?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2008
    Posts
    118
    Rep Power
    7
    I don't have much practice with binary, and I figured before I start I'd at least get the formula (not the coding, but the math)

    I didn't post the code because it's not c++, it's just a similar language. So unless if you have experience in a variety of different languages, doubt you will understand.

    Globals are values that can be saved and used anywhere in the game. So when your game is saved, so are global values. Globals are an index of variables(long).
  10. #6
  11. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,663
    Rep Power
    1958
    Looks like you forgot to post which language you work with.

    The best is to post all facts about what you are working with, this way the reader can better decide whether one's knowledge can be of any help.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2008
    Posts
    118
    Rep Power
    7
    Post your code in C++ then.
    The custom language is made by a program that uses c++, and I've been working with the source. So I should be able to convert.

IMN logo majestic logo threadwatch logo seochat tools logo