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
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

Chico008 wrote: je fait transfert de marchandise de A vers B, puis un gros trains de B vers C.
dans tout les cas, les trains font aucun bénef, alors qu'avec le transfert de marchandise, ca devrait en faire.
en ordre j'ai essayer 'décharger et laissé vide' et 'transférer et laissé vide', mais dans les 2 cas, pas de benef, meme virtuel pour le transfert, du coup perte seche enorme.
A savegame will help to understand your example better and much appreciated. My French is not good enough to follow in detail. Also please state which patch (version) you've been using, there're around already a few :P
Chico008
Traffic Manager
Traffic Manager
Posts: 143
Joined: 05 Mar 2008 10:56
Location: France

Re: Infrastructure Sharing

Post by Chico008 »

Playing on r13704 with Tib's patch on multiplayer game.
there is numerous GRF used (George ECS and other for stations, truck, ships, aircraft and trains).
i'm making a save and posting it.
Chico008
Traffic Manager
Traffic Manager
Posts: 143
Joined: 05 Mar 2008 10:56
Location: France

Re: Infrastructure Sharing

Post by Chico008 »

ok, here is the save Save_chico.sav

the deal is.
train 7/10/13/14/23 and 24 don't make money when they transfert their cargo.

next, train 11/12/15/21 and 22 don't make money either when they sell their cargo.

in both case, first group should make 'virtual' money when transfering cargo.
2nd group should make money when selling their cargo.

if you need, a gamepack is available Here (win32) for testing.
it includes all GRF used.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

Chico008 wrote:ok, here is the save Save_chico.sav

the deal is.
train 7/10/13/14/23 and 24 don't make money when they transfert their cargo.

next, train 11/12/15/21 and 22 don't make money either when they sell their cargo.

in both case, first group should make 'virtual' money when transfering cargo.
2nd group should make money when selling their cargo.

if you need, a gamepack is available Here (win32) for testing.
it includes all GRF used.
I tried to reproduce this with a infrastructure sharing patch alone, but failed. Unfortunately I cannot load the savegame as the diff isn't available anymore and I'd need a Mac binary. But I understood correctly, that you take cargo from a station which belongs to another company and transfer it to your own station. From there you pick it up again and transport it to a station of that other company again, right?

Anyway, here's an update of the patch to current trunk as some header file includes changed.
Attachments
is_v05_r13830.diff
update for infrastructure sharing for r13830
(130.91 KiB) Downloaded 176 times
Chico008
Traffic Manager
Traffic Manager
Posts: 143
Joined: 05 Mar 2008 10:56
Location: France

Re: Infrastructure Sharing

Post by Chico008 »

Tib's made un update of his patch pack on r13810,

the bug described before didn't appeared, but another one is still present and hasn't been fixed, i think it is part of infrastructure sharing, but not shure.

Code: Select all

