Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Tue Jun 27, 2017 3:47 am

All times are UTC




Post new topic  Reply to topic  [ 343 posts ]  Go to page 1 2 3 4 518 Next
Author Message
 Post subject: Infrastructure Sharing
PostPosted: Mon May 05, 2008 1:59 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Apr 29, 2004 9:53 pm
Posts: 150
I've made some change to Vikthor's tracksharing patch from subsidiaries & contracts thread.

I really hope this is MP stable, it seems to be ok on my LAN, but I would like to see it tested on the net (Ammler ? ;) )

what's in :

    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)

When activated, individual settings can be set via your company windows (button "sharing" under "build HQ")


*** latest version v0.3 r13031 ***

Changelog v0.3 :
- added : show cost or income animation above HQ when calculating tracks payments
- added : send news message when changing sharing settings
- fixed : Visual Studio project files
- update to r13031
- warning : savegame from 0.1 can't be loaded (0.2 to 0.3 should be ok)

changelog v0.2 :
- removed : max train size and min train speed. Those should be set by another patch (Waypoint or signals restriction)
- added : fee for road stops per tons of cargo capacity (patch & player setting)
- added : fee for harbours per tons of cargo capacity (patch & player setting)
- added : show cost or income animation on station fee paiement
- added : remove station fee from vehicle annual profit
- fixed : do not assume that a station (or tile) is owned by a player
- warning : won't load savegame from 0.1

changelog v0.1 :
- change : max train length value is now tiles instead of wagons
- fix : do not use v->max_speed to check min speed, as it can be lowered when entering depot or station. Use cached_max_speed instead
- fix : typo, variables, use MAX_PLAYERS, some code change
- fix : when max_lenght is set to 0, it means "no size limits" and not "no tracksharing at all"
- fix : sometimes min speed setting was not recorded
- added / fix : when using YAPF, train won't try to go where it can't because of speed or size (but not available to NPF)
- added / fix : can't order a train to go to a station/waypoint which doesn't allow it's speed or size (but this does not check the tracks between)


Attachments:
File comment: Infrastructure Sharing test version (outdated, see above) (r12949)
r12949_infrastructure_sharing.patch [91.71 KiB]
Downloaded 671 times
File comment: Sharing settings & player GUI
shared.png [158.54 KiB]
Downloaded 1989 times


Last edited by Gedemon on Sat May 10, 2008 6:13 pm, edited 8 times in total.
Top
   
PostPosted: Mon May 05, 2008 7:51 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9012
Location: Sol d
Hi,

I think this sharing is a really nice feature. Unfortunately, when I compile I get two warnings related to track sharing. So far I have no idea about its consequences:
Code:
[SRC] Compiling sharedinfrastructure.cpp
/home/ingo/ottd/trunk/src/sharedinfrastructure.cpp: In function ‘void SharedTracksPaiement()’:
/home/ingo/ottd/trunk/src/sharedinfrastructure.cpp:222: warning: cannot pass objects of non-POD type ‘class Money’ through ‘...’;
call will abort at runtime
/home/ingo/ottd/trunk/src/sharedinfrastructure.cpp: In function ‘void SharedAirportLandingFee(Owner, Owner, uint16)’:
/home/ingo/ottd/trunk/src/sharedinfrastructure.cpp:288: warning: cannot pass objects of non-POD type ‘class Money’ through ‘...’;
call will abort at runtime


Regards,
pm

EDIT: made lines shorter to not break table

_________________
Image
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


Top
   
PostPosted: Mon May 05, 2008 8:06 am 
Offline
Engineer
Engineer

Joined: Sat Feb 23, 2008 9:52 am
Posts: 49
Location: Norway
There's a thought: If you split it into few small patches, prefferably as small as possible, you'll have bigger chance of getting it into trunk. I don't know how the quality of your code is - I didn't look at code yet, since I'm at school - but the feature itself is great. Especially track sharing in MP.

_________________
Robbie


Top
   
PostPosted: Mon May 05, 2008 8:51 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9012
Location: Sol d
We set up a test game on the openttdcoop dev server. Join us and help testing this patch! Check out the openttdcoop Blog for more and the binaries.

