News:

Want to praise Simutrans?
Your feedback is important for us ;D.

[Pak128.german] Oktoberfest scenario

Started by iGi, December 04, 2021, 07:36:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

iGi

I've created a scenario for pak128.german.
It has elements of a "city grower" but also other goals mainly revolving around the Oktoberfest from pak128.german.

I think it's quite hard, but has no lose conditions (other than going bankrupt).
It will also take some time to finish it, it's not a quick scenario.

Any feedback appreciated.

Requirements:

  • Nightly version of simutrans. Tested with r10154.
    Any stable released version will NOT work. Steam version will NOT work.
    Version 1.1 of the scenario works with Simutrans v122 and v123.
  • Pak128.german v2.1 beta (rev 422) or newer.
    May work with older versions too.

How to start the scenario?
There is no savegame to load, it's an "attach"-type scenario.

  • Generate a new map to your liking
  • After the map was generated, open the main menu. (top left button)
  • Select "Load scenario" and choose "Oktoberfest".
  • The scenario is now active and you should be able to see the scenario info.
I recommend starting not earlier than 1920, as production chains could be broken otherwise.

Download and Changelog
https://github.com/igirock/oktoberfest-pak128.german/releases

Known Issues

  • The factories that are spawned in the city may have an incomplete factory chain. The factory chain is also not completed automatically when industry increases.
    To workaround this you can build the missing factories yourself. The corresponding editor tool is now unlocked.

makie

#1
Interesting
May I put this in the pak?

QuoteSupply the Oktoberfest with the most essential ware for {consecGoal} consecutive months, without it going out of stock.
with Passenger boost
nearly impossible  ;D
Because if this is true the Oktoberfest grows.
The play has to grow faster then the Oktoberfest :o

Yona-TYT

I congratulate you, there are few of us who create scenarios for simutrans. 😎😎😎😎

Dwachs

Very nice!

Why did you implement an own quicksort? squirrel has a builtin sort function http://squirrel-lang.org/squirreldoc/reference/language/builtin_functions.html#id1

Feel free to post any feature requests regarding scripting in the board https://forum.simutrans.com/index.php/board,143.0.html :)
I realized just now that there are no api functions regarding factory type (descriptor) objects. What information would you need (besides get_size()).
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

Quote from: iGi on December 04, 2021, 07:36:52 PMNightly version of simutrans. Tested with r10154
There are two functions that allow us to obtain the version of the pakset and version of simutrans, I think it can be useful with a (try cache) to verify and show the user if the version of the pakset / simutrans is not compatible. 😎


iGi

Quote from: makie on December 04, 2021, 07:53:49 PMMay I put this in the pak?
Sure, you can add this to the pak.
But as you said, there may be some balancing required.
I'm not at the "Oktoberfest" stage yet, i will need to try if it's really impossible and do adjustments.
I wanted a hard goal... maybe this is too hard...

Quote from: Dwachs on December 06, 2021, 06:33:38 AMWhy did you implement an own quicksort? squirrel has a builtin sort function http://squirrel-lang.org/squirreldoc/reference/language/builtin_functions.html#id1
Maybe i misdiagnosed something, but the script reached maximum execution time.
Even when only doing the .sort(), so i had no chance to further split it up over multiple ticks. That's why i implemented it myself to have this possibility, and in the end i didn't use it...
So either the custom sort is faster, or built-in sort is slower, or some other change fixed the root cause, which is probably most likely...

Quote from: Dwachs on December 06, 2021, 06:33:38 AMFeel free to post any feature requests regarding scripting in the board https://forum.simutrans.com/index.php/board,143.0.html :)
I realized just now that there are no api functions regarding factory type (descriptor) objects. What information would you need (besides get_size()).
I will create a post there with some general feedback. I didn't use it yet as I've always found a way around.


makie

#6
Quote from: iGi on December 06, 2021, 06:01:55 PMSure, you can add this to the pak.
Thank you.
I think this is an enrichment of the pak.
QuoteBut as you said, there may be some balancing required.
I'm not at the "Oktoberfest" stage yet, i will need to try if it's really impossible and do adjustments.
I wanted a hard goal... maybe this is too hard...
You known Sisyphos?
For each stone you carry up, the hill grows up.
For each beer you deliver to the Oktoberfest, the Oktoberfest gets bigger.

By making the Oktoberfest, our intention was, that it act as a black hole, consuming the whole map.
It was never intended, to fully satisfy the Oktoberfest without going out of stock.   ;)

Maybe there is a trick to kill the beast.  ;D

I see, the player is not allowed to build new factories.
The breweries do not grow up. The script should check if there are enough and build more if need.

Andarix


Translations that already exist (Program, Pakset) do not require a new translation in the scenario.

makie

#8
Quote from: Andarix on December 07, 2021, 05:58:56 AM
Translations that already exist (Program, Pakset) do not require a new translation in the scenario.
Thank You for the hint.

Quotecase 10: return ttext("Oktober");
all Month are already present until one   :D
The October is known as Oktober in the Simtrans program.  :o


Quotefunction goaltext()
....
      t.bier = translate("Bier");
      t.backwaren = translate("Backwaren");
      t.mandeln = translate("Mandeln");
.....
Should do ist better, the object names of the good are in german in Pak128.german.
Then translation in all languages should work.

I have load it up in the translator.
https://translator.simutrans.com/script/directions.php?lang=de&vers=315
so it  possible to translate

Sadly the Text "Due to supplied wares to factories in the city ........" is to long. Object Names in the Translator are limited.
I have shorten it. This in no problem because after translation it becomes the original one.
It is no need to put the exact English text in the scripts, because English can be translate as all other Languages. 
The text in the script (as the names of the objects in the paks) should be seen more as a index in the translation file. That can be every thing as shortcuts or numbers.


All changes:
Quote--- scenario/Oktoberfest/include/optional.nut   (Revision 465)
+++ scenario/Oktoberfest/include/optional.nut   (Revision 466)
@@ -183,7 +183,7 @@
      
      local text = ttext("{fac}:
You can increase the city's growth by supplying at least one of these wares to the factory:
");
      text.fac = getLink(_industryName, _pers.industryCoord);
-      local wares = ["Cement", "Precast concrete", "Steel"];
+      local wares = ["Zement", "Betonfertigteile", "Stahl"];

      return addWaresList(text.tostring(), wares);
   }
@@ -360,11 +360,11 @@
      
      local text = ttext("{fac}:
You can increase the city's growth by supplying at least one of these wares to the factory:
");
      text.fac = getLink(_industryName, _pers.industryCoord);
-      local wares = ["Beer", "Wine", "Pastries"];
+      local wares = ["Bier", "Wein", "Backwaren"];
      local text = addWaresList(text.tostring(), wares) + "
";
      
      local text2 = ttext("You can increase the city's maximum growth by supplying at least one of these wares to the factory:
");
-      local wares2 = ["Fish", "Meat"];
+      local wares2 = ["Fisch", "Fleisch"];
      text2 = addWaresList(text2.tostring(), wares2);
      
      return text + text2;
@@ -523,7 +523,7 @@
   
      local text = ttext("{fac}:
You can increase the city's maximum growth by supplying at least one of these wares to the factory:
");
      text.fac = getLink(_industryName, _pers.industryCoord);
-      local wares = ["Beer", "Convenience food", "Canned food", "Marzipan"];
+      local wares = ["Bier", "Fertiggerichte", "Dosenessen", "Marzipan"];
      return addWaresList(text.tostring(), wares);
   }
   
@@ -705,7 +705,7 @@
   
      local text = ttext("{fac}:
You can increase the city's growth factor by supplying at least one of these wares to the factory:
");
      text.fac = getLink(_industryName, _pers.industryCoord);
-      local wares =["Machines", "Furniture"];
+      local wares =["Maschinen", "Moebel"];
      return addWaresList(text.tostring(), wares);
   }
   
@@ -869,7 +869,7 @@
   
      local text = ttext("{fac}:
You can increase the city's growth factor by supplying at least one of these wares to the factory:
");
      text.fac = getLink(_industryName, _pers.industryCoord);
-      local wares = ["Medicines"];
+      local wares = ["Medikamente"];
      return addWaresList(text.tostring(), wares);
   }
   
@@ -1021,7 +1021,7 @@
   
      local text = ttext("{fac}:
You can increase the city's maximum growth by supplying at least one of these wares to the factory:
");
      text.fac = getLink(_industryName, _pers.industryCoord);
-      local wares = ["Cars"]
+      local wares = ["Autos"]
      return addWaresList(text.tostring(), wares);
   }
   
@@ -1207,11 +1207,11 @@
   
      local text = ttext("{fac}:
You can increase the city's growth by supplying at least one of these wares to the factory:
");
      text.fac = getLink(_industryName, _pers.industryCoord);
-      local wares = ["Beer", "Pastries", "Eggs", "Fruit"];
+      local wares = ["Bier", "Backwaren", "Eier", "Obst"];
      local text = addWaresList(text.tostring(), wares) + "
";
      
      local text2 = ttext("You can increase the city's maximum growth by supplying at least one of these wares to the factory:
");
-      local wares2 = ["Tropical fruits", "Milk", "Textiles", "Poultry"];
+      local wares2 = ["Suedfruechte", "Milch", "Textilien", "Gefluegel"];
      text2 = addWaresList(text2.tostring(), wares2);
      
      return text + text2;
@@ -1386,7 +1386,7 @@
   
      local text = ttext("{fac}:
You can increase the city's growth by supplying at least one of these wares to the factory:
");
      text.fac = getLink(_industryName, _pers.industryCoord);
-      local wares = ["Beer", "Pastries", "Books", "Tropical fruits", "Convenience food", "Textiles", "Cameras", "Canned food", "Dairy products", "Furniture", "Wine"];
+      local wares = ["Bier", "Backwaren", "Buecher", "Suedfruechte", "Fertiggerichte", "Textilien", "Kameras", "Dosenessen", "Molkereiprodukte", "Moebel", "Wein"];
      return addWaresList(text.tostring(), wares);
   }
   
@@ -1769,7 +1769,7 @@
   function resulttext()
   {
      local cityGrowth = _pers.lastCityGrowth;
-      local t = ttext("Due to supplied wares to factories in the city, the city has increased growth.
Summary of last month:
Increased growth: {growth} citizens
Base maximum growth: {baseMaxGrowth}
Increased maximum growth: {maxGrowth}
Growth factor: {growthFactor} (Increases growth by a factor)
Maximum growth factor: {maxGrowthFactor} (Increases maximum Growth by a factor)
Calculated maximum growth: {calcMaxGrowth}

Total increased growth last month: {calcGrowth}");
+      local t = ttext("Due to supplied wares to factories in the city");
      t.growth = getGrowth(cityGrowth);
      t.baseMaxGrowth = cityGrowth.baseMaxGrowth;
      t.maxGrowth = getMaxGrowth(cityGrowth);
@@ -1779,4 +1779,4 @@
      t.calcGrowth = _pers.calcGrowth;
      return t.tostring();
   }
-}
\ No newline at end of file
+}
Index: scenario/Oktoberfest/scenario.nut
===================================================================
--- scenario/Oktoberfest/scenario.nut   (Revision 465)
+++ scenario/Oktoberfest/scenario.nut   (Revision 466)
@@ -682,7 +682,7 @@
         t = ttext("Supply the {okt} with the most essential ware for {consecGoal} consecutive months, without it going out of stock.
(The most essential ware is {bier}.)");
         t.okt = getLink(_oktoberfestName, _pers.oktoberfestCoord);
         t.consecGoal = _consecutiveGoal;
-         t.bier = translate("Beer");
+         t.bier = translate("Bier");
      }
      else
      {
@@ -801,9 +801,9 @@
      local t = ttext("Supply the {okt} with these wares for {months} consecutive months, without it going out of stock:
{bier}, {backwaren}, {mandeln}
Additionally the passenger boost has to be kept above {paxBoost}% during that time.");
      t.okt = getLink(_oktoberfestName, _oktCoord);
      t.months = _consecutiveGoal;
-      t.bier = translate("Beer");
-      t.backwaren = translate("Pastries");
-      t.mandeln = translate("Almonds");
+      t.bier = translate("Bier");
+      t.backwaren = translate("Backwaren");
+      t.mandeln = translate("Mandeln");
      t.paxBoost = _paxBoostGoal;
      return t.tostring();
   }
@@ -1005,7 +1005,7 @@
         case 7: return ttext("July");
         case 8: return ttext("August");
         case 9: return ttext("September");
-         case 10: return ttext("October");
+         case 10: return ttext("Oktober");
         case 11: return ttext("November");
         case 12: return ttext("December");
         default: return ttext("Unknown month");

makie

Another problem:
If you play timeline (and you should, because the pak is designed for)
The script builds for example "Pharmacy (1886)" at a time there is no Chemical Plant available.
So the product chain is broken.

iGi

Thanks for the corrections.

Quote from: makie on December 07, 2021, 01:06:09 PMAnother problem:
If you play timeline (and you should, because the pak is designed for)
The script builds for example "Pharmacy (1886)" at a time there is no Chemical Plant available.
So the product chain is broken.
Thanks, I forgot to mention that I start maps usually at 1920 or 1930.
I would recommend starting not earlier than 1920.

makie

Oktoberfest comes up in the year 1810

Just prevent or delay the factories if not reach the intro_year=

Yona-TYT

For scenarios like this it would be a great idea to implement the map generator from scripts, with this (in theory) it would be possible to set properties such as map size, start date, number of cities, among others.

Edit.
I think it would also allow to use a raw map.  8)
Although there must be a reason this was never attempted, it must be hard to code I guess.  ???

makie

The script build some factories, but it build only the first branch of the factory chain.
Example: build bakery build farm for eggs, but no grain mill, nor sugar factory
or: build steel work build provider coal mine, but no ore mine

Even the automatic of the program does not complete these chains anymore.
So the chains remain incomplete.

iGi

When did you start, or what is the current year in your game?
There may be broken factory chains if you start too early.

The script does not really build the full factory chain, it does more or less the same as when you manually build a factory chain via the ingame editor.
So only the end consumer is selected by script and the rest is built by simutrans.

I don't know why these chains are not completed. At least when the next time industry increases, they should be completed or continued.
Maybe you can provide your save file so i can take a look?

makie

Quote from: iGi on December 30, 2021, 06:37:27 PMAt least when the next time industry increases, they should be completed or continued.
Yes, the program did this when it builds new chains automatically.
The program remember the last and incomplete chain, and complete this in the next step.
But the program do this only for the last automatically build chain.

For manually build factory, if the chain is incomplete, it will never be completed.
If I build the chain manual, it is complete. 
Maybe there is difference between manually build and build by script.

The bakery chain exists from 1800.
The steel work and the ore mine exits also from 1800.

Yona-TYT

If there is difference between scripted and tool behavior, then there must be some bug in the simutrans code.

iGi

Ok, it seems I can reproduce it.

Sometimes it happens that the chain is not complete and it will never be expanded when industry increases.
I checked this only with manually building, not using script. Even there it is reproducible. Once i even got no suppliers at all...

For now I don't know how I could fix this, other than implementing the full "build factory chain" code again in script, which I kinda don't wanna do.


makie



That has something of the hare and the hedgehog.
Since 15,000, the distance has remained the same with about 1000 inhabitants.

iGi

Thanks I found the issue.

The city might build a new townhall, and when this happens, it might be in a different position than the last one.
The townhall coords are used to identify the city, and this then no longer works.

As there is no unique id to identify the city, the city name is now also used, which is not perfect either as the user can rename the city.

Yona-TYT

Quote from: iGi on January 01, 2022, 06:22:17 PM
The city might build a new townhall, and when this happens, it might be in a different position than the last one.
The townhall coords are used to identify the city, and this then no longer works.


I made a request here:
https://forum.simutrans.com/index.php/topic,21298.msg198177/topicseen.html#msg198177

I hope to get some answer (it doesn't always work 🤪).

iGi

I've updated the scenario to v1.1, see first post for more info and download.

Yona-TYT

Quote from: iGi on January 01, 2022, 06:22:17 PMAs there is no unique id to identify the city, the city name is now also used, which is not perfect either as the user can rename the city.
I was thinking, would you be useful a function (event type) that is executed when a player changes the name of a city?.
I can try to implement something itself, and hopefully it will be included in the simutrans code.

makie

Quote from: iGi on January 01, 2022, 06:22:17 PMThe city might build a new townhall, and when this happens, it might be in a different position than the last one.
The townhall coords are used to identify the city, and this then no longer works.
No, that isn't.
My save game:
https://makie.de/Scenario_Oktoberfest.zip
That the 15000 going up is frustrating.
I'm doing something else now.

iGi

Quote from: Yona-TYT on January 02, 2022, 01:18:51 AMI was thinking, would you be useful a function (event type) that is executed when a player changes the name of a city?.
I can try to implement something itself, and hopefully it will be included in the simutrans code.
I think I don't need it, it works now, thanks.

Quote from: makie on January 02, 2022, 01:28:01 PMThat the 15000 going up is frustrating.
I'm doing something else now.
I've checked the latest save from 1874 and everything seems fine and I could go to the next phase. (using v1.1 of the scenario)
The increase of 15000 is intended this way. The goal is to have the biggest city in the region, but "Nordhorn" is currently bigger than your city "Kitzscher".
To reach the goal you have to be 1000 citizens above the biggest city, and at least 15000 if there is no bigger city.
You can stop city growth of Nordhorn to reach this goal quicker.

makie

Quote from: iGi on January 02, 2022, 09:11:54 PMI've checked the latest save from 1874 and everything seems fine and I could go to the next phase. (using v1.1 of the scenario)
The increase of 15000 is intended this way. The goal is to have the biggest city in the region, but "Nordhorn" is currently bigger than your city "Kitzscher".
To reach the goal you have to be 1000 citizens above the biggest city, and at least 15000 if there is no bigger city.
You can stop city growth of Nordhorn to reach this goal quicker.
The Script should note this like "biggest city is: xxx you have to grow +1000 over this city"
I know about the checkbox "Allow city growth", but it doesn't came in my thoughts. Because in my opinion it is useless.
This is the first useful application for this checkbox.  ;D
The script should give a hint. I think i am not the only one that don't remember this.

QuoteStreet Cleaner?
If you read the "Tips for Gameplay"
https://pak128-german.de/inc/spieltipps.html
The hint for "Two lane roads? " or "Zweispurig Straßen?"
There is a simple way to prevent the "roundabout hell"  :o

But
A script that delete the cross connections between the two lane roads is welcome.
In 123.0 there is a new possibility to lay a script on a button of the menu.

iGi

Yes the description should be improved to say this more clearly.

Quote from: makie on January 03, 2022, 09:19:42 PMIf you read the "Tips for Gameplay"
Thanks, didn't know about that.