Infrastructure Sharing
Moderator: OpenTTD Developers
Re: Infrastructure Sharing
I'm still on the code to handle bankrupcy. If I can't get it to work tonight, I'll switch to a lighter version and try to post v0.4 for this WE.
Re: Infrastructure Sharing
Hi.
Kind regards
Zombie
If you don't like to wait for v0.4 I attached updated diff files for revision 13087 and the most recent revision 13097.Anunnaki wrote: Can you update your Infrastructure Sharing mod to be compatible with SVN 13087 ? There was lot of changes in one file depot_gui.cpp, others files/changes are ok.
Can you check that ? THX.
Kind regards
Zombie
- Attachments
-
- infrastructure_sharing_r13087.patch
- (99.58 KiB) Downloaded 280 times
-
- infrastructure_sharing_r13097.patch
- (99.58 KiB) Downloaded 204 times
OpenTTD: OpenTTD-Wiki
OpenTTDCoop: Blog, Wiki
My favorite patches: cargo destinations, shared infrastructure
OpenTTDCoop: Blog, Wiki
My favorite patches: cargo destinations, shared infrastructure
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Infrastructure Sharing
updated to r13134.
Edit: There's one line gone missing, already in zombie's update which I relied on, in depot_gui.cpp as of at least the patch to fit r13097. This makes it impossible to use competitors depots in order to buy vehicles. So far I haven't figured out how to update it to trunk due to the GUI changes. The version to fit r13031 still works and has that line.
Edit: There's one line gone missing, already in zombie's update which I relied on, in depot_gui.cpp as of at least the patch to fit r13097. This makes it impossible to use competitors depots in order to buy vehicles. So far I haven't figured out how to update it to trunk due to the GUI changes. The version to fit r13031 still works and has that line.
- Attachments
-
- infrastructure_sharing_r13134.diff
- infrastructure sharing updated to r13134
- (100.33 KiB) Downloaded 271 times
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Infrastructure Sharing
Hi.
I updated the patch to recent trunk version. I had to modify some parts of the patch:
- converted dialog for setup of the sharing fees into a class(struct)
- included the special news type NS_COMPANY_SHAREING like in planetmakers diff
I compared the latest version by Gedemon with my diff file and this time everything seems to be in place. You still have to test if everything is fine. In my initial tests I was able to
- buy train/plain/street vehicle in own depot
- buy train/plain/street vehicle in opponents depot
- send train/plain/street vehicle to own station
- send train/plain to opponent's station
- display own dialog with sharing fees
- display opponent's dialog with sharing fees
- change sharing fees
I guess that street vehicles are able to visit an opponent's station as well. In my test game this sharing feature was disabled.
Kind regards
Zombie
I updated the patch to recent trunk version. I had to modify some parts of the patch:
- converted dialog for setup of the sharing fees into a class(struct)
- included the special news type NS_COMPANY_SHAREING like in planetmakers diff
I compared the latest version by Gedemon with my diff file and this time everything seems to be in place. You still have to test if everything is fine. In my initial tests I was able to
- buy train/plain/street vehicle in own depot
- buy train/plain/street vehicle in opponents depot
- send train/plain/street vehicle to own station
- send train/plain to opponent's station
- display own dialog with sharing fees
- display opponent's dialog with sharing fees
- change sharing fees
I guess that street vehicles are able to visit an opponent's station as well. In my test game this sharing feature was disabled.

Kind regards
Zombie
- Attachments
-
- infrastructure_sharing_r13192.patch
- (101.29 KiB) Downloaded 313 times
OpenTTD: OpenTTD-Wiki
OpenTTDCoop: Blog, Wiki
My favorite patches: cargo destinations, shared infrastructure
OpenTTDCoop: Blog, Wiki
My favorite patches: cargo destinations, shared infrastructure
Re: Infrastructure Sharing
You should rename it to NS_COMPANY_SHARING (without "E")...zombie wrote:Hi.
I updated the patch to recent trunk version. I had to modify some parts of the patch:
- converted dialog for setup of the sharing fees into a class(struct)
- included the special news type NS_COMPANY_SHAREING like in planetmakers diff
[...]
Re: Infrastructure Sharing
Hi.

Kind regards
Zombie
I realized this as well but as I didn't add this I decided not to correct itRoujin wrote:You should rename it to NS_COMPANY_SHARING (without "E")...zombie wrote:Hi.
I updated the patch to recent trunk version. I had to modify some parts of the patch:
- converted dialog for setup of the sharing fees into a class(struct)
- included the special news type NS_COMPANY_SHAREING like in planetmakers diff
[...]

