Jump to content

what is the max durability value possible?


Recommended Posts

=KG76=flyus747
Posted (edited)

the highest I have been able to attain is 125,000.

 

if I go put something higher like 145,000, the value gets reset to a random number anywhere from 500-25,000 and I can't make sense of this.

 

I am trying to find out how to make it impossible for the SC50 to single hit and kill objects for my mission

Edited by T-34
Posted

Here's a general answer to your question T-34.

Maximum durability is different for different objects such as static (blocks). Bridge max-durability will be different than say, Ammo Bunkers.

You'll need to continue with your testing and if unsatisfactory for your purposes possibly us a CMD-Damage MCU along with appropriate logic to achieve your aims.

 

Good luck with your mission design.

Tip

 

Posted

If you are talking about a vehicle, as opposed to a static tank, then the durability value is ignored anyway. 

  • 2 weeks later...
AEthelraedUnraed
Posted
On 12/5/2021 at 2:49 PM, T-34 said:

the highest I have been able to attain is 125,000.

 

if I go put something higher like 145,000, the value gets reset to a random number anywhere from 500-25,000 and I can't make sense of this.

 

I am trying to find out how to make it impossible for the SC50 to single hit and kill objects for my mission

Might it be 127,500 by any chance??

 

What happens is called an overflow error. Let me explain in laymen's terms. If you play with the editor a bit, you'll find that you can only save values in steps of 500. So a value of 1245 gets rounded down to 1000, 1255 gets rounded up to 1500 etc. That means that there are only 256 possible steps from 0 to 127,500. 256 happens to be the exact same number of values an 8-bit number (= one byte) is able to represent. We can deduce from that, that the game uses a single byte to represent the durability value.

 

The maximum value an 8-bit value is able to attain is eight ones, i.e. 1111111, which equals 255 (one less than 256, because the first value is the zero ;)). Now what happens if you want to store a higher value, such as 145,000? 145,000 in the in-game representation equals 290 (145000/500). The binary representation of 290 is 100100010. It can only store eight bits, so it just discards the leftmost ones. If we cap this number to eight bits, we get 00100010 (34 in decimal). If we translate this back to the durability values as displayed in the editor by multiplying with 500, we end up with 17,000. So, if you input 145,000, you'll end up with 17,000 after saving and re-loading the mission.

 

I hope you enjoyed the lesson :P

  • Like 1
  • Thanks 1
  • Upvote 1
=KG76=flyus747
Posted
14 hours ago, AEthelraedUnraed said:

Might it be 127,500 by any chance??

 

What happens is called an overflow error. Let me explain in laymen's terms. If you play with the editor a bit, you'll find that you can only save values in steps of 500. So a value of 1245 gets rounded down to 1000, 1255 gets rounded up to 1500 etc. That means that there are only 256 possible steps from 0 to 127,500. 256 happens to be the exact same number of values an 8-bit number (= one byte) is able to represent. We can deduce from that, that the game uses a single byte to represent the durability value.

 

The maximum value an 8-bit value is able to attain is eight ones, i.e. 1111111, which equals 255 (one less than 256, because the first value is the zero ;)). Now what happens if you want to store a higher value, such as 145,000? 145,000 in the in-game representation equals 290 (145000/500). The binary representation of 290 is 100100010. It can only store eight bits, so it just discards the leftmost ones. If we cap this number to eight bits, we get 00100010 (34 in decimal). If we translate this back to the durability values as displayed in the editor by multiplying with 500, we end up with 17,000. So, if you input 145,000, you'll end up with 17,000 after saving and re-loading the mission.

 

I hope you enjoyed the lesson :P

I barely got 20% of that but I can understand a little about the bottom half of your response. 
 

Why does IL2 just peak at an 8 bit system? Can the bits be understood as digits?  How do you calculate the binary representation of a number? I didn’t get how 290 = 100100010 but I understood that the game basically only accepts the first 8 digits because it’s an 8bit system.

AEthelraedUnraed
Posted (edited)
6 hours ago, T-34 said:

Why does IL2 just peak at an 8 bit system?

It's hard to say why the Devs chose to use eight bits as opposed to 32. The most obvious reason would be less memory usage, but in an age where most processors are built to deal with 32 bit numbers, the 3 bytes you gain seem hardly worth the extra CPU cycles you need to convert back and forth between 8 and 32 bits, behind the scenes. Also, it's perfectly possible the compiler (the program that "translates" the code into something the computer can read) already stores it as a 32-bit number.

 

It might also be for "legacy" reasons. Memory wasn't always in as great supply as nowadays, so many programmers, myself included, have inherited an irresistible urge to always use the least amount of space required.

 

A final possibility is that a maximum value of 255 is required to ensure certain other values remain within certain limits, either for gameplay or technical purposes.

 

EDIT: just to be clear, IL2 doesn't in itself use an "8-bit system". Most of its variables are 32 or even 64 bits, where it matters. What I wrote here might make it seem like IL2 is severely outdated, which is definitely not the case. It's certainly not uncommon for programs to use the odd 8-bit number at places.

 

6 hours ago, T-34 said:

Can the bits be understood as digits?  How do you calculate the binary representation of a number? I didn’t get how 290 = 100100010 but I understood that the game basically only accepts the first 8 digits because it’s an 8bit system.

If with "digits" you mean the numbers 0-9, then yes, bits are very similar to digits. The only difference is the so-called base of the counting system.

 

The counting system we use in daily life is base-10. That means that there are ten possible numbers that each have their own written character. Whenever you try to represent a number that's more than the base, you add a character to the left and multiply that with the base. E.g. 15 is 1x10 +5, 234=2x10x10 + 3x10 + 4.

 

Binary is no different, except that it is base-2. That means there are only two possible characters to represent a number, namely 0 and 1. Still, however, if you try to represent something that's larger than the base, you simply add a character to the left and multiply by the base. So binary 10 equals 1x2 + 0 = 2. Binary 1011 equals 1x2x2x2 + 0x2x2 + 1x2 + 1 = 11.

 

EDIT: One small elaboration on the reason to use the binary system in computers; this is simply because binary numbers can easily be represented electronically using switches (i.e. transistors). 0=off, 1=on.

A final elaboration: you sometimes see the hexadecimal system used in computing. This is simply shorthand for binary, using the fact that computers use 8-bit bytes (or a multiple thereof, such as 32 or 64 bits). As said above, 8 bits can represent 256 different values. 256 equals 16 times 16, so hexadecimal uses a base-16 counting system (from 0 to 15: 123456789abcdef) to represent 8 bits using just two characters (often 0x is appended to the front of the number to indicate it's in hexadecimal, but this isn't part of the number itself). Again the same rule works: 0xa9 = 10x16 + 9 = 25. 0xc3f = 12x16x16 + 3x16 + 15 =  3135. The maximum number you can represent in this way with two hexadecimal characters is 0xff, which equals 15x16 + 15 = 255 which equals the maximum of eight bits, hence the reason it's often used in computing. It's relatively easy to convert from binary to hexadecimal and the other way around, while hexadecimal is a bit more readable :)

 

I hope this clarifies it a little :)

Edited by AEthelraedUnraed

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...