Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Binary Boolean Array Storage
Binary Boolean Array Storage
Sep 6 2009, 6:13 am
By: Falkoner  

Sep 6 2009, 6:13 am Falkoner Post #1



I was walking around, thinking, like I usually do, when I started thinking about a question I had asked myself years before: How does the map, Bounds, work?

For those of you who haven't played the map, it's probably one of the coolest bound maps you'll ever find. It's a make your own bound map, but it's not like the other lame ones where there's a few stupid obstacles already made for your convenience, this is a purely explosion dodging bound maker, and it is extremely customizable.
You have a 4x7 grid of Lurkers, that you cast Dark Swarm on to select. When you select a Lurker, a Dark Archon appears above it, and it has been marked as an exploding spot. You can do this wherever you like, and then you cast Dark Swarm on a crystal to change to the next step in the bound, each bound has 9 steps, a series of 9 explosions that go sequentially then start over, in each step you record the pattern of the explosions you want, and when you're done it runs through them all, repeatedly, creating your custom bound.
The map supports 5 human players.




Before you move on, I want you to take a moment to think, how would I do it?
When I first thought about it years ago, I thought of using the same method that is actually used in the map. Which is simply spawning different units under the Lurker depending on which step the player is on, simple enough and effective... But can you think of another, more efficient method?




I like to call it, Binary Boolean Array Storage, BBAS for short :lol: I'm almost sure this is not a new idea, however, I have never seen the idea mentioned in forums or in any tutorial, I'm sure it's been used, but rarely.

This method allows you to store what would normally take 32(31 depending on how you look at it), switches, in a single death count, for a single player. That's 248 switches per unit. Interested now? Well, read on ^^

To show you how it works, I'm going to give an example of it in action, doing what is done in the map Bounds, on a smaller scale, a 3x3 grid of lurkers.
Here's how the grid looks:


Now, each section in the array is assigned a different multiple of two, in this case I would assign the numbers in the same order that SC would run through the lurkers as a unit grid, left to right, bottom to top, the locations are only to show the assigned numbers:


Whenever a unit is selected, their assigned number is added to a death, if that lurker is deselected, you subtract that amount:


Now, when the player runs their bound, you start from the highest and go to lowest, seeing if the Death has that much in it, and making an explosion in the assigned spot if there is, so in this case, 273, there is at least 256, so it subracts 256, leaving 17, and creates a DA in the 256 spot, then it runs through, no 128, no 64, no 32, but 16 can go into 17, so it subtracts 16 puts a DA in the 16 spot, now it keeps going, no 8, no 4, no 2, there is a 1, so it puts a DA in the 1 spot. Now you kill the DAs, and you have your explosions!

It's a much more efficient system, using only a single Death Count, rather than using tons of different units. And it can be applied in all sorts of maps.

Post has been edited 4 time(s), last time on Sep 7 2009, 5:17 am by Falkoner.



None.

Sep 6 2009, 6:59 am Jack Post #2

>be faceless void >mfw I have no face

That is hot. I already knew how to use this but still, well done explaining it.



Red classic.

"In short, their absurdities are so extreme that it is painful even to quote them."

Sep 6 2009, 8:51 pm Doodle77 Post #3



Quote from Falkoner
This method allows you to store what would normally take 23(give or take 1), switches, in a single death count, for a single player. That's 184 switches per unit. Interested now? Well, read on ^^
32 (maybe 31) switches per death count.



None.

Sep 6 2009, 8:59 pm fire1337 Post #4



Yeah, i played this before.
It actually isint that hard to figure out. Not to be a "perfectionist" but that map would be a lot better with a bigger layout.
Anyways, im pretty sure that anyone on this website can replicate this map, but the person who made this map was a genius. With that being said, it would be better if there were multiple layouts, and you could choose which layout you want.
However, that would require a lot of locations, or maybe even gridding.
Anyways, I kinda strayed off topic, but good job explaining this, Falknah.



None.

Sep 6 2009, 9:03 pm JaFF Post #5



Since any number can be expressed as a unique sum of powers of 2 with no power being repeated, you can use 1, 2, 4, etc. instead of the ones you used.

