News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

Fixed costs from int16 to int32

Started by Flemmbrav, August 10, 2020, 02:36:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Flemmbrav

Hey hey,

as I've heard from fixed costs for vehicles being a thing, i got hella hyped for this idea.
It would be very nice to try giving vehicles significant fixed costs, so the operator would actually think about where to use them.

Sadly, this is not a thing I can do with the current fixed costs, as the game does not provide numbers high enough for this.
The limit seems to be around 2% of the vehicle costs being fixed. That kind of is a joke compared to what I want to try with them.
Thus I suggest to double down on this feature and make it an actual thing.
For that, it would be best to raise the maximum fixed costs to int32.
That would give me enough freedom to try that new kind of balancing.

Technicly int24 would be enough too, in case this is affecting the performance too much.
Int32 would free up for future use as well tho, so I'd love to see that instead.

I have been trying to do this on my own, but I completly failed to compile the game. I know that this is an easy request, but I guess I'm not fit to code this.

makie

Nightly or release?
in Nightly this should be int32
release is int16

Flemmbrav



Flemmbrav

#4
I actually roled back my Patch for the Pakset on June 19th - that hurts.
I'll try it again and report back if it works as intended!

Edit: Works like a charm! Thanks a lot.

DrSuperGood

Quote from: Flemmbrav on August 10, 2020, 02:36:43 PMTechnicly int24 would be enough too, in case this is affecting the performance too much.
If anything that would affect performance even more. An 8 bit member would be needed to pad the remaining 8 bits otherwise the alignment would bring no space benefits at all. It would likely need to be read as a 4 byte value with 8 bits being masked away so there would be no memory bandwidth saving.

Ters

Write performance for int24 would be even worse than for reading, but in this case, the field would only be written once per vehicle. Both fields would be written at the same time, so the compiler could have optimized it a bit. (When using the value in calculations, it would immediately be promoted to int32, or even int64. Neither the stack nor the registers do 24-bit on any modern architecture I know.) In any case, not likely worth the effort.