04 Dec, 2008, tphegley wrote in the 1st comment:
Ok, I have UMAX (-15, GET_AC (ch)/10) that is called for getting armor class in my game.

UMAX is defined as a>b choose a else choose b

Now, which one will it take since they will both be negative? If my player has -200 ac then b is -20. Which will it say is greater -15 (since it actually is) or -20? I didn't know if it could understand that the bigger a negative number it gets is lower then a higher negative number. (it probably does)
04 Dec, 2008, ghasatta wrote in the 2nd comment:
Hmm. Maybe this comparison will help:

-1000 < 0 < 1000

So, -15 is greater than -20.
04 Dec, 2008, tphegley wrote in the 3rd comment:
I know that. I was just thinking aloud that does the compiler know that? hehe. I'm sure it does as I stated in my post, but I just wanted to make sure.
04 Dec, 2008, Kayle wrote in the 4th comment:
If your AC is always going to be negative, wouldn't it makes sense to use UMIN? Since you want the lower of the two numbers?
04 Dec, 2008, tphegley wrote in the 5th comment:
AC starts at 100 and then goes down from there with eq and dex ac bonuses. So it wont' always be negative.

I'm trying to go through the calculations to see what all the numbers are for hitting.
04 Dec, 2008, Fizban wrote in the 6th comment:
C is definitely sophisticated enough to know that -15 is greater than -20, if they have -200 / 10 = -20 -15 will show.
04 Dec, 2008, David Haley wrote in the 7th comment:
When you use < or > in any sane programming language (including C), you follow the exact same rules as normal mathematics. So -20 < -15 < 0 < 100 < 100000.
04 Dec, 2008, tphegley wrote in the 8th comment:

`while ((diceroll = number_bits (5)) >= 20);  if (diceroll == 0 || (diceroll != 19 && diceroll < thac0 - victim_ac))    {      /* Miss. */      damage (ch, victim, 0, dt, wpn, dam_type);      tail_chain ();      return;    }`

If the diceroll is 6 and my thac0-victim_ac is -64 that means that I won't ever miss? or my thac0-victim_ac is in the negatives then any roll (besides 0 and 19)will result in a hit (but mob/player has the option to parry/dodge/shield block or whatever)

***EDIT***
That seems to be the case. I don't know why I've never went through my one_hit before. It's making more since now.
04 Dec, 2008, David Haley wrote in the 9th comment:
Indeed. The way that is set up, 0 <= diceroll < 20. So, if thac0 - victim_ac is above 20, you will always miss. Conversely, if thac0 - victim_ac is below 0, you will always hit. (Modulo the corner cases of diceroll equal to 0 or 19.)
04 Dec, 2008, tphegley wrote in the 10th comment:
So after digging through my Envy code and then through smaugfuss code, there is a point at which players stop missing altogether and hit every time, although the victim has a chance to dodge/parry/etc the hit. Once the thac0-GET_AC/10 reaches a negative, the player no longer misses.

I didn't fully check smaugfuss, but the code is mostly identical, but on ENVY it's true.

Has anyone really looked at this before?
04 Dec, 2008, tphegley wrote in the 11th comment:
DavidHaley said:
Indeed. The way that is set up, 0 <= diceroll < 20. So, if thac0 - victim_ac is above 20, you will always miss. Conversely, if thac0 - victim_ac is below 0, you will always hit. (Modulo the corner cases of diceroll equal to 0 or 19.)

