Why did Pixel make the Deathtraps do 127 damage?

Nov 26, 2014 at 1:52 AM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Sep 11, 2014
Location: Out of Nowhere
Posts: 95
Why did Pixel make the Deathtraps do 127 damage? Well, actually, I think that this is the answer:
It's ASCII (American Standard Code for Information Interchange). ASCII codes represent text/characters/functions. For example: 65 (A), 97 (a), 32 (Space), and 27 (ESC).

So what is 127? The answer is DEL. Delete. Get it? The spikes are deleting Quote. I could be wrong, but then again, when you're thinking of a number for a trap that instantly kills the player, it doesn't seem like 127 would be your first choice for no reason.

So do you think I could be right, or do you think that it actually was just random?

80 117 109 109 101 108 97 116 111 114 105 115 97 103 101 110 105 111 117 115
 
Nov 26, 2014 at 2:13 AM
Forever 12
"Big Joe Tire and Battery Restaurant! Opening Soon! Eat at Big Joes!"
Join Date: May 24, 2013
Location:
Posts: 539
Wow, thats a Nice Connection.

I honestly don't know if this was a coincidence or not... but its neat that you found this out.
 
Nov 26, 2014 at 2:14 AM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
127 is signed byte maximum value
 
Nov 26, 2014 at 2:14 AM
Senior Member
Modding Community Discord Moderator
CSE Discord Moderator
"I, Ikachan. The Life and Documentary of the OrigiNAL SQuiD."
Join Date: Jan 14, 2014
Location: Antarctica (The Penguins say Hi)
Posts: 150
Age: 24
Pummelator said:
Why did Pixel make the Deathtraps do 127 damage? Well, actually, I think that this is the answer:
It's ASCII (American Standard Code for Information Interchange). ASCII codes represent text/characters/functions. For example: 65 (A), 97 (a), 32 (Space), and 27 (ESC).

So what is 127? The answer is DEL. Delete. Get it? The spikes are deleting Quote. I could be wrong, but then again, when you're thinking of a number for a trap that instantly kills the player, it doesn't seem like 127 would be your first choice for no reason.

So do you think I could be right, or do you think that it actually was just random?

80 117 109 109 101 108 97 116 111 114 105 115 97 103 101 110 105 111 117 115
Very interesting reason, and while that could be it there is a technical reason aswell.

In C/C++ there is a data type called a char(acter) which can hold a value between -127 and 127.
So it could just be that 127 was the most damage any entity could do so it would make sence to make the instant kill spikes do the most damage out of any entity in the game.
On a similar note, if you mod the game to give Quote's health a value over 255 and then pick up a heart, your max health will default to 255.
There is another data type in C/C++ called an unsigned char which holds a value between 0 and 255.

This all points to Cave Story being built in C or C++ but I'll leave that up to the ASM modders to answer.

