[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

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 »

fernando83 wrote:Thanks Zuu,

problem solved as I download notepad++ and use it to edit the file!
Good. I'm looking forward to include your translation when you are satisfied with the translation. Of course you are the only one to judge when that is. And I know very well that there are *lots* of strings to translate to make a complete translation of the tutorial.

Additionally, it would have use for a webtranslator to track changes of english.txt and inform translators about that. For the better, I know also NewGRF authors wish for a such thing to manage translations, so the chance that someone eventually make something is quite high. That being said, it may take time before a such thing is in place as it is all based on the fact that someone needs it enough to do the work.
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 »

Update - Version 12

Changes
  • Add: Navigation chapter (Covers: moving and zooming of main viewport, show map window and the existence of menus behind some main toolbar buttons)
  • Add: Bus chapter (based on chapter_plan.txt in the repository)
  • Update: I've included information about shared orders and clones in the truck chapter.
With this release, "only" trains are missing before all planned chapters are completed.
Attachments
english.txt
English strings of version 12
(35.97 KiB) Downloaded 172 times
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 »

Long time since I've updated the strings for this, but I'll go through them at some point soon (hopefully tonight) and post them on here for you Zuu (after checking, obviously!).

EDIT: Although, before I do that, here's an error I got. Clean install of OpenTTD r25130, only downloaded exactly what the dependencies for the tutorial were highlighted as on Bananas. This appeared immediately on loading the scenario.
Error
Error
Unnamed, 11th Feb 1950.png (45.83 KiB) Viewed 8712 times
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 »

This is the missing library (see attached). Put it in your ./OpenTTD/ai/library folder
MinchinWebs_MetaLibrary-5.1.tar
MinchinWeb's MetaLibrary v5
(190 KiB) Downloaded 160 times
Zuu: I released v6 of the library at Christmas time. I'm not aware of any issues in upgrading. It's the TutorialAI that has the dependancy.
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 »

Thanks for catching this.

The Ship AI wasn't changed other than its version. I only updated its version because I need to release a new version of it when the other banana packages are updated. Otherwise, it will create some mess by the cyclic dependencies that I use for Beginner Tutorial.

When Beginner Tutorial 13 is released, I will correct this.
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 »

MinchinWeb wrote:This is the missing library (see attached). Put it in your ./OpenTTD/ai/library folder
MinchinWebs_MetaLibrary-5.1.tar
Zuu: I released v6 of the library at Christmas time. I'm not aware of any issues in upgrading. It's the TutorialAI that has the dependancy.
Cheers MinchinWeb.
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 »

Sorry for double post, but more bug reports - to save further double posts, I'm just going to keep editing this one for as long as I can and add new bugs when I find them.

In the navigation chapter, on the Zooming page, if the zoom in and zoom out buttons are not clicked, their highlighting disappears. This can cause confusion on the next page as world map is also highlighted and the user is told to click the highlighted button - unfortunately at this point, there can be three of them (see screenshot 1).
Highlighting bug
Highlighting bug
Screenshot 1.png (58.9 KiB) Viewed 8692 times
EDIT: During the ships chapter, it seems that I don't have an oil rig to go to anymore (playing through right from the start). See the attached screenshot 2 - the viewport did not move to an oil rig, and the text displays unknown station. Date at this point was midway through 1956.
Oil rig bug
Oil rig bug
Screenshot 2.png (136.74 KiB) Viewed 8689 times
EDIT 2: Restarted the tutorial and skipped straight to the ships chapter, to make sure the oil rig hadn't closed. However, when it gets to building the canal, the start and end point signs for the canal aren't displayed (see screenshot 3). Only the signs have gone however, as I knew roughly where the canal had to start and end, and so I could continue the tutorial by spamming canal until I got the right place.
Screenshot 3.png
Canal bug
(207.92 KiB) Downloaded 5 times
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 »

Second post of bugs - nearly at the end of the tutorial though, so hopefully shouldn't be too many more!

During the Buses section of the tutorial, I got this debug window appearing (see screenshot 4). I'd got to the build a depot stage, but hadn't yet built one. The script then stops working (in fact it crashes) after this. This also happens if you successfully build the depot (see screenshot 5).
Depot bug
Depot bug
Screenshot 4.png (159.53 KiB) Viewed 3056 times
Depot bug 2
Depot bug 2
Screenshot 5.png (98.81 KiB) Viewed 3056 times
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 »

Okay, major revision of strings attached. There are as always changes to all sections. As previously discussed, I have not added in any commands such as {TOWN} or {NUM} and have checked to make sure it compiles without errors. However, I do have some questions:

- Is it fine for me to add in colours such as {YELLOW}? I'd assumed it probably was, but I didn't include them to make sure I didn't break anything. If it is fine, the next revision will include them for all stations, as that looked really good in my latest test of the tutorial.
- In lines 184 (STR_BUSES_5_7_1_CONCLUSION) and 163 (STR_BUSES_5_1_1_INTRO), could you please the first instance of "the town" with the appropriate {TOWN} command? This will work significantly better in terms of readability.
- In line 186 (STR_BUSES_5_7_3_CONCLUSION), could you please replace the words "your route" at the end of the second sentence with the appropriate {TOWN} command? Similar reasons to above.

I've also got a very minor update to the scenario. I just corrected the lower case name for Plafingway-on-Sea.

Hope this all helps Zuu! You're getting very close to an essential addition that any beginner should use now.
Attachments
english-new.txt
New English strings
(39.57 KiB) Downloaded 147 times
Beginners Tutorial (V12).scn
(45.19 KiB) Downloaded 164 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 »

Regarding your bug reports:
Pingaware wrote:Sorry for double post, but more bug reports - to save further double posts, I'm just going to keep editing this one for as long as I can and add new bugs when I find them.
Double posting when you have valuable contributions to a project thread is in general not a big issue.
Pingaware wrote:In the navigation chapter, on the Zooming page, if the zoom in and zoom out buttons are not clicked, their highlighting disappears. This can cause confusion on the next page as world map is also highlighted and the user is told to click the highlighted button - unfortunately at this point, there can be three of them (see screenshot 1).
Screenshot 1.png
Thanks, I've added a code step that fixes this. I first didn't think it was possible to do.
Pingaware wrote:EDIT: During the ships chapter, it seems that I don't have an oil rig to go to anymore (playing through right from the start). See the attached screenshot 2 - the viewport did not move to an oil rig, and the text displays unknown station. Date at this point was midway through 1956.
Screenshot 2.png

This is hard to fix for now. At some point I should re-make the scenario with a NewGRF that stops industries from closing down. Before that, I should probably migrate from Bananas Web UI to musa to standardize and simplify the task of uploading and dependency management.

Pingaware wrote:EDIT 2: Restarted the tutorial and skipped straight to the ships chapter, to make sure the oil rig hadn't closed. However, when it gets to building the canal, the start and end point signs for the canal aren't displayed (see screenshot 3). Only the signs have gone however, as I knew roughly where the canal had to start and end, and so I could continue the tutorial by spamming canal until I got the right place.
Screenshot 3.png
It appears that part of my code assumed that "building debug signs" is on, so this bug was caused by me "oh it looks like I've made a mistake and enabled debug signs" just before releasing version 12. Now all code that builds ordinary signs using Helper.SetSign explicitly builds signs even if the debug setting is off.


Thank you for bringing up all these bugs to the surface. :-)
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 »

Pingaware wrote:- Is it fine for me to add in colours such as {YELLOW}? I'd assumed it probably was, but I didn't include them to make sure I didn't break anything. If it is fine, the next revision will include them for all stations, as that looked really good in my latest test of the tutorial.
It is ok that you add {YELLOW} or any other colour code. Just remember that you have to revert back to black after each highlighted word. In addition to yellow, there are a few other colours that can be used. See this table: http://hg.openttd.org/openttd/trunk.hg/ ... bles.h#l42

However, before going crazy with colours, mind that the tutorial will likely move to a new window with brown background:
https://secure.openttd.org/wiki/Story_book. While find-and-replace is easy, it will help in the transition if you stay away from eg. brown or blue as that will not work on both backgrounds.

Pingaware wrote:- In lines 184 (STR_BUSES_5_7_1_CONCLUSION) and 163 (STR_BUSES_5_1_1_INTRO), could you please the first instance of "the town" with the appropriate {TOWN} command? This will work significantly better in terms of readability.
- In line 186 (STR_BUSES_5_7_3_CONCLUSION), could you please replace the words "your route" at the end of the second sentence with the appropriate {TOWN} command? Similar reasons to above.
I've changed this as you have suggested.
english.txt
Updated english.txt
(39.57 KiB) Downloaded 155 times
Pingaware wrote:I've also got a very minor update to the scenario. I just corrected the lower case name for Plafingway-on-Sea.

