The International Simutrans Forum

 

Author Topic: Fixed costs from int16 to int32  (Read 632 times)

0 Members and 1 Guest are viewing this topic.

Offline Flemmbrav

  • Devotee
  • *
  • Posts: 266
  • PAK-DEV P192C
  • Languages: DE, EN
Fixed costs from int16 to int32
« on: August 10, 2020, 02:36:43 PM »
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.

Offline makie

  • Devotee
  • *
  • Posts: 317
    • Homepage PAK128-German
  • Languages: DE
Re: Fixed costs from int16 to int32
« Reply #1 on: August 10, 2020, 02:44:39 PM »
Nightly or release?
in Nightly this should be int32
release is int16

Offline Flemmbrav

  • Devotee
  • *
  • Posts: 266
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Fixed costs from int16 to int32
« Reply #2 on: August 10, 2020, 02:54:17 PM »
OMG really? since when?

Offline makie

  • Devotee
  • *
  • Posts: 317
    • Homepage PAK128-German
  • Languages: DE

Offline Flemmbrav

  • Devotee
  • *
  • Posts: 266
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Fixed costs from int16 to int32
« Reply #4 on: August 10, 2020, 03:04:55 PM »
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.
« Last Edit: August 10, 2020, 03:53:01 PM by Flemmbrav »

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2836
  • Languages: EN
Re: Fixed costs from int16 to int32
« Reply #5 on: August 11, 2020, 05:09:51 AM »
Technicly 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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5695
  • Languages: EN, NO
Re: Fixed costs from int16 to int32
« Reply #6 on: August 11, 2020, 05:52:15 AM »
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.