Kind regards
Zombie
OpenTTD: OpenTTD-Wiki
OpenTTDCoop: Blog, Wiki
My favorite patches: cargo destinations, shared infrastructure
OpenTTDCoop: Blog, Wiki
My favorite patches: cargo destinations, shared infrastructure
Re: Infrastructure Sharing
be warned I'm still working on next version, I see that I should have released a WIP mid-version, cause I've also made those change. (I mean, sorry for double work)
to finish v0.4, I now need to check every situation when a vehicle can block shared infrastructure. (like when removing a bankrupt companie's plane on an airport, all reserved blocks should be cleared)

to finish v0.4, I now need to check every situation when a vehicle can block shared infrastructure. (like when removing a bankrupt companie's plane on an airport, all reserved blocks should be cleared)
Re: Infrastructure Sharing
Hi.
No apologies. I hope my changes are the same as yours. That would mean that I'm able to understand the code of OpenTTD and your patch. I have never coded a single line of C/C++ myself.
And it's okay that you don't update the patch every day. At the moment it's quite hard to keep up with the devs. The rewrite of the whole gui and create classes for each window has quite a large effect on patch coders and patch maintainers. I had a lot of merge conflicts in the past two weeks. I have my own patch collection and I have to update these patch collection to recent trunk revision. And by now I have found quite a clean way to update patches to current trunk revisions and overcome merge conflicts.
The only really important thing is that you keep updating and improving this incredible patch and perhaps it's ready for trunk some day or maybe trunk is ready for this patch
Kind regards
Zombie
No apologies. I hope my changes are the same as yours. That would mean that I'm able to understand the code of OpenTTD and your patch. I have never coded a single line of C/C++ myself.

And it's okay that you don't update the patch every day. At the moment it's quite hard to keep up with the devs. The rewrite of the whole gui and create classes for each window has quite a large effect on patch coders and patch maintainers. I had a lot of merge conflicts in the past two weeks. I have my own patch collection and I have to update these patch collection to recent trunk revision. And by now I have found quite a clean way to update patches to current trunk revisions and overcome merge conflicts.
The only really important thing is that you keep updating and improving this incredible patch and perhaps it's ready for trunk some day or maybe trunk is ready for this patch

Kind regards
Zombie
OpenTTD: OpenTTD-Wiki
OpenTTDCoop: Blog, Wiki
My favorite patches: cargo destinations, shared infrastructure
OpenTTDCoop: Blog, Wiki
My favorite patches: cargo destinations, shared infrastructure
Re: Infrastructure Sharing
I played now long time with this patch, for me there is one thing to make.... (or 2)
1. I shouldn't be allowed to stop/start my train in a foreign track.
2. I should be able to start/stop foreign trains on my tracks.
As fast as a train is on my tracks, I am the BOSS about it...
Greets
Ammler
1. I shouldn't be allowed to stop/start my train in a foreign track.
2. I should be able to start/stop foreign trains on my tracks.
As fast as a train is on my tracks, I am the BOSS about it...
Greets
Ammler
Town Names:


Still work in progress: OpenGFX or/and OpenSFX - Please help!
Re: Infrastructure Sharing
yes, that's in the TODO list 

Re: Infrastructure Sharing
I disagree here. While of course technically you're the boss and can do whatever you want, your competitors are paying you and you have to provide the best service possible to them. Taking a real world example. By EU laws the DB has to allow competitor trains on her tracks and it's not known they stop them and let them rot somewhere for hours.Ammler wrote:2. I should be able to start/stop foreign trains on my tracks.
As fast as a train is on my tracks, I am the BOSS about it...
Re: Infrastructure Sharing
Thats all I thought about, technically.Roest wrote:I disagree here. While of course technically you're the boss and can do whatever you want,Ammler wrote: As fast as a train is on my tracks, I am the BOSS about it...
It's only meant for gameplay, else I wouldn't share my tracks.... (YAPP jams are almost impossible to solve else.)
Greets
Ammler
Town Names:


Still work in progress: OpenGFX or/and OpenSFX - Please help!
- Toni Babelony
- Tycoon
- Posts: 1389
- Joined: 07 Jul 2006 09:34
- Skype: toni_babelony
- Location: Sagamihara-shi, Japan
- Contact:
Re: Infrastructure Sharing
Isn't it an idea when adding waypoints that only allows your trains to pass and waypoints that allow opponent's trains to pass? Maybe this can be combined with the Routing Restriction patch in that regard.
Retired JapanSet developer and creator of TIAS.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Infrastructure Sharing
I'd like to support this notion. It'd make it probably quite easier to maintain ones own tracks.Ammler wrote: 1. I shouldn't be allowed to stop/start my train in a foreign track.
2. I should be able to start/stop foreign trains on my tracks.
Of course this solution has the potential for abuse: trap a foreign train on a piece of your track and let it run there eternally, gaining income for you and only costs without gain for your opponent.
As a 2nd step therefor I propose to grant control to both, train owner AND track owner. A stopped train doesn't cost anything at least, should you be unable to get your train anywhere you need it or to a depot.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Infrastructure Sharing
On the shared stracks, both players (owner of track and owner of train) must have opportunity to do following tasks:
1) turn train around
2) start/stop train
3) send train to depo
4) ignore signals
That allow both sides to "terorise" each others so no-one would be "winner or loser". But also that give ability to both sides to solve stuck or any problems and prevent "terrorism"
.
When company is bancrupted and others player's train is actualy by some of its part on bancupted company's track tile, i suppost the following:
1) Train must inmediatly stop there, where he actualy is.
2) Tracks tiles of bancupted comany under the train will be converted to the actual player company for some real price even he dont have money.
More compicated is situation which is big problem i suppoust end would be needed to solve in future versions:
when someone else is buying company and will not more allow track sharing. I suppoust that in that exactly momment when that happends must:
1) Trains, which are actualy on shared track title will be:
a) denyed to use shared depos
b) send to the depo for service where NO-ONE can change that (but must still react on commands turn,stop/start,ignore signals).
c) when they enter to depo, set denyed to use shared tracks
d) when they have shared depos/stations/signs on theyr destination list, they will stay in depo, others will be released from the depo
2) Trains, which have shared depos/stations/signs on theyr destination list, will be solved by the same way as in point 1.
3) All remainings and new trains must be set to "not use shared tiles/depos/stations" anymore.
4) Afther 1 or 3 months, for any train would be set global settings to not use shared tracks.
EDIT!
Or cleaner/simpler solution which you can easily add to the next version:
When is track sharing turned ON, so it is turned ON for everyone for whole game and noone can turn off that, so problem above dissapears.
Every player can have independent (window) opportunity, to set one price ( commont for income and pay), independend for every of 3 shared service (tracks/stations/depods).
But finaly there would be only one final and common price for all players, independent for every of shared services (one for tracks, one for stations, one for depods). And that would be some arthmetic mean/average of prices set by all players depending on how many stations/track tiles nad depods they have.
Example: how to calculate global price for shared tt (tt=track tiles):
player1 have total of 200tt, he set price on 10
player2 have total of 100tt, he set price on 20
player3 have total of 50tt, he set price on 1
player4 have total of 1tt, he set price on 500
player5 have total of 0tt, he set price on 500
First we need do know how much tt are in the game = 351tt total, as we can see in our example situation. So next step is to calculate, who have how strong power (percent per) on final price, based on amout of tt owned.
per=(AmountOfPlayerTiles*100)/TotalTrackTiles
per1=(200tt * 100)/351tt =57,14
per2=(100tt * 100)/351tt =28,57
per3=(50tt * 100)/351tt =14,29
per4=(1tt * 100)/351tt = 0,29
per5=(0tt * 100)/351tt = 0
Nex step is to calculate player prices, where "wis" is wish price from player:
pri=(per * wis) / 100
pri1=(57.14 * 10) / 100 = 5,714
pri2=(28,57 * 20) / 100 = 5,714
pri3=(14,29 * 1) / 100 = 0,1429
pri4=(0,29 * 500) / 100 = 1,45
pri5=(0 * 500) / 100 = 0
So final price would be pri1+pri2+pri3+pri4+pri5=cca 13,02. The same way (by amount of stations and depods) can be calculated for station sharing and depo sharing service.
PS: there can be good to have predefined maximum player wish price per title/depo/station, beffore the game starts from, maybe in "patch settings" menu.
BTW: Can you release what you have actualy done from v0.4 ? The v0.35 for r13205 would be great
.
1) turn train around
2) start/stop train
3) send train to depo
4) ignore signals
That allow both sides to "terorise" each others so no-one would be "winner or loser". But also that give ability to both sides to solve stuck or any problems and prevent "terrorism"

