### Thread: Lowest value

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

Join Date
Sep 2008
Posts
118
Rep Power
10

#### 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. 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.
3. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Sep 2008
Posts
118
Rep Power
10
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.
4. 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?
5. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Sep 2008
Posts
118
Rep Power
10
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).
6. 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.
7. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Sep 2008
Posts
118
Rep Power
10
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.