Infrastructure Sharing

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
nm2588
Engineer
Engineer
Posts: 33
Joined: 09 Jul 2004 12:37
Location: Indiana

Re: Infrastructure Sharing

Post by nm2588 »

Thanks, guys! I was looking in the wrong place. :oops:
NM

Sweet forgiveness could ya roll me easy...
Nimugp
Engineer
Engineer
Posts: 29
Joined: 08 Mar 2007 13:37

Re: Infrastructure Sharing

Post by Nimugp »

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 8), 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 :) .
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.....
Aali
Traffic Manager
Traffic Manager
Posts: 144
Joined: 01 Oct 2008 00:04
Location: Sweden

Re: Infrastructure Sharing

Post by Aali »

Way too broken
Last edited by Aali on 02 Feb 2009 19:39, edited 2 times in total.
Tvel
Engineer
Engineer
Posts: 77
Joined: 29 Mar 2008 22:42
Skype: tvel___
Location: Bulgaria

Re: Infrastructure Sharing

Post by Tvel »

Aali wrote:Here's a (largely untested) version of the old patch that applies to r15313, enjoy :)

windows binary someone? :bow:
Chico008
Traffic Manager
Traffic Manager
Posts: 143
Joined: 05 Mar 2008 10:56
Location: France

Re: Infrastructure Sharing

Post by Chico008 »

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.
Tvel
Engineer
Engineer
Posts: 77
Joined: 29 Mar 2008 22:42
Skype: tvel___
Location: Bulgaria

Re: Infrastructure Sharing

Post by Tvel »

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...
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Infrastructure Sharing

Post by CommanderZ »

Did you read this? (it is exactly the same in MSVS 2008 PRO)
Tvel
Engineer
Engineer
Posts: 77
Joined: 29 Mar 2008 22:42
Skype: tvel___
Location: Bulgaria

Re: Infrastructure Sharing

Post by Tvel »

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.
Aali
Traffic Manager
Traffic Manager
Posts: 144
Joined: 01 Oct 2008 00:04
Location: Sweden

Re: Infrastructure Sharing

Post by Aali »

You are of course correct, I didn't add the files, re-download the above (fixed) patch.
Tvel
Engineer
Engineer
Posts: 77
Joined: 29 Mar 2008 22:42
Skype: tvel___
Location: Bulgaria

Re: Infrastructure Sharing

Post by Tvel »

no luck :P

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.
Chico008
Traffic Manager
Traffic Manager
Posts: 143
Joined: 05 Mar 2008 10:56
Location: France

Re: Infrastructure Sharing

Post by Chico008 »

i had these crash with another patch once.
this i caused with WIDGET or MENU that are wrong.
Hirundo
Transport Coordinator
Transport Coordinator
Posts: 298
Joined: 27 Jan 2008 13:02

Re: Infrastructure Sharing

Post by Hirundo »

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.
  • 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.
Todo list:
  • 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.
Please note that this patch was made using a mercurial queue. This means that if you want to apply this patch, you should use patch -p1. I will make the full patch queue (18 patches) available upon request.
Attachments
IS_15412.diff
(83.71 KiB) Downloaded 123 times
Create your own NewGRF? Check out this tutorial!
Aali
Traffic Manager
Traffic Manager
Posts: 144
Joined: 01 Oct 2008 00:04
Location: Sweden

Re: Infrastructure Sharing

Post by Aali »

Good thing you let me know you were working on it.. :P

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 :P

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 115 times
infrastructure_sharing_r15416.patch
(134.73 KiB) Downloaded 124 times
Last edited by Aali on 10 Feb 2009 20:18, edited 4 times in total.
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 710
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Infrastructure Sharing

Post by JacobD88 »

Swallow 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.
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 coded

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?


:mrgreen:
Tvel
Engineer
Engineer
Posts: 77
Joined: 29 Mar 2008 22:42
Skype: tvel___
Location: Bulgaria

Re: Infrastructure Sharing

Post by Tvel »

Aali wrote:Good thing you let me know you were working on it.. :P

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 :P

The cargodest version applies to r15416 with my cargodest patch (see cargodest thread), it does NOT apply to the official repo.
Aali, i'm missing this:

boost/graph/adjacency_list.hpp

it is a system include?
some help, please? :P
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Infrastructure Sharing

Post by Wasila »

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.
Aali
Traffic Manager
Traffic Manager
Posts: 144
Joined: 01 Oct 2008 00:04
Location: Sweden

Re: Infrastructure Sharing

Post by Aali »

Tvel wrote: ...
Aali, i'm missing this:

boost/graph/adjacency_list.hpp

it is a system include?
some help, please? :P
cargodest depends on the boost library, you only need some header files though, you don't have to compile boost itself
Timmaexx
Transport Coordinator
Transport Coordinator
Posts: 301
Joined: 03 Jan 2009 17:55

Re: Infrastructure Sharing

Post by Timmaexx »

Which download should i take?
Swallows IS or Aalis IS?

MfG Tim
Tvel
Engineer
Engineer
Posts: 77
Joined: 29 Mar 2008 22:42
Skype: tvel___
Location: Bulgaria

Re: Infrastructure Sharing

Post by Tvel »

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
Last edited by Tvel on 10 Feb 2009 22:05, edited 3 times in total.
555gln22
Engineer
Engineer
Posts: 120
Joined: 09 Sep 2008 19:48

Re: Infrastructure Sharing

Post by 555gln22 »

Awesome! thanks! :bow:
Formerly known as 'davepoth'
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests