Hex - how do negative floats work?

Creating and editing buildings and Commodities.
User avatar
RulerofRails
CEO
Posts: 2061
Joined: Sun Dec 08, 2013 1:26 am

Hex - how do negative floats work? Unread post

Trainmaster has been working for years with some errors in the bca files. Mainly the consumption amount was entered with a one or two place offset. The Missile Factory has been working fine with a value that translates into decimal as -107k loads of Isotopes per year!. Turns out that with negative values the game doesn't even try to use that cargo, so that conversion was in fact still profitable as no Isotopes were used at all.

We can use a negative value for a demand only function (can be hidden). The building will attract the cargo but not consume it. This can be used to hold stacks. However, the negative scale seems to works in a different way. There is some issue with building upgrades. An upgraded building attracts less than a normal one.

I don't really understand hex floats, especially negatives. What I observed, demand is starting higher just below 0, for example -0.1
Then it decreases as it approaches approximately -6.9, where something is happening and demand then soars from that point on.

I haven't tested heaps of random values. Is there some principle from negative hex floats that explains this behavior?

PS.
Had a thought: even if they don't work for upgradable buildings, they will probably be perfect for the railway structures.
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Hex - how do negative floats work? Unread post

No, negative floats are essentially the same as any other negative numbers. There's nothing magical about them. -6.9 is -6.9 regardless of whether it is written in decimal, binary, hexadecimal, float, or any other format. If you are seeing unusual effects I would guess it's the result of a game algorithm.
Post Reply