[NoGo] Tutorial ("Beginner Tutorial" in bananas)

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

EmperorJon
Engineer
Engineer
Posts: 13
Joined: 10 Mar 2012 15:15

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by EmperorJon »

After a brief read I think the viewing/introl tutorial should talk more about some of the features and what you actually are trying to do.
For example, when showing the "spoiler" of things to come by showing the player different transport going on around the town, tell them that the aim of the game is to move cargo between locations, with the best time and distance making the most money, and specifcally say eg. "This can be accomplished by..." [CONTINUE] "... ships..." screen jumps to port [CONTINUE] "... planes..." etc.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Zuu »

Hello,


Yes, I haven't yet added the latest string updates by Pingaware. Not sure why as it has grown a long time now.

The chapter plan is included in the hg repository and can be viewed here: (I haven't verified that there are no later version posted by someone else in the topic but has not been committed to hg)
http://dev.openttdcoop.org/projects/gs- ... r_plan.txt

When a chapter gets implemented in the Squirrel code, I do not port back changes in the chapter to the plan.
Pingaware wrote:Have you downloaded the scenario? As far as I remember from my last test, you have to load the scenario and then the script will automatically run. Zuu can confirm/deny this best however.
Correct. Regular users, do not even see the script in the list of installed scripts.
EmperorJon wrote:Anyway, I'm interested in helping this along at some point. Not right now, very busy, but in the future I may be able to put in some time, either learning to use gamescript as I go or just writing generic "this is what I think this chapter should say" stuff, providing general feedback, spellchecking, all the simple stuff. :P
Any work from your side to bring the tutorial forward is welcome. You could help with the chapter plans or take a chapter and try to implement it in Squirrel using the step structure that I've created.

Preferable if you know how to use hg, clone the repository and use hg to produce patches. But if you don't know how to do that, chapters are organized so that they are fairly isolated units, so you could also just post the chapter as a whole.
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: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Zuu »

While I like the idea to transport the goods produced by the oil chain, that will require users to always take the ship chapter before trucks. For this reason I propose to use a primary chain for trucks instead. A second option would be that if you choose the truck chapter before the ship chapter you are offered to either cancel or let an AI to complete that chapter. Currently I think that the former solution is better and is also easier (quicker) to implement.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by MinchinWeb »

Zuu wrote:While I like the idea to transport the goods produced by the oil chain, that will require users to always take the ship chapter before trucks. For this reason I propose to use a primary chain for trucks instead. A second option would be that if you choose the truck chapter before the ship chapter you are offered to either cancel or let an AI to complete that chapter. Currently I think that the former solution is better and is also easier (quicker) to implement.
I see your point Zuu. If you want code for an AI to run a ship, I could modify something out of my AI, WmDOT, rather quickly. The other reason I liked using the ship-serviced Oil Refinery is there will always be lots of goods to truck away.
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
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Zuu »

MinchinWeb wrote:
Zuu wrote:While I like the idea to transport the goods produced by the oil chain, that will require users to always take the ship chapter before trucks. For this reason I propose to use a primary chain for trucks instead. A second option would be that if you choose the truck chapter before the ship chapter you are offered to either cancel or let an AI to complete that chapter. Currently I think that the former solution is better and is also easier (quicker) to implement.
I see your point Zuu. If you want code for an AI to run a ship, I could modify something out of my AI, WmDOT, rather quickly. The other reason I liked using the ship-serviced Oil Refinery is there will always be lots of goods to truck away.
If you can adopt code to work with this information that would be welcome:

Code: Select all

/*static*/ function ChapterShips::Init(table)
{
	// Industry index 0
	table.refinery <- 0;

	// Industry index 1 and 2
	table.oilrig1 <- 1;
	table.oilrig2 <- 2;

	// station IDs for the oilrig stations
	table.oilrig1_station <- GSStation.GetStationID(GSIndustry.GetDockLocation(table.oilrig1));
	table.oilrig2_station <- GSStation.GetStationID(GSIndustry.GetDockLocation(table.oilrig2));

	// canal start/end
	table.canal_start_tile <- g_tile_labels.GetTile("CanalStart");
	table.canal_end_tile <- g_tile_labels.GetTile("CanalEnd");
	table.canal_lock1 <- g_tile_labels.GetTile("CanalLock1");
	table.canal_lock2 <- g_tile_labels.GetTile("CanalLock2");
}

A lazier approach would be to hardcode the location of the AI depot/dock using a tile marker. It should work as far as the user haven't raised/lowered land in the area.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by MinchinWeb »

Modified code from my AI is attached. I don't have internet on my main computer at the moment (and probably won't for a couple of weeks), but I thought I would post this (work in progress) if someone wants to try it out in the meantime. I wanted to run it through Zuu's AI->GS converter, but couldn't get that to work either. My MetaLibrary (also attached) is a requirement, but I expect it to work once run through the AI->GS converter.

