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

Post Reply
User avatar
ostlandr
Chairman
Chairman
Posts: 882
Joined: 12 May 2007 01:09
Location: Northeastern USA

Re: Infrastructure Sharing

Post by ostlandr »

Oooh! Shared bus stations and Union Terminals!

We're not worthy!! :bow:

planetmaker wrote:
yorick wrote:I have some suggestions:
  • Use SubtractMoneyFromAnyPlayer(Player *p, CommandCost cost) instead of SubtractMoneyFromPlayer(CommandCost cost) and setting the _current_player
  • Merge SharedRailwayStations, SharedRoadStops, SharedHarbours and SharedAirports into one function.
  • Have a fee for all types of stations, not only for ones owned by a player, but execute industry-stations like oil rigs and fishing grounds.
  • Remove timelimit for ENABLING sharing, but keep it for disabling or changing fees if it's enabled.
  • Rework CmdSetSharedBoolValues and CmdSetSharedIntValues to have the new value in p1 and the thing that changed in p2, because you can't change multiple at the time.
Thanks, Yorick, for your input. Reading through this, it gives me actually the idea how to split the whole thing into two patches:
- receiving and paying royalties for the usage of property of a different owner (player and non-player all the same). Shared usage is already possible. e.g. for oil rigs. This would also allow for another patch: the construction of stations by the local authority. Especially downtown bus stations, ports or airports might come to my mind there.
- allowing the usage of other player's property, thus extending the shared infrastructure from towns to include also other players tracks and stations.

When time allows I'll have a close look at it :) .
Who is John Galt?
User avatar
Zhall
Tycoon
Tycoon
Posts: 1237
Joined: 17 Jul 2007 01:36
Skype: moonray_zdo
Location: Teh matrix, duh.
Contact:

Re: Infrastructure Sharing

Post by Zhall »

Now ur making it like rail road tycoon 2 or 3... Which in those games you envitiably make no money as you own none of the track and royalties are payed 100% to the owner. If you've ever played those games you'll know what im talking about.

Besides, thats like taking passwords off of companies and allows for waayy to much sabotaging from unrespectful players.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

Sapphire united wrote:Besides, thats like taking passwords off of companies and allows for waayy to much sabotaging from unrespectful players.
You didn't have a look at it, right? No one is forced to share anything... Additionally to your own tracks this patch allows you to use infrastructure of companies who are willing to rent out tracks
User avatar
Zhall
Tycoon
Tycoon
Posts: 1237
Joined: 17 Jul 2007 01:36
Skype: moonray_zdo
Location: Teh matrix, duh.
Contact:

Re: Infrastructure Sharing

Post by Zhall »

I stand corrected. :oops:
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

A maintenance release. Now it should load games from trunk just fine. Also included is the close airport patch as it is IMO a requirement for IS to work properly
Attachments
is_closeAirport_r13683.diff
infractructure sharing for r13683
(138.62 KiB) Downloaded 293 times
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Infrastructure Sharing

Post by Gremnon »

Found just one little problem. If you build a train in someone else's depot, you can't start it because of the limit on only the track owner starting and stopping trains.
I don't know if that was intentional though.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

Gremnon wrote:Found just one little problem. If you build a train in someone else's depot, you can't start it because of the limit on only the track owner starting and stopping trains.
I don't know if that was intentional though.
That's in the current implementation by design: the track owner has the sole power to start and stop trains on his property. A depot is part of his network. Granted, it is not perfect. If you know or can think of a practicable and not easily exploitable solution on when who should get what right to give commands to trains, please say so :).

The idea behind the current implementation is to allow a track owner manage his network without interference. --> No trains will enter a construction site unwanted.
The contrary idea is to allow train owners manage their trains without interference; that's the behaviour of the original patch.
Both might also be possible, e.g. grant both, track and train owner access rights to a train - but then players might constantly undo the action the other did.
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Infrastructure Sharing

Post by Gremnon »

An interesting challenge.

Having not looked into any code for this, and currently being without anything to view it properly with, I'm not certain if any of my ideas are possible. The one that sticks out most, but would probably need a huge chunk of code to work is that you can buy rights to start and stop your trains on their tracks.

I'm going to go off and think on this though, it probably needs a lot of work.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

Hehe, yes, there're many additions and modifications imaginable. On the other hand, small patches are favourable, if you consider maintainance of a patch.

Currently I think the patch can be broken down even in a few sub patches:

- basic patch: track sharing and a simple, global switch which allows it. Maybe have a per company switch, too
- closing airports is already a seperate one
- waypoints feature: either - as now - they simply forbid external track usage through that tile, or more extended and far more difficult to implement, set passage by company.
- set fees and sharing per transport type as well as depots. Maybe make a matrix here so you can charge different companies different amount of money for the same thing.

But then, a patch for a patch... :P
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Infrastructure Sharing

Post by planetmaker »

