
Infrastructure Sharing
Moderator: OpenTTD Developers
Re: Infrastructure Sharing
Thanks, guys! I was looking in the wrong place. 

NM
Sweet forgiveness could ya roll me easy...
Sweet forgiveness could ya roll me easy...
Re: Infrastructure Sharing
too bad you don't have the time anymore. I hope someone else will finish this, and that it will be included in trunk, because I think this would be one of the nicest features to date.....planetmaker wrote:I'm afraid, as it seems, I'll have to drop maintaining IS. Because with all the recent changes to trunk (especially inclusion of 15 companies as opposed, but also others, it - again - would rather mount to a re-write...
And currently I just don't have the time to completely re-write a patch of this magnitude. There's after all, something called real life, too...
Anyone who feels like doing some serious work on this topic, please, contact me. The right to submit to the hg repository (or the possibility to actually create a new one, if desired) are there.
Re: Infrastructure Sharing
Way too broken
Last edited by Aali on 02 Feb 2009 19:39, edited 2 times in total.
Re: Infrastructure Sharing
Aali wrote:Here's a (largely untested) version of the old patch that applies to r15313, enjoy
windows binary someone?

Re: Infrastructure Sharing
just take the trunk, apply the patch, and compile, it's simple.
If you are under Windows :
for the 2 first step, take Tortoise SVN
for compilation, take Cygwin.
If you are under Windows :
for the 2 first step, take Tortoise SVN
for compilation, take Cygwin.
Re: Infrastructure Sharing
Chico008 wrote:just take the trunk, apply the patch, and compile, it's simple.
If you are under Windows :
for the 2 first step, take Tortoise SVN
for compilation, take Cygwin.
i have Tortoise SVN and MSVC 2008, but i can't make the release version right...
running Vistax64, so no BuildOTTD...
- CommanderZ
- Tycoon
- Posts: 1872
- Joined: 07 Apr 2008 18:29
- Location: Czech Republic
- Contact:
Re: Infrastructure Sharing
Did you read this? (it is exactly the same in MSVS 2008 PRO)
Re: Infrastructure Sharing
Yea, right form there.
Well i will give it another try
try1:
sharedinfrastructure.h is missing, and i don't see in in the diff or anywhere else...
some other errors too, but probably linked.
Well i will give it another try

try1:
sharedinfrastructure.h is missing, and i don't see in in the diff or anywhere else...
some other errors too, but probably linked.
Re: Infrastructure Sharing
You are of course correct, I didn't add the files, re-download the above (fixed) patch.
Re: Infrastructure Sharing
no luck 
the
---/null
have to be replaced by ---a/src/shared... .h(and cpp)
after that compile is ok.
but game crashes in debug after opening the "advanced settings"
in full compile game crashes from start.

the
---/null
have to be replaced by ---a/src/shared... .h(and cpp)
after that compile is ok.
but game crashes in debug after opening the "advanced settings"
in full compile game crashes from start.
Re: Infrastructure Sharing
i had these crash with another patch once.
this i caused with WIDGET or MENU that are wrong.
this i caused with WIDGET or MENU that are wrong.
Re: Infrastructure Sharing
I updated this patch to the current trunk. Some parts were copied, others were rewritten. Some others are still on the todo list, see below:
Open questions:
Open questions:
- What should happen when a company goes bankrupt? (teleport?)
- What should happen when sharing of tracks is disabled while a train is on them? (The same question also applies to depots and stations)
- Is it needed to set sharing settings on a per-company basis? e.g. "I want to share my tracks with A and C, but not with B, and D needs to pay more because I don't really like him." Currently you can only open or close your infrastructure for all companies at the same time.
- How should payments be calculated? Trains now pay a fixed fee per day, while others pay per ton of cargo capacity. (Yes, I said per ton, not per unit.) Is this the proper way to do it, and if not, suggest an alternative.
- Company bankruptcy: I did not (yet) copy or re-implement the teleportation code. Currently a bankrupt company with others using its infrastructure will probably result in a crash.
- Disabling a sharing option does not work properly. If you disallow sharing of tracks/stations/depots while someone is using them, the result is 'undefined behaviour' at best. Crashes may or may not happen.
- Parts of the code need commenting and cleanups.
- Make all IsXXXAllowed() functions work without _current_company and it's associated workarounds.
- This patch does not include anything related to fixing transfer payments. This should be done as a separate patch.
- I haven't done any thorough testing. Therefore it is quite possible that the patch contains bugs. A complex patch like this requires proper testing.
- Attachments
-
- IS_15412.diff
- (83.71 KiB) Downloaded 122 times
Create your own NewGRF? Check out this tutorial!
Re: Infrastructure Sharing
Good thing you let me know you were working on it.. 
Anyways, here's the old patch updated to r15416, with a few fixes regarding signals (PBS and block) when companies go bankrupt/disable sharing.
There is one known bug I haven't fixed yet; PBS reservations are not cleared when you disable sharing unless the train has to be teleported/deleted, this means you can end up with stale reservations and have to rebuild the track to get rid of it. As a simple workaround you can use block signals for "untrusted" connections as they should be handled properly.
And since practically no-one complained about the 100% non-existent PBS handling before, this shouldn't be a big issue now
The cargodest version applies to r15416 with my cargodest patch (see cargodest thread), it does NOT apply to the official repo.