My MetaLibrary will require both the AyStar and Fibonacci Heap libraries, but both have been converted to GS and are on Bananas.

What it does:
  • Builds a ship to transport oil from the most productive rig to the oil refinery. Will build docks, depots, and buoys as required.
What is doesn't do:
  • Build canals, or otherwise terraform
  • Connect both oil rigs to the refinery
  • Build more than one ship, replace old ships, or otherwise manage ships
Excepted Issues:
  • The pathfinder can take a long time to fail if there is no possible connection; this could be an issue if it tries to connect the oil rigs that needs the canal built first.
In an appropriate place, add the code:

Code: Select all

import("util.MinchinWeb", "MetaLib", 5);
	Array <- MetaLib.Array;
	Atlas <- MetaLib.Atlas;
	Marine <- MetaLib.Marine;
	OpLog <- MetaLib.Log;
import("util.superlib", "SuperLib", 25);		//	For loan management,etc
	SLMoney <- SuperLib.Money;
	Helper <- SuperLib.Helper;
	AIAbstractList <- AIList;

require("OpMoney.nut");
require("Tutorial.OpHibernia.nut");
then call the function ChapterShips::CompleteByAI() as required.
Attachments
Tutorial.OpHibernia.zip
AI code to build ship connections
(48.5 KiB) Downloaded 196 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
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Zuu »

Update - Version 8
  • Updated strings to the last changes by Pingaware
  • Fix: some strings included more {TOWN} than code
  • Feature: Trucks chapter
  • Codechage: Moved some code to common.nut to be shared by all chapters.

The main feature of this update is of course that the Trucks chapter have now been implemented. To get there, I had to solve several problems on down the road. ;-) One was that there was no game script version of the Pathfinder.Road library which is why the road functions previously was unavailable in SuperLib. Other problems have been to correctly detect if a station accept/produce a given cargo for a specific industry/town.

Note that the trucks chapter is supposed to be played after the ships chapter. Its planned that there will be an option to let an AI to complete the ships chapter for you if you want to jump directly to the trucks chapter, but that have not been implemented yet. You can still pick that option and play-test the trucks chapter, but no supply will be provided to the oil refinery.

I have only lightly reviewed the texts from the chapter plan for the trucks chapter and focused on the programming part to get a functional chapter. I hope Pingaware or someone else is interested to have a look at the strings and suggest improvements.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Pingaware
Director
Director
Posts: 625
Joined: 03 May 2007 20:18
Location: England

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Pingaware »

Zuu wrote:I have only lightly reviewed the texts from the chapter plan for the trucks chapter and focused on the programming part to get a functional chapter. I hope Pingaware or someone else is interested to have a look at the strings and suggest improvements.
As ever, I'll be happy to do that for you Zuu. Probably get round to it for you in the next few days. I'd also be interested in hearing anyone else's comments on any of the previous chapters' strings!
User avatar
Pingaware
Director
Director
Posts: 625
Joined: 03 May 2007 20:18
Location: England

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Pingaware »

As promised Zuu, here are my suggested changes to the strings. As usual, there are minor changes throughout and major changes to the new chapter. Additionally, I spotted two other small bugs. The town "Highland Hills" hasn't got the second word capitalised when it should do, and there is a bug in the string STR_TRUCKS_4_6_4_ORDERS. When I went through this part of the tutorial, this string didn't correctly display the station. It came up first as "Undefined/Unknown Station" and then flickered between some of the town names as I moved my cursor around the screen. Couldn't work out what was causing it to change to the different town names.