_Robbie_ wrote:
There's a thought: If you split it into few small patches, prefferably as small as possible, you'll have bigger chance of getting it into trunk. I don't know how the quality of your code is - I didn't look at code yet, since I'm at school - but the feature itself is great. Especially track sharing in MP.

Probably a good idea. Though - if I read the code correctly - quite a large chunk is on the GUI and patch settings.
Maybe - for a start - leave out or move to an additiona patch the size and speed limit settings (though they're no big part, if I saw correctly). Not sure how sensible it is to split it into different patches wrt airports, trains, ships and vehicles.

On question which arose when looking at the code: isn't there a MAX_PLAYERS const declared which should be used instead of the 8 falling from the sky?
Quote:
--- src/economy.cpp (revision 12949)
+++ src/economy.cpp (working copy)
@@ -1470,8 +1470,10 @@
int result = 0;

Money vehicle_profit = 0; // Money paid to the train
- Money route_profit = 0; // The grand total amount for the route. A-D of transfer chain A-B-C-D
+ Money route_profit[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // The grand total amount for the route. A-D of transfer chain A-B-C-D
+ bool route_profit_change = false;
Money virtual_profit = 0; // The virtual profit for entire vehicle chain
+ const Player* p;

StationID last_visited = front_v->last_station_visited;
Station *st = GetStation(last_visited);


EDIT: added link to dev server

_________________
Image
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


Last edited by planetmaker on Mon May 05, 2008 10:38 am, edited 2 times in total.

Top
   
PostPosted: Mon May 05, 2008 9:17 am 
Offline
President
President
User avatar

Joined: Sun Jun 18, 2006 6:18 pm
Posts: 953
Location: Switzerland
Gedemon wrote:
I really hope this is MP stable, it seems to be ok on my LAN, but I would like to see it tested on the net (Ammler ? ;) )


Your wish is my order:

Server is up:
Image
(Linux and Windows binaries available there...)
IRC: irc.oftc.net/openttdcoop.dev

Greets
Ammler

_________________
Image
Town Names: Image Portuguese Image Belarusian Image French Image Swiss · Image Temperate Lumber Mill
Still work in progress: OpenGFX or/and OpenSFX - Please help!


Last edited by Ammler on Mon May 05, 2008 2:31 pm, edited 2 times in total.

Top
   
PostPosted: Mon May 05, 2008 11:44 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9012
Location: Sol d
I got desynced on the dev server. In order to track the desync both, Ammler and me tried to compile a debug binary. Unlike without debuging it doesn't compile:
Code:
[SRC] Compiling openttd.cpp
/home/ingo/ottd/trunk/src/openttd.cpp: In function ‘void StateGameLoop()’:
/home/ingo/ottd/trunk/src/openttd.cpp:997: error: ‘struct Vehicle’ has no member named ‘unitnumberlength’
/home/ingo/ottd/trunk/src/openttd.cpp:1014: error: ‘struct Vehicle’ has no member named ‘unitnumberlength’
/home/ingo/ottd/trunk/src/openttd.cpp:1026: error: ‘struct Vehicle’ has no member named ‘unitnumberlength’
make[1]: *** [openttd.o] Fehler 1
make[1]: Leaving directory `/home/ingo/ottd/trunk/objs/release'
make: *** [all] Fehler 2

EDIT: a fix by SmatZ (r12955) solved the issue. Thx a lot!

Also two things we noted:

a) When we connect two tracks, the train just wouldn't continue onto the track of the other company. (see !stuck in save)
EDIT: it's #of wagons, not tiles. Thx. Gedemon
b) When my company went bancrupt, a piece of track with another company's train on it got moved to another company. (make yellow company bankrupt or just wait)

For reference: the patch settings in the rcon:
+ "shared_railway_stations",
+ "shared_railway_tracks",
+ "shared_railway_depots",
+ "shared_road_stops",
+ "shared_road_depots",
+ "shared_harbours",
+ "shared_water_depots",
+ "shared_airports",
+ "shared_provision",
+ "shared_tontile_cost",
+ "shared_landing_fee",
+ "shared_player_level",
+ "shared_delay",


Attachments:
File comment: trains not continuing on other companies track
Planet Transport, 23. Mär 1956.sav [383.83 KiB]
Downloaded 187 times

_________________
Image
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


Last edited by planetmaker on Mon May 05, 2008 3:52 pm, edited 1 time in total.
Top
   
PostPosted: Mon May 05, 2008 3:20 pm 
Offline
Engineer
Engineer

Joined: Thu Mar 03, 2005 7:29 pm
Posts: 9
Location: Utrecht, The Netherlands
Quote:
b) When my company went bancrupt, a piece of track with another company's train on it got moved to another company. (make yellow company bankrupt or just wait)

that was my train :D

a more complete description would be that occupied track doesn't get removed upon bankruptcy, while it remembers the owner by company ID. At first it'd claim it was still owned by the bankrupt company ("Owned by Planet Transport"), until someone else created a new company and got ownership over the tile.


Top
   
PostPosted: Mon May 05, 2008 4:02 pm 
Offline
Engineer
Engineer

Joined: Tue Aug 16, 2005 4:09 pm
Posts: 64
Location: Prague, Czech Republic
That is super... tomorow i will test it in one week long game on my dedicated server :).

BTW i try to translate all texts to SLOVAK and CZECH language and i send you back changes for lang files.


Top
   
PostPosted: Mon May 05, 2008 4:42 pm 
Offline
Engineer
Engineer

Joined: Sun Jun 13, 2004 4:57 pm
Posts: 69
Location: Prague, Czech republic
Nice, I am glad somebody continues in development of this patch, though I have few concerns.

  • First was already mentioned - it's the size of current patch, it's almost double the size compared to the patch you posted to CIV. I think Rubidium somewhere mentioned that patches should be around 10kB max.
  • Second is addition of unnecessary features - minimum train speed and maximum train size would be better handled in programmable signals/waypoint patch, this sets limit globally, while when using programmable waypoints, you can do it differently on different parts of network and on per company basis.
  • The individual settings are certainly very interesting, but it would be even better if you could set different conditions for different companies - eg. Allowing railroad sharing only to players you know.
  • Anyway, I have made patch that should be applied to source patched by Gedemons patch, it changes tontiles from uint64 to OverflowSafeUint64, because I am not sure if it could not overflow when using high daylength, very heavy train with high speed. And it corrects one typo, as I believe that Paiement should be spelled Payment

Anunnaki: While I don't want to spoil your enthusiasm, please be aware that patches can be submitted to devs only in English and then will be translated by assigned translators.


Attachments:
File comment: git diff apply with patch -p1
r12949_infrastructure_sharing_change.patch [2.11 KiB]
Downloaded 309 times
Top
   
PostPosted: Mon May 05, 2008 8:26 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Apr 29, 2004 9:53 pm
Posts: 150
Thank you all for the current testing, feedbacks and help :D

now it seems that I've got some bugs to fix -> working on them right now...


Top
   
PostPosted: Mon May 05, 2008 11:41 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Apr 29, 2004 9:53 pm
Posts: 150
ok, first update :

changelog v0.1 :
- change : max train length value is now tiles instead of wagons
- fix : do not use v->max_speed to check min speed, as it can be lowered when entering depot or station. Use cached_max_speed instead (thx Vikthor)
- fix : typo, variables, use MAX_PLAYERS, some code change (thx planetmaker, Vikthor)
- fix : when max_lenght is set to 0, it means "no size limits" and not "no tracksharing at all" :oops:
- fix : sometimes min speed setting was not recorded
- added / fix : when using YAPF, train won't try to go where it can't because of speed or size :idea: (but not available to NPF :? )
- added / fix : can't order a train to go to a station/waypoint which doesn't allow it's speed or size (but this does not check the tracks between)

todo :
- show a message when a company change it's sharing settings
- reflect landing fee cost in aircraft annual income
- show cost animation for landing fee. players should see that 200$/tons is in fact a high fee :)
- do not block train in middle of tracks on sharing setting change (well, how ?)
- can't order a train to go to a shared depot which doesn't allow it's speed or size (and don't try to go there for service)

to discuss :
- what to do of tracks under a train when shared owner goes bankrupt (and what can be done of the train itself ?) :mrgreen:
- does infrastructure sharing something that may goes into trunck
- if yes, then size does matter and do not even think of more features yet, better think on how to split this. (and yes remove what should be done with programmable waypoint/signals, but that's not the big part of the patch - GUI is)
- if no, ok, I'll let you make the wishlist, but don't expect miracles
- "different conditions for different companies" ? yes, I'll like to have this. When ? don't know :O


And again, thanks for feedbacks, advices, and everyone at openttdcoop :D


Attachments:
File comment: Shared Infrastructure v0.1 r12967
r12967_infrastructure_sharing_v0.1.patch [92.18 KiB]
Downloaded 150 times
Top
   
PostPosted: Tue May 06, 2008 12:06 am 
Offline
Engineer
Engineer

Joined: Thu Mar 03, 2005 7:29 pm
Posts: 9
Location: Utrecht, The Netherlands
Gedemon wrote:
to discuss :
- what to do of tracks under a train when shared owner goes bankrupt (and what can be done of the train itself ?) :mrgreen:
I'd say the track changes owner to the train currently occupying it. That'd be the cleanest solution. One alternative is to remove all trains on the track in the process (next time, do watch the news for bankruptcy announcements 8) )

Quote:
- does infrastructure sharing something that may goes into trunck
It would be a nice feature to have in the trunk.

Quote:
- if yes, then size does matter and do not even think of more features yet, better think on how to split this. (and yes remove what should be done with programmable waypoint/signals, but that's not the big part of the patch - GUI is)
Adjust the patch such that all gui elements are removed except a single patch option to allow track sharing, then make separate patches for various things you possibly want to configure. (i.e. one for payment rates, one for the additional patch settings, one for company subselection, etc)

Quote:
- if no, ok, I'll let you make the wishlist, but don't expect miracles
we can still have a wishlist even if the plan is to go for trunk ;)


Top
   
PostPosted: Tue May 06, 2008 2:19 am 
Offline
TTDPatch Developer
TTDPatch Developer
User avatar

Joined: Sun Jul 24, 2005 5:07 am
Posts: 758
Location: Canberra, Australia
combuster wrote:
Gedemon wrote:
to discuss :
- what to do of tracks under a train when shared owner goes bankrupt (and what can be done of the train itself ?) :mrgreen:
I'd say the track changes owner to the train currently occupying it. That'd be the cleanest solution. One alternative is to remove all trains on the track in the process (next time, do watch the news for bankruptcy announcements 8) )

I don't know if that's a good idea... you should only own that track if you bought out the company.... otherwise the train should check it's current tile for a bankrupt company and if it's now on 'dead' track then send itself to the nearest non-bankrupt company's depot that it can?

_________________
Image
Model Trains, DCC, Photography, Homebrew DCC Booster + Computer Interface


Top
   
PostPosted: Tue May 06, 2008 10:25 am 
Offline
Engineer
Engineer

Joined: Tue May 06, 2008 10:14 am
Posts: 1
Hi, long time reader, first time poster, very long time TT player!

I love the idea of this patch! 8)

My suggestions on dealing with the bankrupcy issue that I would like to add to the discussion, from a gameplay POV, are as follows:

As soon as a company receives its first bankruptcy warning it should be treated as being in receivership and any current arrangements with other companies be put on hold. The deals can be reinstated 6 months/1 year (an option, perhaps) after the company gets back into the black.

This way, a player running a company as a service provider is affected as are any companies who have placed their bets through relying on a 3rd party network. The reason I like that is because then a big company in financial trouble can have an effect on the whole game economy and it's much more of a real-life situation :)

Vehicles caught on 3rd party owned track at the first warning of said 3rd party bankruptcy should be allowed to continue through to the nearest player owned track/depot/station. If the main company does go bankrupt, this could create a frantic scrambling for the new assets (services industries and new track route space) - again more like real-life - and even deals with other players to create new service agreements.


Top
   
PostPosted: Tue May 06, 2008 12:00 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Apr 24, 2004 10:43 am
Posts: 1947
Location: Venezia - Italia
Gedemon wrote:
to discuss :
- what to do of tracks under a train when shared owner goes bankrupt (and what can be done of the train itself ?) :mrgreen:

Pause the game, popup an auction UI for all players to decide who wants to purchase the bankrupted company's stuff (and this is mandatory, the game won't be unpaused until somebody win the auction), so you don't have to remove anything :)

_________________
ImageImage
ImageImage
ImageImage
newgrf tests, see: newgrf test topic, my patches: Wolf01's Hire Point
Italian TTD Forum
Wiki Page


Top
   
PostPosted: Tue May 06, 2008 12:25 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
what if nobody wants to buy it then?

_________________
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage


Top
   
PostPosted: Tue May 06, 2008 12:27 pm 
Offline
Engineer
Engineer

Joined: Tue Aug 16, 2005 4:09 pm
Posts: 64
Location: Prague, Czech Republic
Quote:
to discuss :
- what to do of tracks under a train when shared owner goes bankrupt (and what can be done of the train itself ?)


option 1 - more complicated:

when player have bancrupted (and no one will buy this company), his rails will stay there next 6 or 12months. In this time, every train on this shared tracks, and trains which have destination "bancrupted shared station/depo", will be rerouted to the nearest own depos, and stop there. The same is necessary for trains, which have destination reachable only thru shared tracks will be rerouted to the own depo too. When no own depo is avaible, there can be a second option - shared depo of other not bancrupted comapany.


option 2 - simple:

the pieces of shared tracks on which is actualy standing train would be assigned to the comany which own the train. Then is important, stoping payments for service, so train would no more spend money for "fuel" when is standing = the same way as in depos.

EDIT:
When someone buys bancrupted company and will not assign track sharing for other players...there woul be 1 yer not possible to change track sharing condition, and the trains will have time to make steps in options above too.

You know, when you are playing long game on server (DAYLENGHT 10-30), you will no have problem with "spending" and own bancrupcy when other company falls down and your stucked trains will suck your many and cause your own bancrupcy thru night, when you are not connected to the server.

PS: Thank you very much for your patch...i will release my own MODPACK (your TrackSharing,YAPP,Loans,Daylenght for about two weeks long game on my dedicated server. So wi will test that very intensive :) I start tomorow, now i am at work :( .


Top
   
PostPosted: Tue May 06, 2008 5:52 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu May 19, 2005 10:19 pm
Posts: 153
Location: Germany
Hi.

I just tried this incredible patch. Although my Windows binary is very slow and CPU cosuming it's fun to see different colored vehicle on the same track or in the same station. But I justed noticed this: The company rating in the town dialog if for the owner of the station and not for the owner of the vehicle that picks up the cargo. Is it possible to apply the ratings to the transporting company or doesn't the rating system allow this? As we all knwo building a statue imcreases station reatings a bit. According to ratings system the station owner has to build the statue to improve his ratings. The transporting companies cannot improve it by themselves, can they?

Kind regards

Zombie


Top
   
PostPosted: Tue May 06, 2008 5:58 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Apr 24, 2004 10:43 am
Posts: 1947
Location: Venezia - Italia
Roujin wrote:
what if nobody wants to buy it then?

Local authority should take them, and put a lot of taxes on their use :twisted:

_________________
ImageImage
ImageImage
ImageImage
newgrf tests, see: newgrf test topic, my patches: Wolf01's Hire Point
Italian TTD Forum
Wiki Page


Top
   
PostPosted: Tue May 06, 2008 6:59 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu May 19, 2005 10:19 pm
Posts: 153
Location: Germany
Hi.

I kept my test game on my linux server running while figuring out why my Windows build was so stressful on the CPU. I recompiled the Windows version with VS2008 Pro. This time as a release and not a debug version which runs a lot smoother. After reconnecting to the game I stumbled over strange company finances. While the company operating the trains is charged with sharing fees, the company providing tracks and stations does not receive these fees. I compiled from revision 12972 with the latest patch from this thread. I attached a screenshot, the savegame and the openttd.cfg of the server.

Kind regards

Zombie


Attachments:
openttd.cfg [7.05 KiB]
Downloaded 148 times
screenshot.png [106 KiB]
Downloaded 669 times
savegame.sav [87.97 KiB]
Downloaded 139 times
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 343 posts ]  Go to page 1 2 3 4 518 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.