Revival of subsidiaries patch

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

chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Revival of subsidiaries patch

Post by chrissicom »

Maybe it would be possible to add most of this patch in seperate files and then maybe only use some inline functions in the original code. That would not be very intrusive but could still at a lot of functionality. Also disabling any functionality added with the patch options shouldn't be a problem. I realized though that the original version is too outdated and I wouldn't be able myself to just take the old code and revamp it for current trunk.
Moriarty
Tycoon
Tycoon
Posts: 1395
Joined: 12 Jun 2004 00:37
Location: United Kingdom of Great Britain and Northern Ireland
Contact:

Re: Revival of subsidiaries patch

Post by Moriarty »

As I read it, the arguement is that the code is too scattered around. That's fairly valid IMHO, as it makes things a nightmare to maintain (I've had a few such projects ;) ).
Maybe if the code was narrowed in scope so that it'd need to be "injected" (placed) in less places in the trunk. That might help things.
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Re:

Post by belugas »

LordOfThePigs wrote:If the intrusive comment was referring to the code, my answer would be: Yes it was, but if you don't want people to play around with your code, don't make it GPL in the first place...
I was merely answering as much as I can to the question of its no-inclusion in trunk.
Bare i mind that it's not because trunk is GPL that it means it must accept the work of each individual who offers a new patch. Somehow, we have to maintain every patch that eventually goes into trunk. So, i think we have the right to accept or refuse one patch, for whatever the reason we do feel.
I do not say that Subsidiary patch should or not go in, just what I think about the general acceptance stuff.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
LordOfThePigs
Route Supervisor
Route Supervisor
Posts: 435
Joined: 01 Jul 2004 10:28
Location: Jura/Switzerland

Re: Revival of subsidiaries patch

Post by LordOfThePigs »

Moriarty wrote:As I read it, the arguement is that the code is too scattered around. That's fairly valid IMHO, as it makes things a nightmare to maintain (I've had a few such projects ;) ).
Maybe if the code was narrowed in scope so that it'd need to be "injected" (placed) in less places in the trunk. That might help things.
It is scattered around a lot, but think of all the things that need to be modified: Pathfinding (on 3 different pathfinders), Various GUI elements (for 4 different type of vehicles), Profit calculation, Network code, Building, Destruction etc...

So yeah, the code was scattered, but only because it HAD to be. It's not possible to modify the pathfinders by putting all your code in one file exclusively, and the same holds true for most of the elements I mentioned. The code was scattered because each of the elements that needed to be modified were scattered themselves.

@Belugas: Reading your reply it seems I was a bit harsh in my previous post, so I'm sorry. I totally understand the constraints of merging patches to trunk, and I actually got some comments from Bjarni and Celestar (IIRC) on my code and corrected it. Apparently the real reason was that it was too big, and nobody would bother reading through all of it (it was more than 3000 lines of diff)...
Sometimes I'm told "Brilliant"...
Sometimes I'm told "Charming"...
And Often I'm told "Shut Up"!
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Re: Revival of subsidiaries patch

Post by CobraA1 »

A lot has changed in the trunk (C++, map accessors, YAPF, plenty of other things I'm forgetting...)
Before they moved to C++?

Yeah, it would definitely need to be re-implemented then. I had to rewrite my patch for that reason alone.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
Vikthor
Engineer
Engineer
Posts: 69
Joined: 13 Jun 2004 16:57
Location: Prague, Czech republic

Post by Vikthor »

I am not much of a coder, but when chrissicom posted his partial upgrade a I gave it a go and tried to finish it. All I can say is that for me it compiles, links, runs and more or less works.
Some of the changes that I have made will be probably classified as hacks and they probably are in fact ARE hacks, anyway there they are:
  1. Company and player names are now referenced by index in SetParamD, so I changed the strings accordingly.
  2. Changed commands type from int32 to CommanCost.
  3. Changed retyped few variables to Money.
  4. Changed Subsidiaries button in Player window widget type from WWT_TEXTBTN to WWT_PUSHTXTBTN and made it open subsidiaries management window(Don't know why it was missing)
  5. Made player icons position in status bar relative to its widget position.
  6. Changed other players finances window description to player finances window description
There remains quite a few issues with the patch, these are some that I noticed:
  1. For some reason when old AI builds stations, tracks and buys trains it does not launch them from depot. (Maybe it is not such an issue, as old AI builds the tracks with 90˚ turns anyway and will be replaced ).
  2. When you create subsidiary, send her some cash, then merge her back you will end up with more money than you had before.
  3. Although there is patch setting for track sharing tax, it does not work(I could not find the code for taxation in chrissicoms diff nor in LordOfThePigs original patch for r7213 :? )
  4. The coding style is not OK.
  5. It's completely untested in multiplayer.
  6. Some parts of my upgrade are hacks.
  7. Some parts of my upgrade are hacks. ( "I know that, technically, that's only one issue, but it was such a big one I thought I'd mention it twice " :D
I hope that it will be useful to somebody else, at least as a reference when implementing it from scratch.
Here you are

EDIT: I have tried to separate the tracksharing part of the patch, but I have run into a design issues - like who should be able to start/stop the train or even make it ignore signal - owner of the track or train. The obvious solution would be that both of them must agree, but that involves new GUI windows. Is there somebody who thought about that and came to some outcome? If so, please share your ideas.

Other problems arise when thinking about tracksharing tax - My idea is to make the train each time it enters new tile save its current weight to array <pseudocode>uint32 tontiles[MAX_PLAYERS]</pseudocode> and each month, day, or x ticks(dont know what will be better) compute the tax based on tontiles travelled, increase the running cost and give tax to track owner. Any comments?
Attachments
subsidiaries_r10821.diff
(112.34 KiB) Downloaded 269 times
trackshare_r10876.diff
Tracksharing part of the subsdiaries patch
(17.55 KiB) Downloaded 192 times
User avatar
Kosov_1986
Traffic Manager
Traffic Manager
Posts: 248
Joined: 01 May 2006 14:37
Location: Pecs, Hungary
Contact:

Re: Revival of subsidiaries patch

Post by Kosov_1986 »

Grolsch wrote:Subsidiaries is one of the two patches I would REALLY like to see in trunk/stable.... Other one is PBS :wink:

I wish I could programme, so I could help this patch get into trunk. However, I can't, so I wish the people who can and try, the best of luck!

absolutely same here! this is why i was sad about the cancelling of the MiniIN, and why i'm happy that ChrisIN appeared!
Kosov from the depths of East Europe!


My English isn't good but i never use translating programs :D

I had a Chinese gf, for 3 days, now she's in Germany because she studies there... she was my first serious gf.

Minibus topic, (Renault-Ikarus 546 released by wyctor) http://www.tt-forums.net/viewtopic.php?t=25662

Ikarus buses from all around the world! http://www.tt-forums.net/viewtopic.php?t=26985
xmart2k
Engineer
Engineer
Posts: 91
Joined: 04 May 2006 07:36
Contact:

Re: Revival of subsidiaries patch

Post by xmart2k »

yeah but as you can see, the topic is dead again :(
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Revival of subsidiaries patch

Post by chrissicom »

The topic might be dead but only because nothing new has been produced yet :) I am looking at Vikthor's good work and what I am trying to do is to seperate the patches into smaller parts. What I think is most interesting is the track sharing which could clean up an 8 player game a lot :))
Last edited by chrissicom on 28 Aug 2007 10:39, edited 1 time in total.
Grolsch
Transport Coordinator
Transport Coordinator
Posts: 283
Joined: 08 May 2004 07:48
Location: Alkmaar, The Netherlands

Re: Revival of subsidiaries patch

Post by Grolsch »

chrissicom wrote:The topic might be dead but only because nothing new has been produced yet :) I am looking at Vikthor good work and what I am trying to do is to seperate the patches into smaller parts. What I think is most interesting is the track sharing which could clean up an 8 player game a lot :))
Second that!
Beer equals power
xmart2k
Engineer
Engineer
Posts: 91
Joined: 04 May 2006 07:36
Contact:

Re: Revival of subsidiaries patch

Post by xmart2k »

one thing that i liked a lot in mini, with the subsidiaries patch, was that i could make companies that has only trains, or only trucks, al subordinated to the mother company
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Revival of subsidiaries patch

Post by chrissicom »

xmart2k wrote:one thing that i liked a lot in mini, with the subsidiaries patch, was that i could make companies that has only trains, or only trucks, al subordinated to the mother company
I also liked this idea and it was one of the reason I brought this topic up after all. But afaik there were lots of exploits due to the possibility of multiple companies. For example you could create a new company to demolish buildings in a city where your main company has an appaling rating which is really not nice for multiplayer. So such problems would need to be solved in a nice way first.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Revival of subsidiaries patch

Post by DaleStan »

That's easy. In MP, you can't spawn subsidiaries. You can only buy out existing companies. It has been this way for ages.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Vikthor
Engineer
Engineer
Posts: 69
Joined: 13 Jun 2004 16:57
Location: Prague, Czech republic

Re: Revival of subsidiaries patch

Post by Vikthor »

chrissicom wrote:I am looking at Vikthor's good work and what I am trying to do is to seperate the patches into smaller parts.
I am glad to hear that somebody is working to it. I was actually trying to separate it myself, but RL got in the way and I won`t have time for coding until mid of September. I am looking forward to your patches :D
xmart2k
Engineer
Engineer
Posts: 91
Joined: 04 May 2006 07:36
Contact:

Re: Revival of subsidiaries patch

Post by xmart2k »

any progress in this?
gagarin
Engineer
Engineer
Posts: 57
Joined: 26 Feb 2006 18:52
Location: Berlin, Germany

Re: Revival of subsidiaries patch

Post by gagarin »

Hi

I started a rewrite of the subsidiaries patch.

things that work:
1. share stations, depots, tracks, road stops, docks
2. enable/disable sharing
3. english(UK) and german language

things that don't work:
1. taxes for using other players tracks...
2. buildung junctions on other players tracks
3. disable sharing, for example tracks, when a train is on it, that wil cause an assertion error
4. having subsidiaries
5. all other languages

I think there are two possibilities for expanding this patch, I'm not yet sure, which I do want:
1. rebuild old subsidiaries behavior
2. allow contracts between two players about sharing each others infrastructre with the possibility to set taxes for each contract in game

What do you think?

The patch is made against r11158 and works with MS VS 8 and all Systems, that use configure/make
Attachments
shared_r11158.diff
(20.24 KiB) Downloaded 175 times
User avatar
sickie
Engineer
Engineer
Posts: 85
Joined: 15 Sep 2007 00:51
Location: Slovenia
Contact:

Re: Revival of subsidiaries patch

Post by sickie »

Great! I really loved this patch in MiniIN.
I think there are two possibilities for expanding this patch, I'm not yet sure, which I do want:
1. rebuild old subsidiaries behavior
2. allow contracts between two players about sharing each others infrastructre with the possibility to set taxes for each contract in game
I vote for second option; but how would one do this with his subsidiary (under his control) instead of another player?
gagarin
Engineer
Engineer
Posts: 57
Joined: 26 Feb 2006 18:52
Location: Berlin, Germany

Re: Revival of subsidiaries patch

Post by gagarin »

I vote for second option; but how would one do this with his subsidiary (under his control) instead of another player?
I would prefere to split it.

In my oppinion you don't need subsidiaries in multiplayer when you can have contracts.
In singleplayer it's the other way around. With whom would you create contracts in singleplayer? But you can make sepereate companies foer busses, trains ... in singleplayer.

So my solution would be, to make a contracts patch for multiplayer games and a simplified subsidiaries patch for singleplayer games.

I think I will set up a subversion repository on my server for both patches.
I there is anyone who would like to help me, I will grant access.
Vikthor
Engineer
Engineer
Posts: 69
Joined: 13 Jun 2004 16:57
Location: Prague, Czech republic

Re: Revival of subsidiaries patch

Post by Vikthor »

Gagarin, as I have just today finished my exams, I took a look into your patch and I can not see big differences between your patch and updated patch of LordOfThePigs( apart from extra patch setting for each transport system). Would not be easier to use the original patch as base and continue from there? Or did I missed some major design flaw in original patch or maybe something else?
T-Unit
Transport Coordinator
Transport Coordinator
Posts: 368
Joined: 03 Feb 2007 18:53
Location: Leeds, England

Re: Revival of subsidiaries patch

Post by T-Unit »

gagarin wrote: I would prefere to split it.

In my oppinion you don't need subsidiaries in multiplayer when you can have contracts.
In singleplayer it's the other way around. With whom would you create contracts in singleplayer? But you can make sepereate companies foer busses, trains ... in singleplayer.

So my solution would be, to make a contracts patch for multiplayer games and a simplified subsidiaries patch for singleplayer games.

I think I will set up a subversion repository on my server for both patches.
I there is anyone who would like to help me, I will grant access.
I agree with this. Also having it as two, smaller, simpler patches increases its chance of getting into trunk (though this is sometime ahead).
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 13 guests