Hope this all helps Zuu! You're getting very close to an essential addition that any beginner should use now.
I think that I will give the scenario remake a go.
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 »

Update - Version 13

Changes
  • Pingaware has reviewed the English strings and updated them for better language.
  • All towns and stations have colour highlighting (Pingaware)
  • Some strings about cloning trucks have been split into more strings. There was too much mix between new information and task instructions in the same message, so I have tried to keep that better apart.
  • The scenario file have been remade to include "manual industries" NewGRF so that industries will never close. Some town names are same as before and some are new.
Bananas / Dependencies
I am for the moment unable to set the "manual industries" NewGRF as dependency for any of the three content items that the tutorial is made up of.

I have worked on a patch to musa which aims to add support for uploading AI, GS and Scenario content types. This work is however not yet completed. For now I've decided that it is better that users need to search for a NewGRF using the "find missing content online" button in the play scenario window than the previous situation in version 12 when new users had to download an old AI library and install it manually.


Edit: Attached english.txt version 13.
Attachments
english.txt
Version 13
(41.21 KiB) Downloaded 148 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: [NoGo] Tutorial ("Beginner Tutorial" in bananas)

Post by Zuu »

Version 14

Today a new version of Beginner Tutorial was uploaded to Bananas. This version have been uploaded using musa. However, despite quite some work over the last days, the packaging of scripts and scenarios through musa is not fully working yet. So I've marked the version 14 scenario as unavailable so that it shouldn't show up on bananas. (because it's broken and do not show up in the scenario list after download)

So, have patience and hopefully a version 15 will come in some time that is correctly packaged.

On the positive side, the version 14 of the scenario correctly had a dependency on Manual Industries in bananas. :-)
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 »

Version 16

Now Beginner Tutorial is up on bananas again.

This release do not contain any changes to the tutorial since version 14 (which in turn only had possible some minor sting tweaks compared to version 13)

What have changed however, is the dependency tree among the parts in the tutorial. This illustrates how the dependencies are now setup:

Code: Select all

- Beginner Tutorial 16 (scenario)
  - Beginner Tutorial 16 (game script)
    - SuperLib for NoGo 27
    - TileLabels 1
  - Beginner Tutorial 16 (Ship AI)
    - SuperLib 27
    - Meta Library 6
    - Fibonacci 2
  - Manual Industries (Newgrf by frosch)
My hope is that this will make sure that users of a fresh OpenTTD install should get all dependencies required to play the tutorial when they select to download the "Beginner Tutorial" scenario.
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 »

Version 17

Sorry for the version spam. However, I forgot to update the ship AI to import version 6 and not 5 of Meta Library. Thus, players with a fresh OpenTTD would get an AI crash when playing the scenario. This has now been fixed.
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 »

It seems that this project slept for a year.
Well, I'm not shure, whether this is on your working list, but...
In May I might start learning the needed stuff to continue the work if it isn't to difficult or much to time consuming for me.

Zuu would you mind to outline your plans and what is needed to continue/finish the project (if allowed)?
Please mind that I never looked into any code just played the game.
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,

I got some partial work laying around which is a starting point for using the StoryBook. However, it really need some interactive API for the StoryBook which I have not had time to implement for OpenTTD 1.4. I've attached this partial work here if anyone wants too look at it.

However, if you want to contribute a rail chapter and aim to get something done before OpenTTD 1.5, you could start by cloning the HG repository which contains current version 17. My changes above are mostly in the core infrastructure and are easy to apply later on even if changes are made with the current code base to add new chapters. Because so far, I've really only worked on converting the introduction chapter which already give the problem that I don't know when the user is done reading the 3 story pages.

Sorry for mixing both current state and StoryBook stuff. But basically. Grab version 17, create open a file called chapter_trains.nut and look how the other chapter_*.nut files are done. English strings goes into lang/english.txt and follow the pattern there for how strings are named.

A chapter is described as a series of steps. The code infrastructure provides a set of different step types for showing messages, highlight buttons, close window, wait on window (close/open), executing code. A function in the chapter is called when the chapter is loaded and will setup/return a list of all steps. The main code then will call methods in the step instances to execute them and wait for them to finish, then continue to the next step and so on. Each chapter have a table for storage which code steps have access to. For strings you will usually want to refer to data in this table which is possible using a special text class which allow not just default GSText parameters but also references to members of the storage table which will allow to delay reading from the table until the step is actually executed.