Also was that ascii code supposed to say something? Cause all I got from it was this...
![[YcoUgenious
 
Nov 26, 2014 at 4:02 AM
Amaya
Discord Group Moderator
"What're YOU lookin' at?"
Join Date: Jan 18, 2013
Location: Somewhere quiet with many birds
Posts: 1118
Age: 25
Of course 127 would be my first choice for no reason! 4, 8, 16, 32, and so on are all holy numbers, along with relatives, retainers and heroes like 0, 1, 2 and 127. 127 is the sister of 128, a noble who fathered the mighty 256.

My dementia aside, yes, Cave Story was created in C++.
 
Nov 26, 2014 at 4:08 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 31
Brayconn said:
Very interesting reason, and while that could be it there is a technical reason aswell.

In C/C++ there is a data type called a char(acter) which can hold a value between -127 and 127.
So it could just be that 127 was the most damage any entity could do so it would make sence to make the instant kill spikes do the most damage out of any entity in the game.
On a similar note, if you mod the game to give Quote's health a value over 255 and then pick up a heart, your max health will default to 255.
There is another data type in C/C++ called an unsigned char which holds a value between 0 and 255.

This all points to Cave Story being built in C or C++ but I'll leave that up to the ASM modders to answer.
First of all, chars/single-byte values exist in programming languages outside of C and C++, and same for unsigned data types as well. And the range for a signed char is actually -128 to 127, not -127 to 127. Just to get that out of the way.

Now, there is literally no reason for pixel to use an unsigned char to store the player's health value, especially since overflow would be an issue any time you lost more health than you had (that is, if you had 1 hp and took 2 damage, then your hp would be 255 after taking the hit due to the char being unsigned). So at the very least Quote's hp needs to be signed, and since the range for a signed char is -128 to 127, that rules out his hp being a char entirely. Also the fact that you can change the hp value itself to be 9999 shows that it goes beyond the 0 to 255 range, since if it was a char it would literally never show any number outside of it regardless to what you changed the neighboring 3 bytes to. It being changed back to 255 might be related to the heart pickup code rather than an actual limit of the data type storage, since when you overflow a char's value limit, it overflows/wraps instead of capping the value at its "max". I imagine it being set to 255 after picking up a heart is just an odd sort of error-proofing done by pixel, that or old code that's no longer relevant to the game in normal play.

Entity damage values are stored as signed integers in the game, if I'm recalling correctly from my ASM hacking days. They might be short ints in the npc table, but in memory they're probably just regular DWORD sized ints. This is demonstratable by the fact that you can edit entities to do thousands of damage, so you would at least need a short int to do that kind of math.

The reason for -127 is probably just a homage to old 8-bit games, where that would have literally been close to the minimum value used to store health points and stuff, due to it being 8-bit.
 
Nov 26, 2014 at 4:17 AM
daughter of chivalry
"Bleep, Bloop, Bleep, Bloop"
Join Date: Jun 12, 2009
Location: Edge of the universe
Posts: 1564
It's simple, really.

127. 7+2 is 9. 19...reverse that and you get 91. 91 has 2 digits. 11 has 2 digits. What does that get you?

911.

9/11 was an inside job. Blame Pixel.

>tfw a good portion of active members weren't alive/able to even speak during 9/11
 
Nov 26, 2014 at 4:34 AM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
the ascii says "pummelatorisagenious"

not "![[YcoUgenious"

in case anyone is wondering
 
Nov 26, 2014 at 8:10 PM
beep boop
Bobomb says: "I need a hug!"
Join Date: Aug 16, 2014
Location: no
Posts: 845
Age: 22
I have made a discovery that may or may not solve this. What is 127-100? 27. 27 is the id of the death spikes. Say goodbye to your sense of logic...
 
Nov 26, 2014 at 8:22 PM
Um... Chosen One? Yeah that'll work. : P
"..."
Join Date: Aug 3, 2014
Location: worm hole
Posts: 362
Age: 22
Bionicobot said:
I have made a discovery that may or may not solve this. What is 127-100? 27. 27 is the id of the death spikes. Say goodbye to your sense of logic...
Where does the 100 come from.


I guess, but as said I think it's just the max the value can hold.
 
Nov 26, 2014 at 8:37 PM
beep boop
Bobomb says: "I need a hug!"
Join Date: Aug 16, 2014
Location: no
Posts: 845
Age: 22
It is. When you use higher numbers, it ADDS health instead, but that may only be for the guns.
 
Nov 26, 2014 at 8:52 PM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
Wouldn't want to add health to the guns would we
 
Nov 26, 2014 at 9:00 PM
beep boop
Bobomb says: "I need a hug!"
Join Date: Aug 16, 2014
Location: no
Posts: 845
Age: 22
I mean the bullets can give health, instead of take it away.
 
Nov 26, 2014 at 9:02 PM
Amaya
Discord Group Moderator
"What're YOU lookin' at?"
Join Date: Jan 18, 2013
Location: Somewhere quiet with many birds
Posts: 1118
Age: 25
Doors said:
Wouldn't want to add health to the guns would we
I know it's not a gun, but do you think adding health to the Blade would make it sharper? Because if so, I'd want to do exactly that!
 
Nov 26, 2014 at 10:01 PM
War criminal
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location: Phoenix
Posts: 2758
Age: 29
Polaris said:
I know it's not a gun, but do you think adding health to the Blade would make it sharper? Because if so, I'd want to do exactly that!
I think it'll also revive King if that happens.
 
Nov 27, 2014 at 2:13 AM
Administrator
Forum Administrator
"Life begins and ends with Nu."
Join Date: Jul 15, 2007
Location: Australia
Posts: 6211
Age: 38
It is as Noxid and Bionicobot said. Damage is a signed value that means that 128 to 255 represent -128 to -1. Essentially if you create a weapon with 128dmg per hit it WILL HEAL THE ENEMY (being negative damage and all). I have done this before and the damage indicator uses + instead of - and the numbers are white instead of red, and the enemies will not die. Obviously it was part of a scrapped feature from CS. The same should apply to spikes and you. Change the spikes to 128dmg or over and they should heal you. The fact is that Pixel chose 127dmg for the large spikes because that is the largest amount of damage the game can dish out in a single hit.
 
Nov 27, 2014 at 4:18 AM
beep boop
Bobomb says: "I need a hug!"
Join Date: Aug 16, 2014
Location: no
Posts: 845
Age: 22
The graphic is the same as gaining the tortilla chips, right? That is probably just to save space, but it could get confusing, which would be one reason. Another is that enemies with negative health die, so yeah...
 
Nov 27, 2014 at 4:20 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 31
andwhyisit said:
Essentially if you create a weapon with 128dmg per hit it WILL HEAL THE ENEMY (being negative damage and all). I have done this before and the damage indicator uses + instead of - and the numbers are white instead of red, and the enemies will not die. Obviously it was part of a scrapped feature from CS. The same should apply to spikes and you.
This is only for weapons though, not for entity damage values. To prove it, I experimented with the large spikes damage values in the npc table a bit.

First, the results with setting it to 999 damage:
p190730-0-fzujwmo.png

Quote dies normally here, and the game properly displays that 999 damage has been done to him. So clearly the theory of damage and health values being limited to a byte is out the window.

Next with 9999 damage:
p190730-1-ywdcizm.png

Again, Quote dies normally here, and the game properly displays that 9999 damage has been done to him.

And now with 99999 damage:
p190730-2-0hkcvie.png

This is where things get interesting. Not only does Quote not die (he has to take 2 hits here to die, and the first hit sets his visible HP to 9999, as far as one can tell), but the game also cannot properly display the damage that's been done to quote (but this is more likely due to the fact that the game wasn't programmed to show damage numbers beyond 4 digits). So the damage value still appears to be working, even though we're now beyond the scope of a short int, but the HP itself might be stored as a short, which would explain why it has overflowed to a value that is probably greater than 9999.

So, in conclusion, pixel didn't choose this value because entity damage is represented as a byte, but probably as a homage to old 8-bit games where this WOULD have been the maximum damage value.
 
Nov 27, 2014 at 4:27 AM
beep boop
Bobomb says: "I need a hug!"
Join Date: Aug 16, 2014
Location: no
Posts: 845
Age: 22
Either that or he had forgotten that the spike was not a gun... :mahin:
#horribletheories
 
Top