When company is bancrupted and others player's train is actualy by some of its part on bancupted company's track tile, i suppost the following:
1) Train must inmediatly stop there, where he actualy is.
2) Tracks tiles of bancupted comany under the train will be converted to the actual player company for some real price even he dont have money.
More compicated is situation which is big problem i suppoust end would be needed to solve in future versions:
when someone else is buying company and will not more allow track sharing. I suppoust that in that exactly momment when that happends must:
1) Trains, which are actualy on shared track title will be:
a) denyed to use shared depos
b) send to the depo for service where NO-ONE can change that (but must still react on commands turn,stop/start,ignore signals).
c) when they enter to depo, set denyed to use shared tracks
d) when they have shared depos/stations/signs on theyr destination list, they will stay in depo, others will be released from the depo
2) Trains, which have shared depos/stations/signs on theyr destination list, will be solved by the same way as in point 1.
3) All remainings and new trains must be set to "not use shared tiles/depos/stations" anymore.
4) Afther 1 or 3 months, for any train would be set global settings to not use shared tracks.
EDIT!
Or cleaner/simpler solution which you can easily add to the next version:
When is track sharing turned ON, so it is turned ON for everyone for whole game and noone can turn off that, so problem above dissapears.
Every player can have independent (window) opportunity, to set one price ( commont for income and pay), independend for every of 3 shared service (tracks/stations/depods).
But finaly there would be only one final and common price for all players, independent for every of shared services (one for tracks, one for stations, one for depods). And that would be some arthmetic mean/average of prices set by all players depending on how many stations/track tiles nad depods they have.
Example: how to calculate global price for shared tt (tt=track tiles):
player1 have total of 200tt, he set price on 10
player2 have total of 100tt, he set price on 20
player3 have total of 50tt, he set price on 1
player4 have total of 1tt, he set price on 500
player5 have total of 0tt, he set price on 500
First we need do know how much tt are in the game = 351tt total, as we can see in our example situation. So next step is to calculate, who have how strong power (percent per) on final price, based on amout of tt owned.
per=(AmountOfPlayerTiles*100)/TotalTrackTiles
per1=(200tt * 100)/351tt =57,14
per2=(100tt * 100)/351tt =28,57
per3=(50tt * 100)/351tt =14,29
per4=(1tt * 100)/351tt = 0,29
per5=(0tt * 100)/351tt = 0
Nex step is to calculate player prices, where "wis" is wish price from player:
pri=(per * wis) / 100
pri1=(57.14 * 10) / 100 = 5,714
pri2=(28,57 * 20) / 100 = 5,714
pri3=(14,29 * 1) / 100 = 0,1429
pri4=(0,29 * 500) / 100 = 1,45
pri5=(0 * 500) / 100 = 0
So final price would be pri1+pri2+pri3+pri4+pri5=cca 13,02. The same way (by amount of stations and depods) can be calculated for station sharing and depo sharing service.
PS: there can be good to have predefined maximum player wish price per title/depo/station, beffore the game starts from, maybe in "patch settings" menu.
BTW: Can you release what you have actualy done from v0.4 ? The v0.35 for r13205 would be great

