• Welcome to SC4 Devotion Forum Archives.
 

News:

The SC4 Devotion Forums are no longer active, but remain online in an archived, read-only "museum" state.  It is not possible for regular members to post or use the private messaging system, and no technical support will be provided for any issues pertaining to the forums in their current state.  Attachments (those that still work) are accessible without login.

The LEX has been replaced with SC4Evermore (SC4E), and SC4E maintains an active Discord server.  For traditional forums, we recommend Simtropolis.

Main Menu

Bug Report - kind of

Started by Rutherford, October 21, 2011, 11:01:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rutherford

Hoy Hoy to whom it may concern,

I looked at the modular zoo by Jeronij in the Reader and noticed ALL the modules (Aquarium and Zoo) had the <Air> "pollution at center" valued at 0xFFFFFFFB.
That's a lot of animal farts  :o

I did a forum search and didn't find any refs to this, so hopefully this helps some folks......

Lowkee33

That is how negative values are represented in hex.  It's a signed integer.  Each zoo piece has -5 air pollution, which means that it will clean the air.

j-dub

#2
http://www.youtube.com/v/GimxvWG6XIw
(because you mentioned zoo and Lowkee is referenced)

Seriously though, if its not built before hand, what really helps is being able to edit the pollution properties in LeProp. That way you can alter the lot's behavior before it gets built. (I don't remember me using Reader to do that) Its just if you set too much of a negative pollution volume, say minus 10 grand, I thought that would help, it did at first, then later the city got over polluted for too much of a radios, and no pollution subtracting lots worked for me in those areas anymore, not even wind generators took it out. I find the pollution the most difficult thing about this game.

Rutherford

QuoteThat is how negative values are represented in hex.  It's a signed integer.  Each zoo piece has -5 air pollution, which means that it will clean the air.

Signed integer ? Thanks for that (I'm an English Major) but what is the conversion from/to hexadecimal should I want to change values in other existing lots?      Thanks again.

Lowkee33

The hexadecimal is values from 0x00000000 to 0xFFFFFFFF (32bit).  In decimal, this is a range that is about 4 billion large.  Unsigned, the values are 0-4b.  Signed means values are -2b to 2b.  0xFFFFFFFF is -1, 0x80000000 is roughly -2 billion, and 0x7FFFFFFF is 2 billion.  So, when J-Dub placed a whole bunch of negative air pollution lots, he eventually looped into positive numbers.

Hex to Decimal?  I use Excel.  Hexadecimal is base 16.  Instead of 10s places for decimal there are 16s places for hex.  The math, I'm taking an Intro to C++ class right now, so glad to indulge :)

Take the number 234:
In decimal, it could be  written as 4*(10^0)+3*(10^1)+2*(10^2)  = 4 + 30 + 200 = 234
for hex, it could be  written as 4*(16^0)+3*(16^1)+2*(16^2) = 4 + 48 + 512 = 564

cogeo

The decimal to hex conversion can be carried-out in Excel, as Lowkee said, or you can use the Windows Calculator (Scientific or Programming View). Also, the reader can perform decimal to hex conversions, but on input only (not the opposite), eg if you enter the value 12 (without 0x..) on input, it will convert it to 0x0000000C.

The negative number representation used here is known as Two's Complement. Virtually all today's computer systems use this method.

To convert a hex number to its negative (or vice versa), take the two following steps:
1. Invert all number's digits (bitwise). By "inverting" I mean make all 0s 1s and all 1s 0s. For example, the hex digit 0x6 is represented in binary as 0110b. The inverse of this is 1001b, or 0x9 in hex. This can be simplified by instead calculated the number which if added to the above value sums to 15 (0xF). In our example the "opposite" of 0x6 is 0x9 because 0x6 + 0x9 = 0xF. Similarly the opposite of 0x0 is 0xF, the opposite of 0x1 is 0xE, the opposite of 0x5 is 0xA, etc.
2. Add one (0x00000001) to the resulting value - handle properly the carry(-ies) as well.

Example 1: -100
1. The hex representation of 100 is 0x00000064. The opoosite is 0xFFFFFF9B.
2. Adding 1 (0x00000001) yields 0xFFFFFF9C.

Example 2: -256
1. The hex representation of 256 is 0x00000100. The opoosite is 0xFFFFFEFF.
2. Adding 1 (0x00000001) yields 0xFFFFFF00 (the additions to the last two digits both generated a carry).

Example 3: 0xFFFFFFFB (your number)
1. The opposite is 0x00000004
2. Adding 1 (0x00000001) yields 0x00000005, or 5 in decimal, so the original number was -5.

If you find the above very much "algorithmic", you can easily calculate a negative representation by considering the amount needed to reach the value of 0x100000000 (9 digits here), or else cause it to "overflow". In your example (0xFFFFFFFB), adding 4 yields 0xFFFFFFFF, but adding 5 just causes it to overflow (reset).

Rutherford

Thanks for the lessons. I will have to digest your info slowly until it becomes a little more intuitive.  ()what()  This is my first foray into hexadecimal (I change properties in almost all of my civic bldgs in some way or another). BTW when I'm messing with exemplars in the Reader  - this page http://easycalculation.com/decimal-converter.php is always open to quickly convert what I need.

Thanks again