News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Recent posts

#22
Scripting Scenarios and AI / Re: Tutorial - code review
Last post by Andarix - January 03, 2026, 11:56:27 AM
Automatic and manual processes use different code. Therefore, it is important to specify the procedure used when encountering errors.

I'm working on ensuring the automatic process only moves to the next step once the current step is complete. This isn't currently the case, which is why errors occur when the process jumps too quickly.
#23
Scripting Scenarios and AI / Re: Tutorial - code review
Last post by Yona-TYT - January 03, 2026, 11:52:22 AM
QuoteThe question here is, how did you proceed? Did you use the automatic link function or did you complete it manually as a player?
I built almost everything manually; in the case of vehicles, I use the automated script to create and route the train.
#24
Scripting Scenarios and AI / Re: Tutorial - code review
Last post by Andarix - January 03, 2026, 09:36:38 AM
Quote from: Yona-TYT on January 03, 2026, 06:04:11 AM...
Artifacts in Spanish text; I thought I had fixed this in the translations, but it seems to keep coming back.
...

This may be due to the chosen font in Simutrans.

Or you may have corrected it in the repository but not on the translation page. The texts are taken from the translation website.

Quote from: Yona-TYT on January 03, 2026, 06:04:11 AM....
There are problems getting the maximum locomotive size, the value of loc3_tile = 1, but it should be 4.

Edit: I've noticed that when you load the save game, the problem disappears, and the train does leave the depot this time, which is strange.  :o
...

The function for calculating or returning the result then seems to malfunction.

The question here is, how did you proceed? Did you use the automatic link function or did you complete it manually as a player?

I've noticed that if the automatic link is clicked too quickly in succession, the script malfunctions.

Quote from: Yona-TYT on January 03, 2026, 06:04:11 AMCode_review should be the main branch in GitHub, don't you think?.

...

Either switch branches or merge them into the main branch.

I would recommend merging, as the review isn't complete yet. The `get_fullway` function is too rigidly tied to the direction of railway construction. This currently prevents industries from utilizing each other in different orientations. And the requirement to always build on the designated field is, in my opinion, not a good design choice.
#25
Scripting Scenarios and AI / Re: Tutorial - code review
Last post by Yona-TYT - January 03, 2026, 06:04:11 AM
Code_review should be the main branch in GitHub, don't you think?.

My tests (pak64):

  //Step 11 =====================================================================================
  loc3_name_obj = get_veh_ch3(3)
  loc3_tile = calc_station_lenght(get_veh_ch3(3), get_veh_ch3(6), set_train_lenght(3))
  loc3_load = set_loading_capacity(4)
  loc3_wait = set_waiting_time(4)
There are problems getting the maximum locomotive size, the value of loc3_tile = 1, but it should be 4.

Edit: I've noticed that when you load the save game, the problem disappears, and the train does leave the depot this time, which is strange.  :o
tutorial_multipak_2026-CH3_ST_K.sve


Artifacts in Spanish text; I thought I had fixed this in the translations, but it seems to keep coming back.
simscr01.png
#26
In my experience messing about with AI, there is a real limit to the amount of context you can give it to work with. You also need to know what you're doing. For example, I've had it create simple one-page CRUD applications (simple database stuff to track things, like a to-do or medication tracker or things like that). It puts in absolutely zero security.

I trusted it to make my holiday music player, but that didn't involve a database.

If it proves to be helpful and find problems, that's awesome, and I wouldn't downplay that help. I'd just be extremely cautious about using code it generates. I personally feel it works better when it identifies problems, tells me what they are, and then proposes a fix - in general English terms, rather than writing code. Let me write the code - because it's hard enough to understand the code I've written in the first place.

I don't want to be discouraging about AI in the slightest - especially if it proves useful and helpful. Just slightly cautious and sharing my actual experience with it. :)
#27
Scripting Scenarios and AI / Re: Tutorial - code review
Last post by Andarix - January 02, 2026, 01:04:43 PM
for testing

  • extract to [pakset]/scenario/
  • start simutrans (latest revision, better latest nightly)
  • open load scenario
  • select scenario tutorial_multipak

Please not click button Tutorial.


translate page
Important: Do not change the text within { } or these brackets.

[EDIT]

new version https://forum.simutrans.com/index.php/topic,23513.msg211829/topicseen.html#msg211829
#28
Simutrans-Extended development / AI bug fixing experiment - ear...
Last post by jamespetts - January 02, 2026, 11:46:28 AM
Hello. I have not been around here much recently, but I have been spending some time working with AI for coding lately and wondered how capable that it would be for a difficult and complex code-base such as Simutrans-Extended. I have been experimenting with the open weights model GLM 4.7. I asked it to identify and fix the bug causing the occasional thread deadlock on the server that I've been aware of but unable to track down for a long time. Here is a transcript of the complete conversation. 

It identified the problem as an old bug from Standard (albeit more likely to affect Extended because it is more computationally intensive) that has alredy been fixed in Standard, and proposed the following patch based on the Standard fix:

--- a/src/network/network.cc
+++ b/src/network/network.cc
@@ -XXX,Y +XXX,Y @@
    // Processing loop
    while(running) {

- // Old Extended Style: Hold lock during execution
- s->lock();
- network_command_t *nwc = network_read_command(s);
- if (nwc) {
- nwc->execute(welt);
- }
- s->unlock();
+ // Standard Style: Unlock immediately after read
+ s->lock();
+ network_command_t *nwc = network_read_command(s);
+ s->unlock();
+
+ // Execute command (World Lock only)
+ if (nwc) {
+ nwc->execute(welt);
+ // Cleanup command object immediately after execution
+ delete nwc;
+ }
    }

I have not had time to see whether this works yet, but, if it does, it is promising. The difficulty that I have had recently in engaging with Simutrans-Extended is the amount of time required to complete the next features as against the amount of time that I now have available. If current AI can reduce the former, it may be more feasible to work on the codebase again. I shall have to apply this patch when I get home from my Christmas holiday and see whether this really does fix the deadlocking issue.
#29
Pak64 / Re: pak64 rail transport after...
Last post by Nazalassa - January 02, 2026, 11:29:06 AM
I moved the Tigresses and Pantheress in the future: Pantheress in 2030, Tigress I in 2033, Tigress II in 2040. I also slightly reduced the runningcost of the Tiger Car so that Pantheress and Tigress I trains can make some profit. (Previously it was difficult to achieve that.)
#30
Scripting Scenarios and AI / Re: Tutorial - code review
Last post by Andarix - January 02, 2026, 10:07:46 AM
Could you please describe it in more detail (chapter and language)?

I'm not getting any error messages.

[EDIT]

Check that you are using the latest sve file. There must be a bus station next to the train station.

[EDIT 2]

pak64, pak64.german or pak128?