Save/load will remember the step you are at and the table. However, save/load is not really working yet as it needs more care to rewind in some places where it depends on windows being open etc. I don't consider save/load the most important for the moment, but still try to write chapters using the step infrastructure.

When you download Tutorial via Bananas or clone the repository you also get the scenario file. If you need to modify it to add industries it is OK. Try to not use a higher OpenTTD version than necessary though. 1.4 is OK but don't use a newer nightly. If you need to start the game and then go back to scenario editor, you will want to make some temporary hacks in TileLabels library so that signs are not removed from the map when starting the game. Using TileLabels signs rather than hard coding coordinates is recommended if you want to refer to some tile in the game.


Now I've written a lot and still probably forgot some. Keep asking if you wonder something I didn't explain.


Edit: The file chapter_trains.nut already exist
Attachments
Tutorial-v18-work-in-progress.tar
(160 KiB) Downloaded 138 times
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 »

Alright, didn't get all by reading. The Thing about the TileLabel Sign is confusing, but I think I should look at the present state first.
Some parts are easier to get in code/scenario than describing it properly without examples :-D .
Zuu wrote:Try to not use a higher OpenTTD version than necessary though. 1.4 is OK
I'll need to install OpenTTD newly anyway. So where can I find the present used version information (banannas I guess)?
As I said, there is no chance that I start before mid of May.
Zuu wrote:Now I've written a lot and still probably forgot some. Keep asking if you wonder something I didn't explain.
Be shure - I will
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 »

I forgot to add that there is a document called chapter_plan.txt where all/most current chapters have been first planned and then implemented into chapter_*.nut and english.txt. However, there is no plan for the trains chapter. It is also even possible to split that chapter into two or more if you wish. A starting point for contribution could be to write a plan for the plan document. If you post it here you can probably get feedback even before spending time to implement it. Or if you run out of time/motivation, others can take it up later.

The already existing chapters teach about industry chains already. There is a ship AI to complete that chapter to supply an oil refinery even if you play the trucks chapter first. For trains, I don't think you need to spend time on teaching cargos/industry chains. Instead pick an easy primary cargo or make a passenger train with a mail wagon or so. So that the trains chapter can be played without having to make an AI to complete chapters that it depend on if the user has not taken those chapters first. If you go for passengers, you probably don't need to modify the scenario file at all.
BlueDeath wrote:Alright, didn't get all by reading. The Thing about the TileLabel Sign is confusing, but I think I should look at the present state first.
Some parts are easier to get in code/scenario than describing it properly without examples :-D .
TileLabels allow me to place signs like "$L=Canal1" and then in code ask for the location of "Canal1". The library take care of iterating through all signs starting with some prefix, store their location in-memory and remove the sign so that players don't see it. Thus when I edit the scenario file, I can see these signs and doesn't need to hard tile code coordinates in the Game Script.
BlueDeath wrote:
Zuu wrote:Try to not use a higher OpenTTD version than necessary though. 1.4 is OK
I'll need to install OpenTTD newly anyway. So where can I find the present used version information (banannas I guess)?
As I said, there is no chance that I start before mid of May.
If you ask about current Tutorial version, you can check in bananas (web UI or in-game). Or you can check the repository. I usually make a commit with "Version <number>" or similar to mark the commit that correspond to a certain release.
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 »

Back from the holydays is a good time for starting...

I am a bit confused as the chapter_plan.txt is written in javascript. I am not shure whether I am exspected to write in javascript or this just coming from uploading at the repository. Never worked with such a thing, so it might take a while until it is cloned and used properly.

nut files are quite understandable.

next hours/days will take me more into your structure/files.

Draft for trains [Start of implementation into chapter_plan next weekend]:
- how it works: simple connections
- Coal from near mine to power plant (single lane)
- add far mine (single lane)
- adjustments to support 2 trains for mine 2 (passing bays with block signaling)
- planning bigger networks and stations
- build express line between airport-cities (double lane and path signaling)
- add bus/truck city (first easy crossing; later rebuild in use to better T-crossing)
- add goods into express network (further progress in networking, using waypoints)

- extra chapter for feeder (sometime later, has to concern use/disuse of CD!)

I was asking about OpenTTD-version 1.3.x I guess
so far
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 10 guests