Edit: Would you object if I asked in the General OpenTTD forum for experienced players to play through the tutorial? I'm interested in hearing other players' opinions on how clear my strings are to understand.
Attachments
english (Pingaware's Changes to Version 8).txt
(27.46 KiB) Downloaded 185 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Zuu »

Pingaware wrote:As promised Zuu, here are my suggested changes to the strings. As usual, there are minor changes throughout and major changes to the new chapter.
Great that you keep taking an active role in taking care over the strings.

Pingaware wrote:The town "Highland Hills" hasn't got the second word capitalised when it should do
I've updated the town name in the scenario file as you have proposed.

Pingaware wrote:, and there is a bug in the string STR_TRUCKS_4_6_4_ORDERS. When I went through this part of the tutorial, this string didn't correctly display the station. It came up first as "Undefined/Unknown Station" and then flickered between some of the town names as I moved my cursor around the screen. Couldn't work out what was causing it to change to the different town names.
The problem was that I didn't pas any parameter to that string in the code. I have fixed that now.


However, when I replace english.txt with your updated english.txt I get the following error which I do not get with the old english.txt from the released version 8. I wonder, do you test the language file before uploading it here? Does it work for you? If you did export it directly from Word, it probably needs to be converted from windows-1252 to UTF8 as it contains some non-ASCII dash characters. (at least when working with data exported from Excel, I know that this conversion is often needed if you need data do be in UTF8)
Unnamed, 30th Jan 1950.png
Unnamed, 30th Jan 1950.png (30.21 KiB) Viewed 10728 times
Pingaware wrote:Edit: Would you object if I asked in the General OpenTTD forum for experienced players to play through the tutorial? I'm interested in hearing other players' opinions on how clear my strings are to understand.
No problem from my side. Getting more people to test and give feedback on the tutorial would be good. But perhaps wait until we resolve the encoding issue and I can release a new playable version containing your string updates.


Edit: Forgot the attachment
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Pingaware
Director
Director
Posts: 625
Joined: 03 May 2007 20:18
Location: England

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Pingaware »

Zuu wrote:Great that you keep taking an active role in taking care over the strings.
No worries! Always a pleasure to help out in some way.
Zuu wrote:However, when I replace english.txt with your updated english.txt I get the following error which I do not get with the old english.txt from the released version 8. I wonder, do you test the language file before uploading it here? Does it work for you? If you did export it directly from Word, it probably needs to be converted from windows-1252 to UTF8 as it contains some non-ASCII dash characters. (at least when working with data exported from Excel, I know that this conversion is often needed if you need data do be in UTF8)
Damn, I thought I'd got all of those characters this time. Oh well. Hopefully this new one is okay.
Attachments
english (Pingaware's Changes to Version 8a).txt
(27.53 KiB) Downloaded 205 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Zuu »

Running your english.txt through (edit: here I'm refering to the first version 8 that you uploaded)

Code: Select all

iconv -f windows-1252 -t utf-8 your-english.txt > english.txt
Indeed fix the probelem. If you have Cygwin or mingw you can do that yourself to test the language changes in game.

In a quick review I see that you have changed

Code: Select all

STR_TRUCKS_4_2_2_BUILD_TRUCK_STATION  :Let's build a Lorry (or truck) station.
to

Code: Select all

STR_TRUCKS_4_2_2_BUILD_TRUCK_STATION  :Select the lorry station using the highlighted button.
However, the script doesn't highlight any button the second time when you build a lorry, because I decided that it was not needed here. If you have a different option and want to highlight the two drive through stops (or all 6 variants?), then please communicate that. If not, the required code changes will not happen until someone detects this error and reports it.

I see however, that this string is used twice, and perhaps you only looked at it first occurrence when indeed two buttons are highlighted. Still, in that case I wouldn't refer to "the" highlighted button as there are two and the user may pick any of them. Maybe I should still split that string into two copies so that you can use different wordings in both cases.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
BlueDeath
Engineer
Engineer
Posts: 53
Joined: 24 Jan 2010 22:16

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by BlueDeath »

Just some points questions about that tut:

- has the first plane anything loaded? My default is not fully load and so the plane would be empty.
STR_AIRPLANES_2_3_5_ORDERS :Click anywhere on the airport in {TOWN}, excluding the hangar. This gives an order to the aircraft to go to this airport, and load any passengers and mail which are currently waiting.

-> Tell about why the first time nothing is loaded? And that changing orders comes in next capter?

STR_SHIPS_3_3_3 :You may have realised that you haven't built a dock by the oil rig. However, you won't have to do this as oil rigs, uniquely in OpenTTD, have their own in-built station.{}{}Click on the highlighted buttons to give orders to your ship to go first to the oil rig ({STATION}), then go to the refinery dock ({STATION}).{}{}Note that you will have to click on the rear tile marked as "Dock Tile" on the oil rig to give the ship the order to go to the oil rig.

-> What about skipping orders after first visit to get the ship loaded a bit next time?
-> What about shared orders

Trucks
-> Cloneing with shared orders?

edit: You could force the user to make an plane goto hanger order to tell the difference instead of a warning when done.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Zuu »

BlueDeath wrote:Just some points questions about that tut:

- has the first plane anything loaded? My default is not fully load and so the plane would be empty.
STR_AIRPLANES_2_3_5_ORDERS :Click anywhere on the airport in {TOWN}, excluding the hangar. This gives an order to the aircraft to go to this airport, and load any passengers and mail which are currently waiting.

-> Tell about why the first time nothing is loaded? And that changing orders comes in next capter?
I've added a note that stations are empty until the first aircraft visits as a new paragraph at the end of the sum up string:
english.txt wrote:STR_AIRPLANES_2_4_1_SUM_UP :Aircraft - Station Window and Vehicle Details Window{}{}You have now completed your first transport route in OpenTTD. Before moving onto the next chapter, you'll be shown how to look at some more detailed information about your route.{}{}To see the number of passengers and the amount of mail waiting at an airport, click anywhere on the airport, excluding the hangar.{}{}Note that before the first aircraft has visited the station, there will be no passengers or mail showing up at the station. Only after the first visit, customers will know about the service and start to use it.
While it could be explained earlier, I don't want to add more details then necessary at the beginning to not make it overwhelming.
BlueDeath wrote:STR_SHIPS_3_3_3 :You may have realised that you haven't built a dock by the oil rig. However, you won't have to do this as oil rigs, uniquely in OpenTTD, have their own in-built station.{}{}Click on the highlighted buttons to give orders to your ship to go first to the oil rig ({STATION}), then go to the refinery dock ({STATION}).{}{}Note that you will have to click on the rear tile marked as "Dock Tile" on the oil rig to give the ship the order to go to the oil rig.

-> What about skipping orders after first visit to get the ship loaded a bit next time?
-> What about shared orders
Skipping orders is possible. Though for the moment the fast-forward option have been chosen.

Shared orders need more than one ship servicing the same oil rig.

BlueDeath wrote:Trucks
-> Cloneing with shared orders?
I prefer to use the simple clone first. Later when we have explained shared orders, the tutorial will suggest that sort of clone.

BlueDeath wrote:edit: You could force the user to make an plane goto hanger order to tell the difference instead of a warning when done.
That is possible, or keep it as is, and cover servicing in detail later. Its all a trade off between how much details to provide in the first chapter or how many chapters there will need to be. My guess is that newbies will probably want to see results quickly before getting too much into details.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
BlueDeath
Engineer
Engineer
Posts: 53
Joined: 24 Jan 2010 22:16

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by BlueDeath »

Zuu wrote:That is possible, or keep it as is, and cover servicing in detail later. Its all a trade off between how much details to provide in the first chapter or how many chapters there will need to be. My guess is that newbies will probably want to see results quickly before getting too much into details.
That sounds right.

I just thought that teaching cloneing with shared orders would be better, since in my opinion that's the better way for doing it. I use the normal clone just for some special cases.

All the rest I would do the same way ;-)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Zuu »

Update - Version 9

I've now uploaded a new version of the tutorial to bananas. It contains the last string updates by Pingaware and some updates to the programming part by me. Also I couldn't hold myself from looking over the strings and make some minor adjustments here and there (hopefully without causing incorrect English :-p). I've also made the adjustments mentioned above thanks to the feedback by BlueDeath.


Edit: This update contains no new chapters, "only" polishing of the existing ones.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Pingaware
Director
Director
Posts: 625
Joined: 03 May 2007 20:18
Location: England

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Pingaware »

Now I've been taught how to check my strings before submitting them (thanks Zuu!), I'll just give them a quick check, then make any suggestions I think of.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by MinchinWeb »

Good news! I (think) I have a working version of the Ship Builder. However, the functions for a GameScript to give orders to a vehicle have yet to be implemented. (Is this something easy for you to fix Zuu?) The ship building takes about a month to complete. If you want to review the code, it's up on GitHub.
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
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by krinn »

MinchinWeb wrote:the functions for a GameScript to give orders to a vehicle have yet to be implemented. (Is this something easy for you to fix Zuu?) The ship building takes about a month to complete. If you want to review the code, it's up on GitHub.
You could trigger the AI to do it for the GS itself when trigger by a sign. For pre-define/simple task it could be done in few lines.

I don't know what you wish to do: if it's only "turn your order to FULLLOAD"... it is really easy.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Zuu »

krinn wrote:
MinchinWeb wrote:the functions for a GameScript to give orders to a vehicle have yet to be implemented. (Is this something easy for you to fix Zuu?) The ship building takes about a month to complete. If you want to review the code, it's up on GitHub.
You could trigger the AI to do it for the GS itself when trigger by a sign. For pre-define/simple task it could be done in few lines.

I don't know what you wish to do: if it's only "turn your order to FULLLOAD"... it is really easy.
He, exactly what I was thinking. In addition to the scenario and the GS, there could also be an AI that just sit and wait for the trigger to build this connection. The implementation of this trigger shouldn't be much of a problem. The biggest issue that I see with this is that it raise the number of packages to select for download from 2 to 3.

Currently the dependencies in the bananas manager doesn't allow the dependencies needed by the Tutorial. So they have to be set manually for each upload by someone fiddling with the dB. Last uploads don't have them set at all (because I didn't send an email asking for it). If I grow the number of dependencies, it would be good to come up with a script that can set these dependencies in the dB without having someone to manually fiddle with the dB for each upload.

Another path is to allow GS to set orders, but that open up for fleet management scripts. Eg. scripts that play the game for you. Something that GS was not meant to allow.

So the path to take is not clear yet.
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 8 guests