Branch: Subsidies are now contracts

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

SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

Branch: Subsidies are now contracts

Post by SirOzlington »

Hey guys,

I'm working on a little branch for OpenTTD with the target to make the game more challenging and fun to play together online.

As a first step, I mingled around with subsidies and made them to be contracts. You will not get any money for any transportation what so ever unless you have a transport contract with the corresponding companies. They are offered monthly, and are like this:

5000t coal from XY coal mine to YZ power plant, first delivery by August 1980.

If you shift click on it, a dialog opens: "Accept contract?", it tells you more details:
Length of contract (48 month atm)
Total cargo
Locations
Contract Reward (if you complete the contract in time)
Contract Penalty (if you're too slow, or if you fail to make the first delivery).

If you accept you are granted the contract and can start building your network and transporting the goods (target is 60% of monthly production at the month of the contract offering).

--- Why?
This mod makes you rethink your building strategy. After 4 years, all your trains on that line will be useless, and the whole line might be in vain if you don't find other use for it. So you need to change the wagons on the train, and build some advances to your line to make best use of your investments. If you're doing everything smart enough, you'll be very successful.

--- Future
I have a lot more thing in mind, but this is how far I got so far. I'm currently testing it and if there's interest for it, I can post the patch as well.

Cheers,
SirOzlington


Screenshots:
Attachments
Screenshot
Screenshot
subsidies.png (74.2 KiB) Viewed 469 times
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Branch: Subsidies are now contracts

Post by Alberth »

It sounds like a very nice NoGo goal script. Not sure whether it can do everything what you want though.
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

Re: Branch: Subsidies are now contracts

Post by SirOzlington »

I'm not really familiar, but from the little I read it seemed to be a no-go.
icbear
Engineer
Engineer
Posts: 7
Joined: 22 Oct 2006 10:35
Location: Dunedin , New Zealand

Re: Branch: Subsidies are now contracts

Post by icbear »

SirOzlington wrote:Hey guys,
If you accept you are granted the contract and can start building your network and transporting the goods (target is 60% of monthly production at the month of the contract offering).
--- Why?
This mod makes you rethink your building strategy. After 4 years, all your trains on that line will be useless, and the whole line might be in vain if you don't find other use for it. So you need to change the wagons on the train, and build some advances to your line to make best use of your investments. If you're doing everything smart enough, you'll be very successful.
--- Future
I have a lot more thing in mind, but this is how far I got so far. I'm currently testing it and if there's interest for it, I can post the patch as well.
Cheers,
SirOzlington
I really like the sound of this as it will give a true incentive to be rational with networks
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

Re: Branch: Subsidies are now contracts

Post by SirOzlington »

Here's an example binary & language file for windows.
Last edited by planetmaker on 04 Feb 2012 07:50, edited 1 time in total.
Reason: please only publish full bundles and also publish patches, if you publish binaries
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Branch: Subsidies are now contracts

Post by planetmaker »

Please obey OpenTTD's license:

- provide the full bundle including license and credit information. See http://wiki.openttd.org/Microsoft_Visua ... ons#Bundle
- provide the source; i.e. at least publish the patch you used as soon as you publish binaries.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Branch: Subsidies are now contracts

Post by Zuu »

Alberth wrote:It sounds like a very nice NoGo goal script. Not sure whether it can do everything what you want though.
I think his framework could make sense as an addition to the goal framework if it is made customizable through a NoGo script. Eg NoGo can create contract offers using an API call.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Branch: Subsidies are now contracts

Post by frosch »

NoGo can already do contract-like stuff via "goals" and "questions".
But NoGo cannot check what cargo you deliver from where :)
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Branch: Subsidies are now contracts

Post by Terkhen »

Existing subsidies are constrained by the generator, but you could create subsidies over larger distances, with different time periods and so on with almost no changes to the existing subsidy code. IMO the best way to go is to give NoGo the ability to create subsidies (and probably disable the default subsidy generator), and to add events to NoGo such as "company M managed to get subsidy N" or "received subsidized cargo for subsidy N". NoGo would also need a way to modify what text is displayed in the subsidy window. Maybe NoGo already does some of these things, I still have to check what it can do :)
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

Re: Branch: Subsidies are now contracts

Post by SirOzlington »

Sorry about before, here's the whole bundle + patch. Note that I also patched in a few other patches: polyline building, conditional load and signals on tunnel/bridge

i hope the bundle is fine this time

also note please, that this version is not savegame compatible and has bugs etc. it's just a demo of the current point i'm at

EDIT: Updated
Attachments
bundle.zip
bundle feb5a
(5.62 MiB) Downloaded 115 times
contracts.patch
patch feb5a
(60.66 KiB) Downloaded 143 times
Last edited by SirOzlington on 05 Feb 2012 04:31, edited 1 time in total.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: Branch: Subsidies are now contracts

Post by MinchinWeb »

I thought you have a neat idea, so I decided to give it a try. However, the game won't award me the subsidies, so I don't make any money :( The cargo is delivered fine, but I don't get paid. I've attached two savegames of the same game but at different points in time to illustrate my problem. I'm using the Windows executable you have posted just above.

A couple of other thoughts:
  • Playing the game the way you have it set up, I don't think you'll ever get any secondary industry production (and subsidies are based indirectly on production, right?). Perhaps the answer is to provide contracts for secondary industries, even if there isn't current production, or to have secondary industries produce even if they don't receive feedstock (the original Transport Tycoon used to work like this, maybe this should be done with a NewGRF...)
  • The amount of time a subsidy is available to claim (a year?) seems rather short. On short routes, it's probably not to much of an issue, but maybe the availability period should probably scale with distance. For a minimum amount of time, consider how long it would take for a ship to make the trip.
Attachments
Brown & Co., 31st Aug 2051 (not awarded).sav
(74.24 KiB) Downloaded 100 times
Brown & Co., 15th Apr 2051 (not awarded).sav
(72.16 KiB) Downloaded 94 times
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

Re: Branch: Subsidies are now contracts

Post by SirOzlington »

They aren't supposed to be awarded, you need to accept them by shift+clicking on them.

On feeder industries: my plan is to later give out contract smartly, for example if you feed a factory with livestock etc. the factory will offer a contract to deliver this somewhere else directly, and give your company a better deal than the others. But at the moment, yes, subsidies are rather random.

On amount of time: I changed the amount of time to 6 month per 100 tiles distance. So far this has shown to be a bit to much even.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: Branch: Subsidies are now contracts

Post by MinchinWeb »

SirOzlington wrote:They aren't supposed to be awarded, you need to accept them by shift+clicking on them.
Ok! :D Now I make money!
SirOzlington wrote:On amount of time: I changed the amount of time to 6 month per 100 tiles distance. So far this has shown to be a bit to much even.
This seems like a good way to go.

I started playing again, however, it doesn't award me the contract for food from the Food Processing Plant to a town. Savegame attached.

With the display of awarded contracts, it isn't consistent with the units on liquids (ex: 4,343 of 4,560,000 liters) and you only give enough space for single digit days of the month.
Attachments
Brown on Contract, 4th Nov 2052 (not food awarded).sav
(79.27 KiB) Downloaded 108 times
Brown & Co., 7th Aug 2051.png
Brown & Co., 7th Aug 2051.png (33.76 KiB) Viewed 7173 times
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Branch: Subsidies are now contracts

Post by supermop »

Very fun so far!

I am having a similar problem. I had no trouble with the contract from a farm to a factory, and accepted a contract to take goods from that factory into a nearby town. However, delivering goods to the town nets no profit, and the subsidy window shows no progress towards the contract completed. In the attached savegame, train 2 has delivered two full loads to Savonmetsa, which accepts goods.

Thanks,


Edit:

Also, how are passengers handled? I have yet to see a passenger contract on offer, although I wouldn't mind if passengers were handled normally/differently. I have gone ahead and built stations in towns that my freight line passes through while they still like me, just in case I need to run a passenger service over the line in the future.
Attachments
Hiekkasalo Transport, 1st Mar 1953.sav
(230.58 KiB) Downloaded 103 times
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: Branch: Subsidies are now contracts

Post by MinchinWeb »

supermop wrote:Also, how are passengers handled?
Ditto for mail...
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

Re: Branch: Subsidies are now contracts

Post by SirOzlington »

Subsidies to/from towns do not work yet, simply not coded, which is also why there are no passenger/mail subsidies so far. It didn't seem to make too much sense to me either to make contracts for pax/mail. From industry to town will be possible in a future release tho.

The glitch with the month is fixed and I also added a function that prevents loading from companies that aren't in an active subsidy for your company (prevents your train from filling partly from other producing industry with useless cargo)
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Branch: Subsidies are now contracts

Post by supermop »

At least for now, I would suggest having passengers, and possibly other town cargoes operate as in standard ottd. You might want to disable these subsidies as in my first game I ended up bankrupt after agreeing to such a contract.

Some other thoughts after a couple games:

I have had at least one contract fail because the industry simply did not produce enough over the course of the four years to fulfill the contract. I understand there shoul be an incentive to grow production, but it is not always feasible for a new company to keep up a 100% rating on a brand new route. Also, some industries, like standard temperate oil wells will never grow, and will likely decrease production over the contract. I would suggest the contract amount be something like (this month's production)*(number of months in contract)*0.7 or so. This would allow players to complete on time even if they have good but not great service, and if they grow production, they can manage to finish sooner.

Along those lines, maybe more thought should go into what to do at the end of the contract. Is it better to let the player continue for the remaining time paying out the subsidized (or maybe standard) rate? Should the contract be offered for renewal? If not, then some maps may have their whole supply chains for some industries broken quite regularly. Currently their is little benefit to finishing early (maybe this is intended), as your infrastructure and vehicles become obsolete that much sooner.

Perhaps their should be varying difficulties of contract - maybe with a more demanding contract offered as a follow up upon successful completion. In addition to the existing time handicap for remote industries, maybe those contracts should also last longer on some scale. More difficult settings could perhaps have contractual monthly amounts, instead of or in addition to the four year total. (4800 crates over 48 months, with no fewer than 50 crates in a given month).

This could be fun in multiplayer - imagine UK style rail franchises - but currently I am not sure how well this is suited for that. One problem is that the first player to complete a contract will always be in a better situation to fulfill that contract the next time it is offered than any other player, as he likely has at least some infrastructure still in place, and possibly idle vehicles ready to use. Infrastructure sharing alleviates this to a degree, but still relies on the established player deciding not to pursue the contract and let someone else go after it. One way would be to have multiple contracts in place for large cities or high output industries, so that a smaller company could still get established. Any given contract would then never be for 100% of output, so as to allow room for new contracts to other players or destinations. Another option would be for some amount of cargo to be handled normally, outside of contract.

You might want to change the text from 'first train by' to 'first shipment by', unless you only want to subsidize trains. Along those lines, it could be fun to have vehicle specific subsidies - especially for passengers. this way a town could give out different contracts for bus and train service. A large or very remote town might request an airport connection.

I think it is an oversight to omit passengers, as it would be interesting to convert your disused freight lines to passenger service where appropriate. Contract-only passenger service might be difficult though. There would need to be some mechanism for distributing passengers based on which contracts a town has awarded, but cargodist and yacd miight not make sense.

It might be interesting to award contracts base on providing capacity rather than actual items moved, especially in the case of passengers.

Best,
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

Re: Branch: Subsidies are now contracts

Post by SirOzlington »

Subsidies to towns should work now (cargo only, no mail/pax)

@other thoughts: a lot is planned, this obviously is not a finished patch yet

in detail:
atm it's 60% of the production in the month before the contract offer, so pretty close to ur suggestion

finishing a contract early allows you to get more money by continuing to transport more than in the contract (all is standard rate)

the difficulty, how and to whom they're offered, which routes etc. will all be determined by some kind of AI instead of like now by pure chance later on

passengers in general are suboptimal for this frame of reference. I want to solve it without contracts on the side like this:
every town creates randomly proportional to its size passengers that want to go to other cities proportional to the other cities size and their distance.
they will then buy tickets just like in real life, combining routes via transfer as well. I'm not 100% sure how far this is possible but I think it should be somewhat doable.

The faster your connection is, the more people will use it, but with relation to money. Optimally you can then set your ticket prices and control whether people use your or your competitors service, and by that there would finally be some direct competitive aspect to openttd. (for multiplayer)
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Branch: Subsidies are now contracts

Post by supermop »

I would be wary of tackling too much, or trying to make passenger contracts too complicated. Both YACD and Cargodist have been working on a lot of those problems for awhile. I think it would be great to see parameters, or advanced settings to control how each type of cargo is handled, or to what degree contracts are involved. Competing on price may or may not be a good idea. While airlines and long distance trains might do this, commuter rail is often government subsidized as service - that is the town would be paying you to provide commuter service within the town and its neighbors, regardless of fare revenue. You would probably want a way to create demand both for long distance, fare based services, and short distance contract based services.
corps
Engineer
Engineer
Posts: 30
Joined: 27 Oct 2007 21:10

Re: Branch: Subsidies are now contracts

Post by corps »

Sorry to bring this topic from the past.

Is this really dead? I think this idea is amazing!
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 6 guests