openttd: /srv/r13810-HFR_src/src/tile_map.h:135: Owner GetTileOwner(TileIndex): 
Assertion `!IsTileType(tile, MP_HOUSE)' failed.
the savegame => HERE

if you need a windows clients, use this one (packed with all GRF needed)
Last edited by jonty-comp on 30 Aug 2008 07:37, edited 1 time in total.
Reason: table-breaking
Chico008
Traffic Manager
Traffic Manager
Posts: 143
Joined: 05 Mar 2008 10:56
Location: France

Re: Infrastructure Sharing

Post by Chico008 »

Hi, we'vejust notice something pretty annoying with Infrastructure Sharing.

when i make a train in a depot that is not mine, i can't launch the train.
only the owner of the depot can launch the train.

it's pretty borring to have to wait for the owner to launch our trains.
could you fix this ?

Thx.
jaybud4
Engineer
Engineer
Posts: 116
Joined: 16 Feb 2008 06:13

Re: Infrastructure Sharing

Post by jaybud4 »

I'd like to be able to connect my rails to other people's. But it doesn't work like that yet.
Any chance?
Image
If you're bugged by anything I say/do: Please send me a PM. I don't always watch every thread I post in after I do so.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

Chico008 wrote:it's pretty boring to have to wait for the owner to launch our trains.
could you fix this ?
It's not a bug, it's a feature :) The idea behind this is to allow the track owner control over what happens on his tracks in order to allow him to fix issues with his network. Allowing people to launch trains from the depot would basically render this futile. Might be an idea to introduce just another patch option ;). Allow owner control [yes/no]
jaybud4 wrote:I'd like to be able to connect my rails to other people's. But it doesn't work like that yet.
Any chance?
I'm not sure what you mean. If you mean that you cannot alter the tracks on a tile which belongs to another company (also just adding a branch) - sure, you're right. But that's nothing which needs fixing. After all, you don't want another company wreaking havoc on your rail system. It would open the possibility for all kind of sabotage.

Currently I'm having unfortunately trouble to get this patch working with recent trunk. There's some incompatibility with PBS which I so far haven't figured out where it is :S
jaybud4
Engineer
Engineer
Posts: 116
Joined: 16 Feb 2008 06:13

Re: Infrastructure Sharing

Post by jaybud4 »

planetmaker wrote:I'm not sure what you mean. If you mean that you cannot alter the tracks on a tile which belongs to another company (also just adding a branch) - sure, you're right. But that's nothing which needs fixing. After all, you don't want another company wreaking havoc on your rail system. It would open the possibility for all kind of sabotage.
See, but this patch itself opens up all sorts of sabotage options anyway.
For instance, you can stop your train/rv/plane on top of the station (or junction before station depending on the type of station used)/loading bay/runway...
Could always make it a toggleable option for those who want literal infrastructure sharing...
Image
If you're bugged by anything I say/do: Please send me a PM. I don't always watch every thread I post in after I do so.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

jaybud4 wrote:See, but this patch itself opens up all sorts of sabotage options anyway.
For instance, you can stop your train/rv/plane on top of the station (or junction before station depending on the type of station used)/loading bay/runway...
Could always make it a toggleable option for those who want literal infrastructure sharing...
The point is: the latest patch does not allow you to stop or start vehicles on the infrastructure of other companies. Previously all control was by the vehicle owner and we had a lengthy discussion over how to handle it best. We decided to change it so that now control over a train is always given to the owner of the infrastructure. With planes, I've got to test, I'm not sure now.
Of course that allows for sabotage, too, e.g. like trapping a vehicle in an eternal circle. But the possibility to sort out jams is more important IMO. I may consider to allow both, track and vehicle owner to start and stop vehicles via patch option.
Snuk the Great
Engineer
Engineer
Posts: 63
Joined: 26 Aug 2005 15:12

Re: Infrastructure Sharing

Post by Snuk the Great »

I just looked into the progress of OpenTTD, which I do every few months. Now I see you have PBS and this patch. Briliant! I did not get to test it in a LAN game yet though, but I probably will later tonight.
planetmaker wrote:Currently I'm having unfortunately trouble to get this patch working with recent trunk. There's some incompatibility with PBS which I so far haven't figured out where it is :S
If you mean merging it with the trunk and getting it to compile, use the one added to the post. You probably had a bit of trouble with a variable that seems to have been moved. I at least had that trouble, but it was nothing a search and replace could not fix. It compiles fine, but I have not tested it in action yet. Only saw the GUI and figured it would probably work. So, for as far as I know I might have broken it ;). Let me know if it works out for you.
Attachments
shared_infrastructure_r14097.patch
Shared infrastructure patch on revision 14097 of the trunk.
(133.29 KiB) Downloaded 181 times
Snuk the Great
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

Snuk the Great wrote:If you mean merging it with the trunk and getting it to compile
I actually meant "works" as in "does not crash on title screen". Obviously I was missing something which I had also been missing before when I tried to merge back then YAPP and IS... Me goes investigating.
Thanks a bunch :)

EDIT: testing it, I found that starting & stopping of trains only works for the train owner (again). Another piece of motivation to fix this some time soon with just another patch option :)
jaybud4
Engineer
Engineer
Posts: 116
Joined: 16 Feb 2008 06:13

Re: Infrastructure Sharing

Post by jaybud4 »

If you're going to put all these different ideas as a patch option, why not have actual infrastructure sharing (as I mentioned earlier) as one as well? It only makes sense.. There's some times you want to play cooperative but separate companies.. Or in some cases the other player won't allow you to join their company but is fine with sharing...
Patch option just seems the best way to go. Disable it by default and have a warning or something about the sabotage possibility.
Image
If you're bugged by anything I say/do: Please send me a PM. I don't always watch every thread I post in after I do so.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

jaybud4 wrote:If you're going to put all these different ideas as a patch option, why not have actual infrastructure sharing (as I mentioned earlier) as one as well?
Go and actually look at the patch.
Each company can configure what (or if at all) it shares and for what royalty. Host can turn it off completely.

EDIT: without bump another update to trunk
Attachments
is_v05_r14152.diff
infrastructure sharing for r14152
(92.91 KiB) Downloaded 150 times
Kristjan993
Engineer
Engineer
Posts: 13
Joined: 26 Sep 2004 11:32
Contact:

Re: Infrastructure Sharing

Post by Kristjan993 »

in microsoft express c++ with the latest diff that i could find (14152), when compiling trunk r14152, i get an error

Code: Select all

4>...\open\src\yapf\follow_track.hpp(11) : fatal error C1083: Cannot open include file: '../sharedinfrastructure.h': No such file or directory
what am i doing wrong?
the installation guidelines were followed step by step.
Little tycooner
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Infrastructure Sharing

Post by Yexo »

Kristjan993 wrote:in microsoft express c++ with the latest diff that i could find (14152), when compiling trunk r14152, i get an error

Code: Select all

4>...\open\src\yapf\follow_track.hpp(11) : fatal error C1083: Cannot open include file: '../sharedinfrastructure.h': No such file or directory
what am i doing wrong?
the installation guidelines were followed step by step.
Probably nothing: the latest patch by planetmaker doesn't include infrastructure.h, so he should fix it.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

Kristjan993 wrote:in microsoft express c++ with the latest diff that i could find (14152), when compiling trunk r14152 (...)
what am i doing wrong?
You're doing nothing wrong. The error is on my side that I forgot to add two crucial files to this patch :S.
I'll add them tonight, so check in 9h after this posting :). Thx for notification.

EDIT: updated patch files attached
Attachments
is_v05_r14152.diff
infrastructure sharing for r14152 - this time with all files ;)
(132.01 KiB) Downloaded 159 times
is_v05_r14180.diff
update to trunk r14180
(131.99 KiB) Downloaded 154 times
Nappe1
Traffic Manager
Traffic Manager
Posts: 175
Joined: 19 Jan 2004 17:25
Location: kotka or Savitaipale, Finland
Contact:

Re: Infrastructure Sharing

Post by Nappe1 »

hmmh... I first thought it would be my own patches, but no...
latest patch (r14180) does merge nicely to latest revision and it builds without warnings as well, but crashes right away when any of the industries changes their production (right on the moment when news should be displayed... gives an assert from oldpool.h, but something else cause the misbehave, as it tries to display vechile info window, with index being around 50000 bigger than count of the pool...)

Same happened with latest revision being 14180 as well... anyone up to task to check what goes wrong?
I tried but it goes too down in the core.
SmatZ
OpenTTD Developer
OpenTTD Developer
Posts: 351
Joined: 03 Oct 2006 18:26
Location: Prague, Czech Republic
Contact:

Re: Infrastructure Sharing

Post by SmatZ »

Fixed bug with news causing crash + updated to current trunk
Attachments
is_v05_r14215.diff
updated to r14215
(131.95 KiB) Downloaded 187 times
Image
User avatar
Celestar
Director
Director
Posts: 574
Joined: 02 Jul 2004 10:56
Contact:

Re: Infrastructure Sharing

Post by Celestar »

Ok I've read through the patch (didn't play it yet). Overall it looks very nice, but I have a few comments if I may :D :

EASY STUFF:

1) There are many many many places with something like (thing1->owner == thing2->owner || SharedThings(thing1)). Methinks that should end up in some inline function, because some of the if-expressions are just not really human readable anymore.

2) "SharedTracksPaiement" ... english function names please :D

3) Some magic numbers: Money route_profit[8]

4) /**** CHANGE HERE ****/ <= dunno what that is :D

5) The array of the two values for the settings (current and next month or whatever) might want to have some static const int for the index instead of using "0" and "1"

Code: Select all

enum {
	IS_CURRENT,
	IS_FUTURE,
        IS_END
6) There are some printfs in the code left

7) in station_cmd.cpp you set the feeder share for player 0, why not for the player that the station belongs to?

8) please use ton_tiles instead of tontiles if possible somehow

HARD STUFF:

Something more general: OpenTTD is C++ (OOP) meanwhile. Maybe there could be a "SharedInfrastructure" Class and each player has one instance of that class? Then the global variables could be static members and the whole code would be a bit more readable.

Hope this helps

Celestar
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests