[GS] NoCarGoal

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

[GS] NoCarGoal

Post by Zuu »

Goal: Transport X units of cargo A, B and C before year YYYY.

GOLD - accomplish the goal for all cargoes
SILVER - accomplish the goal for two cargoes
BRONZE - accomplish the goal for one cargo


Game Script parameters:
- Years to play (default: 100)
- number of units to transport (default: 100 000)

Requires:
- SuperLib (v25)
- Nightly version of OpenTTD (or 1.3 when it is released)


Edit: note that a nightly is needed.
Attachments
NoCarGoal-v1.tar
(30 KiB) Downloaded 496 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [GS] NoCarGoal

Post by Zuu »

Todo:
  • Remove correct goal when a goal is reached
  • Add a news message when a goal is reached
Anything more?
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: [GS] NoCarGoal

Post by Yexo »

Zuu wrote:Anything more?
More test games, it was fun :)
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: [GS] NoCarGoal

Post by Alberth »

Suggestions:
Perhaps a progress news twice a year?
Sequence of goals?
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: [GS] NoCarGoal

Post by Yexo »

Hmm, not possible with the current API, but perhaps update the goal text with the progress? Like "25k ton of cargo to transport, (2043t coal done, 0t wood done, 49203t oil done)"?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [GS] NoCarGoal

Post by planetmaker »

Quite a nice game script.

We played jointly with 5 people in one company. We were asked on an arctic map with medium water and not too many hills to deliver overall 25k gold, oil and wood, starting in 1950 (default trains, heqs, fish, default industries). (bronze: one cargo met, silver: two cargos met, gold: all cargos met)

In January 1955 we had enough wood, 2/3 of the gold and only 6000 oil. It kept us busy also the whole of 1955. But we won by January 1956, having met our goal of 25k transported each.

Now, that was a nice challenge. Kept us busy, at an edge. Not much time for slacking off and watching trains. Or beautifying crossings or stations

Suggestions for improvements:
- Create News event when a single goal is reached
- like Alberth, twice a year might be nice (configurable, not needed for long-term goals)

Suggestions for changes / different goals:
- Sequence of cargos to reach the goal
- deliver Xt to each recipient on the map.
- attribute points for early goal fulfillment; Maybe (goaldate-goal)^3 or so - allows to continue past set year, but you'll get negative points, if not fulfilled in time ;-) Sum up points for different cargos for total score.
- require certain transport mode or several or different (needs care; not each cargo and mode makes sense)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [GS] NoCarGoal

Post by Zuu »

Yexo wrote:Hmm, not possible with the current API, but perhaps update the goal text with the progress? Like "25k ton of cargo to transport, (2043t coal done, 0t wood done, 49203t oil done)"?
It is actually possible. Remove the goal and add a new to update it. The reason for not doing it is however that showing the same progress text for all goals would look a bit strange. Also the length of the goal strings are already very long.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: [GS] NoCarGoal

Post by Alberth »

You cannot reach silver before reaching bronze, and you cannot reach gold before reaching silver. Imho that means it is a sequence of goals instead of 3 (independent) goals.
As such, it is quite defensible to only show the first reachable goal.

Perhaps the goal window needs to be extended towards a title + collapsible explanation, where the latter gets automagically wrapped at window border?
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [GS] NoCarGoal

Post by Zuu »

Small update (will address other comments later):

- Fix goal removal bug (hopefully)
- Show progress news monthly instead


Uploaded to bananas
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [GS] NoCarGoal

Post by planetmaker »

I wrote a small blog article about our experience: http://blog.openttdcoop.org/2012/08/24/ ... nocargoal/
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: [GS] NoCarGoal

Post by 3iff »

Nightly 24495.

While doing a quick tryout of this (looks fascinating!), I had a small train deliver 3 cars-worth of steel (20 tons per wagon) and was credited with delivering 120 tons.

Thought you might like to know. See middle line in history. (edit) Best to show the right train.
Old Tillybrook Transport, 8th Sep 1951#2.png
Old Tillybrook Transport, 8th Sep 1951#2.png (34.45 KiB) Viewed 16468 times

Ha! Just delivered 150 tons of copper and got credited with 300 tons!
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: [GS] NoCarGoal

Post by 3iff »

Wonder if this is the cause. The goalscript has the goals set twice. Is this right?
Old Tillybrook Transport, 24th Nov 1951.png
Old Tillybrook Transport, 24th Nov 1951.png (38.7 KiB) Viewed 16465 times
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: [GS] NoCarGoal

Post by Alberth »

I am missing a time notion in the news items, a percentage of delivered cargo and a percentage of time remaining could be useful.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [GS] NoCarGoal

Post by Zuu »

Alberth wrote:I am missing a time notion in the news items, a percentage of delivered cargo and a percentage of time remaining could be useful.
In the top right corner of most news items, the date is included as standard behaviour. So I don't think it is necessary to include that in the news text.

If I figure out how to use the {CARGO} thingy instead of "{NUM} units", I will need to display the goal target for each cargo type and in that case I will re-work the news to include the target in some way.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: [GS] NoCarGoal

Post by Alberth »

The target is there as you can see below
example_goal.png
example_goal.png (3.01 KiB) Viewed 16315 times
I would like to have a time/percentage indication, perhaps like

Code: Select all

Oil: 40050 units transported (133%)
Wood: 44280 units transported (147%)
Manufacturing supplies: 16682 units transported (55%)
out of target: 30000 (57% of the time has passed)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [GS] NoCarGoal

Post by Zuu »

In r24497 I see this in the news: (note date in top right corner)
news_nocargoal_r24497.png
news_nocargoal_r24497.png (5.74 KiB) Viewed 16291 times
The other issue that I tried to hint at is that it is not so user friendly to print cargo amounts in the internal units as the script does at the moment. Because for some cargoes one internal unit doesn't equal one tonne/litre etc.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: [GS] NoCarGoal

Post by planetmaker »

What about the remaining time or the date / year the goal must have been reached?
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [GS] NoCarGoal

Post by Zuu »

3iff wrote:Nightly 24495.

While doing a quick tryout of this (looks fascinating!), I had a small train deliver 3 cars-worth of steel (20 tons per wagon) and was credited with delivering 120 tons.

Thought you might like to know.
Thanks for the report!

The reason of this behaviour is that I just monitor all towns and industries for cargo delivery. It appears that both the power plant and the town where the powerplant is located registers the cargo delivery.

I guess the easiest solution is to just monitor towns for cargo delivery as I guess if they register coal delivery, they will register any cargo.



Edit: As you may guess, a consequence is that currently goals for cargoes that deliver to industries are easier to accomplish than passengers which I suppose do not show this behaviour.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 6 guests