And yeah, this is far from new. :P Congrats on discovering it for yourself, I guess.



None.

Sep 6 2009, 9:50 pm rockz Post #6

ᴄʜᴇᴇsᴇ ɪᴛ!

This isn't efficient in the slightest. Maybe it's worthwhile if you have 228*12 unit types in use through death counts, but otherwise, no. In terms of triggers, it's much easier to use a brand new death count. Less triggers=smaller map. You could have used player 1-9 deaths of cantina and still had plenty of death counts to spare.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Sep 7 2009, 12:54 am Falkoner Post #7



Quote
32 (maybe 31) switches per death count.

Ah you're right, it's 31, I just stopped when I saw the first big number starting with a 4, thinking that one was the Death Count limit, thanks for correcting :)

Quote
Since any number can be expressed as a unique sum of powers of 2 with no power being repeated, you can use 1, 2, 4, etc. instead of the ones you used.

I did use 1, 2, 4, etc..? But yeah, any power of two up until 4294967296 can be used(although you might have to go one less, I think..)

Quote
And yeah, this is far from new. :P Congrats on discovering it for yourself, I guess.

Well, for like the past few months I keep thinking of systems that involve this being the focal point, I just started thinking about how I could explain it easily last night.

Quote
In terms of triggers, it's much easier to use a brand new death count.

Is it? Maybe mentally, but all it takes is a few notes to remember what numbers coordinate to what things, I like it because it sorta forces you to take notes, and it keeps the map itself clear.



None.

Sep 7 2009, 1:09 am Kaias Post #8



Welcome to death counters.



None.

Sep 7 2009, 1:10 am Morphling Post #9



Is this just plain old binary countoffs or am I missing something?
Quote from Falkoner
I did use 1, 2, 4, etc..? But yeah, any power of two up until 4294967296 can be used(although you might have to go one less, I think..)
It goes up to 2147483647((2^31)-1). Anything more is a negative number. 4294967296(2^32) and above is counted as zero.

Post has been edited 3 time(s), last time on Sep 7 2009, 1:21 am by Morphling.



None.

Sep 7 2009, 1:27 am Falkoner Post #10



Quote
Is this just plain old binary countoffs or am I missing something?

Yeah, but using them to store an array of boolean data, you're really storing several values in one when you do this.

Quote
It goes up to 2147483647((2^31)-1). Anything more is a negative number. 4294967296(2^32) and above is counted as zero.

It's signed, but SC will still allow you to go up further.



None.

Sep 7 2009, 1:41 am Morphling Post #11



Okay I see what you mean.... I had always known about this since I knew about death counters. I was using this in many of my maps which never were completed.:}(my own versions of Pixel Adventure and Mario Minimap Movie)



None.

Sep 7 2009, 4:56 am Wormer Post #12



Quote from Doodle77
32 (maybe 31) switches per death count.

Quote from Falkoner
Ah you're right, it's 31, I just stopped when I saw the first big number starting with a 4, thinking that one was the Death Count limit, thanks for correcting :)

STOP. The highest degree is 31, right, but you can store 32 switches as far as you start from zero:
2^0 2^1 ... 2^31 - 32 degrees overall.

Quote from Morphling
It goes up to 2147483647((2^31)-1). Anything more is a negative number. 4294967296(2^32) and above is counted as zero.
Or is there even more numbers one can store in a DC? I always forget, how many bit's is there? Is it a 64-bit signed integer variable?



Some.

Sep 7 2009, 5:16 am Falkoner Post #13



Quote
The highest degree is 31, right, but you can store 32 switches as far as you start from zero:
2^0 2^1 ... 2^31 - 32 degrees overall.

Yeah, but it truly depends on what you're doing with it, I prefer to consider the 0 not really on option, at least in this case I wouldn't, although I guess it sorta is :/

Quote
Or is there even more numbers one can store in a DC? I always forget, how many bit's is there? Is it a 64-bit signed integer variable?

It's 4294967295, that's the actual limit.



None.

Sep 7 2009, 5:55 am Wormer Post #14



Quote from Falkoner
It's 4294967295, that's the actual limit.
It might not be an actual limit if a death counter is a 64-bit integer, because what matters is the number of bits in variable but not the maximum integer number it can store.



