The International Simutrans Forum

 

Author Topic: Generating free money by using two different waytypes  (Read 401 times)

0 Members and 1 Guest are viewing this topic.

Offline Freahk

  • Devotee
  • *
  • Posts: 1504
  • Languages: DE, EN
Generating free money by using two different waytypes
« on: June 08, 2021, 07:32:07 PM »
Money can be generated by building and destructing level crossings.

How to reproduce:
1. Build a stretch of track (land value will be paid)
2. Cross that track by road (land value won't be paid again)
3. Destroy the level crossing (land value will be refunded)
4. By repeating 2 and 3 you can easily generate any amount of money

Expected behavior:
1. Build a stretch of tracks on empty tiles (pay land value)
2. Cross the track by road (Don't pay land value, as we already are the owner of that property)
3. Destroy the level crossing (Don't refund land value, as we still own that property)

Special thoughts might be needed to handle building on other players property (level crossings on roads of players with shared permissions or public roads)
« Last Edit: June 11, 2021, 10:37:09 PM by Freahk »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Generating free money by using two different waytypes
« Reply #1 on: June 09, 2021, 10:06:09 PM »
Thank you for your report. I believe that I have now fixed this. I should be grateful if you could re-test.

Offline Freahk

  • Devotee
  • *
  • Posts: 1504
  • Languages: DE, EN
Re: Generating free money by using two different waytypes
« Reply #2 on: June 09, 2021, 11:20:52 PM »
Fixed using the general destroy/remove tool but not when using one of the remove way tools.
Fun with duplicate code...

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Generating free money by using two different waytypes
« Reply #3 on: June 10, 2021, 08:09:32 PM »
Fixed using the general destroy/remove tool but not when using one of the remove way tools.
Fun with duplicate code...

Thank you for that; I believe that I have now fixed this. I should be grateful if you could re-test.

Offline Freahk

  • Devotee
  • *
  • Posts: 1504
  • Languages: DE, EN
Re: Generating free money by using two different waytypes
« Reply #4 on: June 11, 2021, 01:50:19 PM »
Doesn't seem to be a money generator anymore.

There are two things left for consideration:
1) Player owned properties will be taken over by the public for free. That means when a non-public road becomes prow, the player who originally purchased that property won't get a refund.
2) Properties can be transfered between players without refunding/paying the land value to the affected companies.
Player A claims a property, player B constructs a way on that property

1) Deserves a fix in my opinion.

2) Seems more difficult to me as we don't know which company originally claimed a property
Is it worth storing that information?
Instead we might use a clear definition of who is the owner of a property based on the currently stored ground data.
In both cases we have to book/refund the land value whenever the owner changes.
Should we instead ignore this behavior?
« Last Edit: June 11, 2021, 02:15:43 PM by Freahk »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Generating free money by using two different waytypes
« Reply #5 on: June 11, 2021, 03:30:18 PM »
Ideally, one would have an "owner" field for each planquadrat_t object (planquadrat_t rather than grund_t to reflect the rule in property law that ownership of the land is ownership of it at all heights and depths, albeit with the exception that aircraft overflying at a reasonable height do not amount to a trespass to private property, so there are no plans, contrary to what I have seen suggested on Discord, for markers to be used to bar airspace).

However, I am concerned that this would significantly increase memory consumption in larger maps, and memory usage is already somewhat at a premium.

Offline Freahk

  • Devotee
  • *
  • Posts: 1504
  • Languages: DE, EN
Re: Generating free money by using two different waytypes
« Reply #6 on: June 11, 2021, 03:58:02 PM »
One more byte per planquadrat_t shouldn't be an issue. Less than 16MB on a B-B sized map seems fair to me.
I might start coding this if the (imho) rather small amount of memory is considered worth.
« Last Edit: June 11, 2021, 04:34:17 PM by Freahk »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Generating free money by using two different waytypes
« Reply #7 on: June 12, 2021, 10:35:55 AM »
One more byte per planquadrat_t shouldn't be an issue. Less than 16MB on a B-B sized map seems fair to me.
I might start coding this if the (imho) rather small amount of memory is considered worth.

This would certainly be an interesting thing if this really doesn't take much memory. This would be more than just adding the memory structure, however: this would require a whole new UI. Each tile would have to report to the player who owns it. There would need to be an interface for buying and selling tiles independent of the current marker interface. There would need to be a minimap feature for showing who owns what land. Consideration would have to be given to the circumstances in which a public player owns land as opposed to it being unowned. The current "buy house" tool in the special construction menu would have to have its function modified to make sense in the context of a game where there is a whole new abstraction for player land ownership.

Further, everywhere in the code where a player does something which requires buying or selling land would need to be refactored into the new mechanism.

Doing this properly would be a lot of work and require a lot of testing - and not doing it properly would be worse than not doing it at all. If you are happy to implement this feature fully, then it would be a happy thing to have, but it would require some considerable work.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10642
  • Languages: De,EN,JP
Re: Generating free money by using two different waytypes
« Reply #8 on: June 12, 2021, 01:14:17 PM »
One byte could easily add 8 bytes due to shifting alignment etc, depending on how the structure is packed. Use the "-sizes" switch to check the actual sizes after compilations.

Offline Freahk

  • Devotee
  • *
  • Posts: 1504
  • Languages: DE, EN
Re: Generating free money by using two different waytypes
« Reply #9 on: June 12, 2021, 07:08:21 PM »
Wowow!
In the very first place, this is meant to refund land values to the company hich originally claimed that land, so the economics behind land values (which especially in early game is a huge part of the costs) works properly.

I see the merit in the suggestions beyond and these should indeed be considered, but "simply" fixing the refund inconsistency already is an improvement without introducing the whole system around it.

Obviously, any locations where players can buy or sell land need to be refactored. I already started refactoring way construction related code on my "way-construction-refactoring" anyays.
The goal of this branch is to reduce code redundancy around way construction, thus increase code maintainability.
« Last Edit: June 12, 2021, 07:56:32 PM by Freahk »

Offline Freahk

  • Devotee
  • *
  • Posts: 1504
  • Languages: DE, EN
Re: Generating free money by using two different waytypes
« Reply #10 on: June 14, 2021, 11:20:46 AM »
Uhm... Well... Very weird stuff going on!
The way remove tool doesn't refund land values anymore. The general remove tool does.
Also, we can now claim land for free by building ways below airplanes, waiting for the airplane to leave that tile, then selling the land again.
We have to wait for the airplane to leave, because otherwise the airplane will disappear when using the general remove tool o.O
At least the airplane is not entirely destroyed. It will appear on the next tile as soon as it enters that tile.

You don't have to take any action. The code around this is refactored anyways and I'll handle this bug in turn.
« Last Edit: June 14, 2021, 12:24:02 PM by Freahk »