For completeness sake I copy here the text found on the first page and keep updating then from now on:

  • patch setting to enable sharing of :
  • railway tracks
  • railway stations
  • railway depots
  • airports (and air depots)
  • road stops
  • road depots
  • water depots
  • docks
  • and also :
  • depot owner provision (% of build cost)
  • cost of 1000 tons per tiles on shared tracks
  • landing fee (per tons of cargo capacity)
  • fee for harbours (new)
  • fee for road stops (new)
  • enable each activated patch settings to be selected by player (see screenshot)
  • set delay for individual settings validation (so you won't be surprised by brutal change of prices)
  • use waypoints in order to block other companies using a particular track (new v5)
When activated, individual settings can be set via your company windows (button "sharing" under "build HQ")
Attachments
is_v05_r13731.diff
infrastructure sharing for r13731
(130.91 KiB) Downloaded 272 times
is_closeAirport_r13731.diff
infrastructure sharing + close airports for r13731
(138.69 KiB) Downloaded 422 times
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Infrastructure Sharing

Post by Gremnon »

I had an odd idea and decided to experiment on it.
Using BOTTD, the latest version of this available and the NoAI branch, I thought I'd compile and see what happened, regardless of the fact that it probably wouldn't work.
It failed, I'm assuming because it was meant for trunk and had problems with something NoAI added.
From the patch log, the parts that failed - just in case it comes in useful.

Code: Select all

patching file `src/ship_cmd.cpp'
Hunk #1 FAILED at 41.
Hunk #2 succeeded at 344 (offset 1 line).
Hunk #3 succeeded at 772 with fuzz 2 (offset 4 lines).
Hunk #4 succeeded at 839 (offset 1 line).
1 out of 4 hunks FAILED -- saving rejects to src/ship_cmd.cpp.rej
...
patching file `src/window_type.h'
Hunk #1 FAILED at 94.
1 out of 1 hunk FAILED -- saving rejects to src/window_type.h.rej
...
patching file `src/player_base.h'
Hunk #1 FAILED at 76.
1 out of 1 hunk FAILED -- saving rejects to src/player_base.h.rej
...
patching file `src/players.cpp'
Hunk #1 succeeded at 240 (offset -20 lines).
Hunk #2 succeeded at 578 with fuzz 1 (offset 20 lines).
Hunk #3 FAILED at 1227.
1 out of 3 hunks FAILED -- saving rejects to src/players.cpp.rej
I can grab the .rej files if you want them.
But is there a chance of getting a NoAI compatible patch? Please?
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Infrastructure Sharing

Post by Yexo »

Here it is. I took is_closeAirport_r13731.diff [138.69 KiB] and merged that with the latest NoAI svn version (13726).
Attachments
is-noai-r13726.diff
(99.5 KiB) Downloaded 342 times
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Infrastructure Sharing

Post by Gremnon »

Thanks.
One of those things that I decided to do, and not bother wondering what might happen.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Infrastructure Sharing

Post by Yexo »

Gremnon wrote:Thanks.
One of those things that I decided to do, and not bother wondering what might happen.
Nothing special will happen: AIs won't use the new features, so the only new thing is you being able to use airports / depots from the AI
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Infrastructure Sharing

Post by Gremnon »

That was kind of the idea. It saves me building something there, and since I use airports for most passenger and mail transports, it's perfect. They can build some airports, I'll use them.

Edit: I'm not sure if it's just me, but BOTTD's having trouble with even that... nothing failed according to the output windows, but the compile did and it doesn't seem to say why anywhere.
Second edit: I think I've found where it says it's gone wrong, but I haven't the faintest idea of exactly what it means. I've attached the compile.log in txt format, if I'm right, the problems show up near the end.
Attachments
compile.txt
(16.07 KiB) Downloaded 306 times
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 623
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Re: Infrastructure Sharing

Post by glx »

Gremnon wrote:Edit: I'm not sure if it's just me, but BOTTD's having trouble with even that... nothing failed according to the output windows, but the compile did and it doesn't seem to say why anywhere.
Second edit: I think I've found where it says it's gone wrong, but I haven't the faintest idea of exactly what it means. I've attached the compile.log in txt format, if I'm right, the problems show up near the end.
It's because r13719 (latest noai sync is r13683)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Infrastructure Sharing

Post by Yexo »

Ok, I forgot to add some files in the diff. This one should work.
Attachments
is-noai-r13726.diff
(139.58 KiB) Downloaded 281 times
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Infrastructure Sharing

Post by Gremnon »

Yep, that one did it. Thanks again.
Next time, I gotta remember to stop other stuff hogging the 'net connection so it doesn't take so long.
Chico008
Traffic Manager
Traffic Manager
Posts: 143
Joined: 05 Mar 2008 10:56
Location: France

Re: Infrastructure Sharing

Post by Chico008 »

Gedemon, j'ai peut être trouver un bug.

le transfert de marchandise avec des gares des concurrent marche ?

car en ce moment sur une partie avec Xat j'ai le soucis suivant.
Gare A et B a xat
Gare C a moi.
tous les trains sont a moi.
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.

Sorry for speaking in french, my english is very bad, and i know Gedemon is french ;).
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Infrastructure Sharing

Post by Yexo »

Chico008 wrote:Sorry for speaking in french, my english is very bad, and i know Gedemon is french ;).
But this still is an english-only forum. Either try to translate it in english or send Gedemon a private message.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 10 guests