- lead@inbox
- Transport Coordinator
- Posts: 377
- Joined: 28 Dec 2007 04:35
- Location: Serge, Russia, Vladivostok
- Contact:
Re: Infrastructure Sharing
is it possible in your patch - to make subsidiaries or projects in structure of the parent company? With own budget, expenses, incomes, etc.- analogue of a grouping of transport - only at a level of station, way, transport, etc. It will allow to operate company more effectively - to look profitability of separate projects, etc. and sell parts of your company to another player
Re: Infrastructure Sharing
yes, I've already posted there. If this patch (or a similar patch) can't be adapted, I plan to make a very basic version (like with speed/size and private yes/no) for TS.Toni Babelony wrote:Isn't it an idea when adding waypoints that only allows your trains to pass and waypoints that allow opponent's trains to pass? Maybe this can be combined with the Routing Restriction patch in that regard.
yes, seems to be the better way to do it.planetmaker wrote:As a 2nd step therefor I propose to grant control to both, train owner AND track owner. A stopped train doesn't cost anything at least, should you be unable to get your train anywhere you need it or to a depot.
the problem is that a tile can be used by 2 trains of different owner on diagonal tracks.Anunnaki wrote:
When company is bancrupted and others player's train is actualy by some of its part on bancupted company's track tile, i suppost the following:
1) Train must inmediatly stop there, where he actualy is.
2) Tracks tiles of bancupted comany under the train will be converted to the actual player company for some real price even he dont have money.
on bankrupcy, all vehicule on shared infrastructure of bankrupt company are teleported to a depot and stopped. (or sold if no shared depot available, or just deleted if even this can't be done)
that's work fine (afaik

but there is still a problem :
that also happens when bankrupt company's vehicle are on shared tracks and must be removed, or when a player change this setting during a game...Anunnaki wrote:More compicated is situation which is big problem i suppoust end would be needed to solve in future versions:
when someone else is buying company and will not more allow track sharing. I suppoust that in that exactly momment when that happends must:
I may use something like that, as I've some issue (with signals and airports block) when just teleporting the vehicle in shared depot.Anunnaki wrote: 1) Trains, which are actualy on shared track title will be:
a) denyed to use shared depos
b) send to the depo for service where NO-ONE can change that (but must still react on commands turn,stop/start,ignore signals).
c) when they enter to depo, set denyed to use shared tracks
d) when they have shared depos/stations/signs on theyr destination list, they will stay in depo, others will be released from the depo
2) Trains, which have shared depos/stations/signs on theyr destination list, will be solved by the same way as in point 1.
3) All remainings and new trains must be set to "not use shared tiles/depos/stations" anymore.
4) Afther 1 or 3 months, for any train would be set global settings to not use shared tracks.
I thought of giving the vehicle to infrastructure owner if it's a bankrupt case.
(damn, and that just make my think of a potential problem with tracksharing paiement at end of month if one company is bankrupt, and another one is created, taking it's ID. I must check that)
still, there will be issue with vehicles on company bankrupcy.Anunnaki wrote:EDIT!
Or cleaner/simpler solution which you can easily add to the next version:
When is track sharing turned ON, so it is turned ON for everyone for whole game and noone can turn off that, so problem above dissapears.
yes, but be warned this is a WIP, no code cleaning, not enought comment, and some parts buggy.Anunnaki wrote:BTW: Can you release what you have actualy done from v0.4 ? The v0.35 for r13205 would be great.
*TEST VERSION, DON'T USE FOR NORMAL GAME*
but if you want to check the pb with signals and airports, that will help...

Re: Infrastructure Sharing
no. (sorry for short answer, need to leave now, but basically it's another work than this patch)lead@inbox wrote:is it possible in your patch - to make subsidiaries or projects in structure of the parent company? With own budget, expenses, incomes, etc.- analogue of a grouping of transport - only at a level of station, way, transport, etc. It will allow to operate company more effectively - to look profitability of separate projects, etc. and sell parts of your company to another player
Re: Infrastructure Sharing
Yes, that was (global price in previous post) only for case that someone turn off track sharing during game or buy company which was bancrupted (and then turns sharings off).Gedemon wrote:still, there will be issue with vehicles on company bankrupcy.
Anyway, in case of real banrupcy and case than no one will buy this company, than that can be sloved by this example:
1) bancrupted company will sold all vehicles,aircrafts,trains...anything
2) but tracks,roads,stations,airports and other stuff stay there, till the momment, when someone buy this company (when no one will, then till end of game)
3) track sharing price will be 3x higher then is normal global sharing price (calculated in my previous post), this will slowly decrease depthn and in long time finaly completly payback whole debth/loan and make profit.
4) no more interest for loan will be calculated, so loan will not be increased
5) on beginning of every year, the loan/debth of bancrupted company will be decreased by 25% or 33% or 50% against last year, so sooner or later the company would be atractive to the other playes with very small/or withouth debth
6) there must be also choice to buy this company be another player every time, maybe somewhere on comapny windows, where you have "sharing" button.
This solve problem at the end of month when payments are calculated/send to the erased bancrupted company, or what with two trains on one rail tile of bancrupted company, and what with this tile. There is than not necessary to teleport trains to depod and delete. But this is little complicated maybe, so take it only like idea maybe for other later releases.
Thank you very much, i wish to test that in my patch pack EMP (beta) with YAPP, DayLenght, DistantCitys/Industry, ReducedIndustry and ImprovedLoan patchs.Gedemon wrote: *TEST VERSION, DON'T USE FOR NORMAL GAME*
but if you want to check the pb with signals and airports, that will help...![]()
-
- Transport Coordinator
- Posts: 283
- Joined: 08 May 2004 07:48
- Location: Alkmaar, The Netherlands
Re: Infrastructure Sharing
Great patch! I hope this gets in trunk someday... Been waiting for this a long time! Keep up the work!
Beer equals power
Who is online
Users browsing this forum: Baidu [Spider] and 8 guests