News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

Generating free money by using two different waytypes

Started by Mariculous, June 08, 2021, 07:32:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mariculous

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)

jamespetts

Thank you for your report. I believe that I have now fixed this. I should be grateful if you could re-test.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Mariculous

Fixed using the general destroy/remove tool but not when using one of the remove way tools.
Fun with duplicate code...

jamespetts

Quote from: Freahk 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...

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

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Mariculous

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?

jamespetts

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.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Mariculous

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.

jamespetts

Quote from: Freahk 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.

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.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

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.

Mariculous

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.

Mariculous

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.