Anyways, here's the old patch updated to r15416, with a few fixes regarding signals (PBS and block) when companies go bankrupt/disable sharing.
There is one known bug I haven't fixed yet; PBS reservations are not cleared when you disable sharing unless the train has to be teleported/deleted, this means you can end up with stale reservations and have to rebuild the track to get rid of it. As a simple workaround you can use block signals for "untrusted" connections as they should be handled properly.
And since practically no-one complained about the 100% non-existent PBS handling before, this shouldn't be a big issue now

The cargodest version applies to r15416 with my cargodest patch (see cargodest thread), it does NOT apply to the official repo.
- Attachments
-
- infrastructure_sharing_cargodest_r15416.patch
- (135.62 KiB) Downloaded 114 times
-
- infrastructure_sharing_r15416.patch
- (134.73 KiB) Downloaded 123 times
Last edited by Aali on 10 Feb 2009 20:18, edited 4 times in total.
- JacobD88
- Chief Executive
- Posts: 710
- Joined: 16 Aug 2008 17:51
- Location: Long Eaton, Nottinghamshire. UK
- Contact:
Re: Infrastructure Sharing
I'll give my suggestions to the above based on what i deem a logical solution as i don't really know how/if at all they can be codedSwallow wrote:I updated this patch to the current trunk. Some parts were copied, others were rewritten. Some others are still on the todo list, see below:
Open questions:
- What should happen when a company goes bankrupt? (teleport?)
- What should happen when sharing of tracks is disabled while a train is on them? (The same question also applies to depots and stations)
- Is it needed to set sharing settings on a per-company basis? e.g. "I want to share my tracks with A and C, but not with B, and D needs to pay more because I don't really like him." Currently you can only open or close your infrastructure for all companies at the same time.
1) With regards to bankruptcies i envision the following solutions...
Remaining, non-bankrupt, companies are offered the option to purchase, whole-sale, the bankrupt companies infrastructure... This is probably best, should means be found, to be done in a bidding system where for the time period of say a month, companies can place bids on the bankrupt companies system... At the end of the month, the highest bidder gets the network... It may also be applicable to note that they should also get that companies debt...
This naturally also means that other companies using the newly acquired network, have to pay the new owner the fees...
If no buyer takes up the offer of absorbing the failed companies infrastructure, a time period of say six-months (which is more than enough time) is given for players using that companies infrastructure to remove their vehicles/trains from it, after this time, the infrastructure is removed en-mass, and any other players vehicles still remaining could either be sold off with it and xx% portion of the profits from this sale returned the the owning player, or even more simplistically "crash" which would destroy the vehicle and remove it from the game forcing the player to replace it elsewhere as they should really have already done...
2) if track sharing is disabled during play...
Really i think this should be altered to "sharing disabled after xx months from disabling the patch" again, and as above, after this time all vehicles owned by players other than the owner of the infrastructure should lose their vehicles... This can be once more through "crashing" them, or simply (and with much less damage to the players network) selling them where they stand and passing the money from the sale back to the owner companies... Now i realise this function could be one day abused by players wanting to remove AI trains from their networks so a solution that i can't really think of right now would have to be found to that... But for the mean time, the latter sale option would mean that player would get the monetary value of their vehicle back as compensation which should be enough, maybe this could also be expanded to compensating for the lost cargo they were carrying too...
3) Necessity to selectively allow other players to share infrastructure and selective costs...
This feature is strictly speaking, not necessary, as i'm just happy being able to share infrastructure... But it would be nice to have the option to choose who with and set appropriate rates, it also adds a new challenge to choosing to share infrastructure, as you could penalise players who over-fill your network thus compromising your own efficiency, by giving them higher rates...
If they persist in abusing your network, or quite simply, you don't appreciate that player using your infrastructure, you should then be able to disable their ability to use it... This is great as it forces players who want to use another players network to carefully think about their options and the affect they have on other players... It also means that you would have to communicate with any other "live" players more to discuss what you want to do, as lack of communication in a multiplayer game is never a good thing so this would force people to talk over their plans if they don't want to be banned from that players network...
So to sum up on this front, not necessary, but a nice feature to look forward to having implemented, and naturally there should be an option to choose between "whole-sale" and "selective" sharing in your games...
What do others think?