I just found this to be very interesting as I never noticed that I stopped missing on hits. Only time I don't make contact is when the mob parries/dodges/etc. Just interesting to me. Never fully looked at one_hit before.
04 Dec, 2008, David Haley wrote in the 12th comment:
I suspect that the actual mechanics of the combat code are some of the least understood areas of the code, because most people don't really think about it and set mob/object values according to other things. Although the system started out as AD&D, it is now far from it, but I don't think people fully register that. (Myself included, for what it's worth.) Revamping combat is one of those things I've been meaning to do for quite a while but have not wanted to because of how dramatically it would change the game.
04 Dec, 2008, tphegley wrote in the 13th comment:
DavidHaley said:
I suspect that the actual mechanics of the combat code are some of the least understood areas of the code, because most people don't really think about it and set mob/object values according to other things. Although the system started out as AD&D, it is now far from it, but I don't think people fully register that. (Myself included, for what it's worth.) Revamping combat is one of those things I've been meaning to do for quite a while but have not wanted to because of how dramatically it would change the game.

Yea, This is one of the main reasons why I wanted to look at it. My players were saying that their armor class didn't matter past -150 and I wanted to see if that was true or not. I found that out with the UMAX equation right off the bat. But then looking further you hit negative thac0-victim ac pretty quick.

I believe I will eventually use armor like WoW does, which reduces the amount of damage you take (which is how I think it should be anyways) not whether you get hit or not. Then I'll put in other factors that add to getting the proper diceroll to hit. It's a big undertaking of which I probably won't do it on my envy mud just since it's for the most part balanced around this equation. But in my smaug code I'll probably mess with it.
04 Dec, 2008, elanthis wrote in the 14th comment:
tphegley said:
Now, which one will it take since they will both be negative? If my player has -200 ac then b is -20. Which will it say is greater -15 (since it actually is) or -20? I didn't know if it could understand that the bigger a negative number it gets is lower then a higher negative number. (it probably does)

I feel the need to ask why you didn't just try it out, which would've taken less time than posting and waiting for a response. So… why didn't you just try it out? :)

I would like to know if there is any serious programming/scripting language in the world that treats numbers as absolutes during numerical comparison. Then I'd like to know where the author of said language lives, and where the hardware store nearest to his house is.
04 Dec, 2008, tphegley wrote in the 15th comment:
elanthis said:
I feel the need to ask why you didn't just try it out, which would've taken less time than posting and waiting for a response. So… why didn't you just try it out? :)

I would like to know if there is any serious programming/scripting language in the world that treats numbers as absolutes during numerical comparison. Then I'd like to know where the author of said language lives, and where the hardware store nearest to his house is.

I was trying it out as I was posting as well. I sometimes 'think' aloud. I just wanted to make sure, and as I stated in the topic title, it was a stupid question, but I just wanted proof from you guys. and also, as I stated in my first post, I figured it did. :redface:
04 Dec, 2008, Tyche wrote in the 16th comment:
elanthis said:
Then I'd like to know where the author of said language lives, and where the hardware store nearest to his house is.

Elanthis' silver hammer went down upon said language author's head.

Or when a language author's head look likes like a nail…
04 Dec, 2008, David Haley wrote in the 17th comment:
I believe that armor should have both a deflection value and an absorption value. Don't have much time to go into it at the moment, but I think it's a fairly realistic depiction of what armor actually does, and would let you do interesting things with some armors having almost no deflection but some absorption – varying the two parameters could let players make more interesting decisions w.r.t. how much they're willing to carry around for that extra deflective and/or absorption power.
04 Dec, 2008, quixadhal wrote in the 18th comment:
tphegley said:
I know that. I was just thinking aloud that does the compiler know that? hehe. I'm sure it does as I stated in my post, but I just wanted to make sure.

If you wanted to actually SEE what the compiler thinks, you can use gcc -E to halt after the pre-processing stage and examine the output. At that point, all #define'd macros have been expanded. :)
04 Dec, 2008, quixadhal wrote in the 19th comment:
tphegley said:

`while ((diceroll = number_bits (5)) >= 20);`

***EDIT***
That seems to be the case. I don't know why I've never went through my one_hit before. It's making more since now.

Please, do tell me how that line makes sense! It's EVIL!!!!!

while we roll a random number from 0 to 31, try again if it's less than 20.

04 Dec, 2008, quixadhal wrote in the 20th comment:
DavidHaley said:
Indeed. The way that is set up, 0 <= diceroll < 20. So, if thac0 - victim_ac is above 20, you will always miss. Conversely, if thac0 - victim_ac is below 0, you will always hit. (Modulo the corner cases of diceroll equal to 0 or 19.)

Had they actually followed the AD&D 2nd edition rules, the code would have special cases since a natural 20 is always a hit, and a natural 1 is always a miss.
Random Picks

0.0/35