Some.

Sep 7 2009, 11:56 am Clokr_ Post #15



A death counter is 32 bits. Not sure if signed or unsigned. If unsigned you can store 32 boolean values, if not, only 31.

This is nothing new. Congrats figuring out how rantent's map works :P
Also you can use the boolean values to store anything, not only placement arrays.



?????

Sep 7 2009, 6:30 pm poison_us Post #16

Back* from the grave

Quote from fire1337
Anyways, im pretty sure that anyone on this website can replicate this map, but the person who made this map was a genius.
Sounds much like Calculus. :P

Quote from Falkoner
Quote
It goes up to 2147483647((2^31)-1). Anything more is a negative number. 4294967296(2^32) and above is counted as zero.

It's signed, but SC will still allow you to go up further.

So we could toy with numbers higher than 429967296? Or would it be like a damage of 66536 and return to 0, then go up again? Please explain. :wtfage:




Sep 7 2009, 7:41 pm Morphling Post #17



Quote
So we could toy with numbers higher than 429967296? Or would it be like a damage of 66536 and return to 0, then go up again? Please explain. :wtfage:
This is correct:
Quote
It goes up to 2147483647((2^31)-1). Anything more is a negative number. 4294967296(2^32) and above is counted as zero.




None.

Sep 7 2009, 8:38 pm poison_us Post #18

Back* from the grave

Quote from Morphling
This is correct:
Quote
It goes up to 2147483647((2^31)-1). Anything more is a negative number. 4294967296(2^32) and above is counted as zero.
...But Falk said...
Whatever. I don't ever deal with numbers as big as 216, so I'm fine not knowing definitely either way.




Sep 7 2009, 8:49 pm rockz Post #19

ᴄʜᴇᴇsᴇ ɪᴛ!

1111 1111 1111 1111 1111 1111 1111 1111 = 4294967295 or -1
1 0000 0000 0000 0000 0000 0000 0000 0000 = 4294967296 or 0
starcraft only reads the last 32 bits, which means 4294967296 will loop back to 0.
1 0000 0000 0000 0000 0000 0000 0000 0001 = 4294967297 or 1
scarcraft will read this a 1.

This is assuming the map would save with these numbers. Not to mention, it reads them as signed numbers, which means the most significant bit is equal to adding -2147483648.
0111 1111 1111 1111 1111 1111 1111 1111 = 2147483647
if you add the last bit, 2147483647 - 2147483648, you'll note the answer is -1.

also, numeric values are stored in 4 bytes (8^4=2^32). Since it's signed, you can only store 31 bits easily. You can probably mess around and get the 32nd bit, but it's hard and pointless.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Sep 7 2009, 9:34 pm Doodle77 Post #20



Quote
Since it's signed, you can only store 31 bits easily. You can probably mess around and get the 32nd bit, but it's hard and pointless.
Addition and subtraction is identical with signed and unsigned integers.

Death counts are unsigned. Here is a test map: [attach=4470]

Attachments:
test.scm
Hits: 2 Size: 38.61kb

Post has been edited 2 time(s), last time on Sep 7 2009, 9:44 pm by Doodle77.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:19 pm]
Vrael -- IM GONNA MANUFACTURE SOME SPORTBALL EQUIPMENT WHERE THE SUN DONT SHINE BOY
[2024-5-02. : 1:35 am]
Ultraviolet -- Vrael
Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
Gonna put deez sportballs in your mouth
[2024-5-01. : 1:24 pm]
Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
[2024-4-30. : 5:08 pm]
Oh_Man -- https://youtu.be/lGxUOgfmUCQ
[2024-4-30. : 7:43 am]
NudeRaider -- Vrael
Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
[2024-4-29. : 6:36 pm]
RIVE -- Nah, I'm still on Orange Box.
[2024-4-29. : 4:36 pm]
Oh_Man -- anyone play Outside the Box yet? it was a fun time
[2024-4-29. : 12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[2024-4-29. : 11:17 am]
Zycorax -- :wob:
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
Please log in to shout.


Members Online: Oh_Man, Roy