High-Functioning Autistic & Proud... National Autistic Society * Asperger Foundation
My (O)TTD Work...BIGGER DEPOTS (REL.) & SERVICING-STATIONS (WIP) * Advanced DEPOT DESIGNS * SCREENSHOTS

My personal website is occasionally here - sometimes it's just the family site - it's basically a lucky dip
My (O)TTD Work...BIGGER DEPOTS (REL.) & SERVICING-STATIONS (WIP) * Advanced DEPOT DESIGNS * SCREENSHOTS
My personal website is occasionally here - sometimes it's just the family site - it's basically a lucky dip
Re: Infrastructure Sharing
Aali, i'm missing this:Aali wrote:Good thing you let me know you were working on it..
Anyways, here's the old patch updated to r15416, with a few fixes regarding signals (PBS and block) when companies go bankrupt/disable sharing.
There is one known bug I haven't fixed yet; PBS reservations are not cleared when you disable sharing unless the train has to be teleported/deleted, this means you can end up with stale reservations and have to rebuild the track to get rid of it. As a simple workaround you can use block signals for "untrusted" connections as they should be handled properly.
And since practically no-one complained about the 100% non-existent PBS handling before, this shouldn't be a big issue now
The cargodest version applies to r15416 with my cargodest patch (see cargodest thread), it does NOT apply to the official repo.
boost/graph/adjacency_list.hpp
it is a system include?
some help, please?

Re: Infrastructure Sharing
Can't wait until this goes into trunk! (Devs, are you OK with the idea going into trunk?)
I think that if a company goes bankrupt there should be perhaps a bidding war and the winner gets to take control of the entire shared network. This sounds like A LOT to code though.
I think that if a company goes bankrupt there should be perhaps a bidding war and the winner gets to take control of the entire shared network. This sounds like A LOT to code though.
Re: Infrastructure Sharing
cargodest depends on the boost library, you only need some header files though, you don't have to compile boost itselfTvel wrote: ...
Aali, i'm missing this:
boost/graph/adjacency_list.hpp
it is a system include?
some help, please?
Re: Infrastructure Sharing
Which download should i take?
Swallows IS or Aalis IS?
MfG Tim
Swallows IS or Aalis IS?
MfG Tim
Re: Infrastructure Sharing
I compiled the Aali's patch with cargodest to test 
Nice work to Swallow too, but IS with cargodest sounds more attractive. Keep up the good work guys.
edit: Updated with fix(map edges)
edit2: Update fix(company sharing settings)(newspaper) rev15422
edit3: removed to later post

Nice work to Swallow too, but IS with cargodest sounds more attractive. Keep up the good work guys.
edit: Updated with fix(map edges)
edit2: Update fix(company sharing settings)(newspaper) rev15422
edit3: removed to later post
Last edited by Tvel on 10 Feb 2009 22:05, edited 3 times in total.
Who is online
Users browsing this forum: No registered users and 1 guest