Lagging in a just started game
Moderator: OpenTTD Developers
-
- Engineer
- Posts: 11
- Joined: 13 Feb 2024 21:41
Lagging in a just started game
Problem here.
I created a 4096x4096 world with the cities as big as they possible get by creation of them, with 3 transporting AI's (which, on this moment, each have 3000-5000 vehicles per AI), around ~100 active NewGRF's in the game, and MagicGS gamescript running.
I started the game in 2100, now it is end 2106, so just six years. In that time I build like 10 airports with 40 planes, 10 buses and 30 ships or something like that.
Over the years, I got a few gamescripts failing and also 2 AI's failing, but the game never crashed or even lagged, it was always as fast as it always was.
But then I created a chain of trainstations between 9 cities (each trainstation has 3 tracks) like this: 1->2->3->4->5->6->7->8->9, I did this while pausing the game.
So I bought the trains (three of them) and I gave orders and unpaused the game, but after a few moments the game started immensively lagging (see attachment).
When I reload the savegame, after five seconds, the game starts lagging again. This is very irritating!
It is also very weird, cause before the trains everything worked just alright, and I don't have a bad laptop (game laptop with Ryzen 7 5800H, 32 GB RAM, RTX 3070 Ti and Samsung SSD).
Please help me! Thanks in advance!
Greetings!
I created a 4096x4096 world with the cities as big as they possible get by creation of them, with 3 transporting AI's (which, on this moment, each have 3000-5000 vehicles per AI), around ~100 active NewGRF's in the game, and MagicGS gamescript running.
I started the game in 2100, now it is end 2106, so just six years. In that time I build like 10 airports with 40 planes, 10 buses and 30 ships or something like that.
Over the years, I got a few gamescripts failing and also 2 AI's failing, but the game never crashed or even lagged, it was always as fast as it always was.
But then I created a chain of trainstations between 9 cities (each trainstation has 3 tracks) like this: 1->2->3->4->5->6->7->8->9, I did this while pausing the game.
So I bought the trains (three of them) and I gave orders and unpaused the game, but after a few moments the game started immensively lagging (see attachment).
When I reload the savegame, after five seconds, the game starts lagging again. This is very irritating!
It is also very weird, cause before the trains everything worked just alright, and I don't have a bad laptop (game laptop with Ryzen 7 5800H, 32 GB RAM, RTX 3070 Ti and Samsung SSD).
Please help me! Thanks in advance!
Greetings!
Re: Lagging in a just started game
Which OS and version of OpenTTD are you using?
Also, are you able to provide a copy of the savegame file?
Also, are you able to provide a copy of the savegame file?
-
- Engineer
- Posts: 11
- Joined: 13 Feb 2024 21:41
Re: Lagging in a just started game
OS: Windows 11 Pro version 23H2 x64 (I'm keeping it up to date each day)
I'm using the beta: OpenTTD 14.0-beta3
see attachment below for savegame file
I'm using the beta: OpenTTD 14.0-beta3
see attachment below for savegame file
Last edited by wimpiedimpie on 14 Feb 2024 11:45, edited 1 time in total.
-
- Engineer
- Posts: 11
- Joined: 13 Feb 2024 21:41
Re: Lagging in a just started game
I just looked up a earlier version of the same savegame where it yet didn't lag, but after 10 days (in-game), it started lagging too, so it seems to be not the problem with the trains
EDIT:
I did also run a new game without newgrfs but with AI's and also 4096x4096 again and after 100 years it still didn't lag so I think it's because of the NewGRF's
EDIT:
I did also run a new game without newgrfs but with AI's and also 4096x4096 again and after 100 years it still didn't lag so I think it's because of the NewGRF's
Re: Lagging in a just started game
1) You're running a 4096x4096 map. This is going to be CPU demanding.
2) Your AIs have 2000, 5000, and 5000 road vehicles each. This is going to be CPU demanding.
3) You've set script #opcodes to 100,000, ten times the default of 10,0000. This is going to be CPU demanding.
4) You've loaded 100 NewGRFs, depending on what they do, this is going to be CPU demanding.
I don't think you can class a game with 16,000 vehicles "Just started" really!
2) Your AIs have 2000, 5000, and 5000 road vehicles each. This is going to be CPU demanding.
3) You've set script #opcodes to 100,000, ten times the default of 10,0000. This is going to be CPU demanding.
4) You've loaded 100 NewGRFs, depending on what they do, this is going to be CPU demanding.
I don't think you can class a game with 16,000 vehicles "Just started" really!
He's like, some kind of OpenTTD developer.
-
- Engineer
- Posts: 11
- Joined: 13 Feb 2024 21:41
Re: Lagging in a just started game
Yeah I get itpeter1138 wrote: 15 Feb 2024 18:46 1) You're running a 4096x4096 map. This is going to be CPU demanding.
2) Your AIs have 2000, 5000, and 5000 road vehicles each. This is going to be CPU demanding.
3) You've set script #opcodes to 100,000, ten times the default of 10,0000. This is going to be CPU demanding.
4) You've loaded 100 NewGRFs, depending on what they do, this is going to be CPU demanding.
I don't think you can class a game with 16,000 vehicles "Just started" really!
And I have a not bad CPU: Ryzen 7 5800H, so that's weird too.
I will check the setting for scripts and AI's, as they perhaps are a bit exaggerated yeah
Re: Lagging in a just started game
It's not so much that OpenTTD is inefficient, it is because you've told it to run scripts 10x as much as normal, along with 10x as many road vehicles as normal, AND to top it off the CityLifeAI script (which is not OpenTTD itself) is not very well behaved -- it is trying to run as fast as it can, and you've told the game it can run 10x as long as normal. So it is.
He's like, some kind of OpenTTD developer.
Re: Lagging in a just started game
Related: viewtopic.php?p=1267683#p1267683
He's like, some kind of OpenTTD developer.
Re: Lagging in a just started game
It may be showing % of all cores, OpenTTD only uses one and with 8 cores 100% load will be close to 15% overall.wimpiedimpie wrote: 15 Feb 2024 19:36 Yeah I get it, but my CPU never gets above 15% for OpenTTD (I see that in my task manager in windows), so is OpenTTD so inefficient in CPU usage?
-
- Engineer
- Posts: 11
- Joined: 13 Feb 2024 21:41
Re: Lagging in a just started game
Okay, I guess OpenTTD was indeed using maximum CPU amount...It may be showing % of all cores, OpenTTD only uses one and with 8 cores 100% load will be close to 15% overall.
Can't that be changed in a way that OpenTTD uses all cores?
Okay, thanks for the info and the link, I now understand more clearlypeter1138 wrote: 15 Feb 2024 19:58 It's not so much that OpenTTD is inefficient, it is because you've told it to run scripts 10x as much as normal, along with 10x as many road vehicles as normal, AND to top it off the CityLifeAI script (which is not OpenTTD itself) is not very well behaved -- it is trying to run as fast as it can, and you've told the game it can run 10x as long as normal. So it is.
Re: Lagging in a just started game
That's an extremely difficult problem because it will involve completely ripping out all of the game logic and rewrite it in a new way where it can run in parallel. I won't go into detail here, but you can find other threads discussing the difficulty of making OpenTTD multi-threaded on the forums.
Re: Lagging in a just started game
not saying jfs is wrong ...
but someone did do that indeed ... using more cores ... way back
turns out the game was slower .. so yeah ...
but someone did do that indeed ... using more cores ... way back
turns out the game was slower .. so yeah ...
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
-
- Engineer
- Posts: 11
- Joined: 13 Feb 2024 21:41
Re: Lagging in a just started game
Wait, so you mean that as a result that OpenTTD was made multithreaded, the game was slower then before?! That sounds bad!
Sounds like it can't be done properly/easily...
-
- Engineer
- Posts: 11
- Joined: 13 Feb 2024 21:41
Re: Lagging in a just started game
Other question: can you delete newgrf's from your system? Can you simply delete from where they were downloaded (in file explorer) or does OpenTTD support deleting NewGRF's?
Or at least preventing NewGRF's from being loaded into OpenTTD when you start the game?
Or at least preventing NewGRF's from being loaded into OpenTTD when you start the game?
-
- Tycoon
- Posts: 1309
- Joined: 16 Oct 2018 08:31
- Location: Heart of the Highlands. Not Scottish. Czech.
Re: Lagging in a just started game
Note that Openttd is built on the core of a game that was created when the modern computer was the IBM 286, if I'm not mistaken. It simply didn't account for multi-core processors, and apparently it's going to be really hard to do without completely rewriting the entire code.
Re: Lagging in a just started game
it was indeed ... so yeah ...wimpiedimpie wrote: 16 Feb 2024 09:26Wait, so you mean that as a result that OpenTTD was made multithreaded, the game was slower then before?! That sounds bad!
Sounds like it can't be done properly/easily...
do take into account that all is calculatd on the fly and with that the whole map ... not just only what you see ... as opposed to 3d shooters where enemies just sit idle doing f-all untill you get there ... and also that some things that could have been moved to other cores have been ... like saving and things ...
Last edited by ChillCore on 16 Feb 2024 22:50, edited 1 time in total.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Lagging in a just started game
show us?
... but yeah not easy
the "waiting for other cores" thinghy made it slower
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Lagging in a just started game
NewGRFs are not loaded when you start OpenTTD, but they are scanned for in order to populate the in-game NewGRF list. If you want to ensure a NewGRF isn't loaded before you start a new game in OpenTTD, make sure it's removed from your list of active NewGRFs. If it's in a scenario file, then you can't remove it and the scenario won't load without it (unless you intentionally make some alterations which can also break stuff, there's another topic here for that).wimpiedimpie wrote: 16 Feb 2024 10:47 Other question: can you delete newgrf's from your system? Can you simply delete from where they were downloaded (in file explorer) or does OpenTTD support deleting NewGRF's?
Or at least preventing NewGRF's from being loaded into OpenTTD when you start the game?
OpenTTD doesn't support deletion of a NewGRF from within the game. You can remove it from your OS file manager. But if you have a scenario file, save or preset that used it, the in-game content service will automatically download it again.
The 286 CPU was early 80s. The minimum system requirements for TTD was an Intel 486 CPU, 4 MB of RAM running MS-DOS 6 or newer.Argus wrote: 16 Feb 2024 22:28 Note that Openttd is built on the core of a game that was created when the modern computer was the IBM 286, if I'm not mistaken.
Do you like drones, quadcopters & flying toys? Check out Drone Strike Force!

Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets

Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets
-
- Engineer
- Posts: 11
- Joined: 13 Feb 2024 21:41
Re: Lagging in a just started game
Thank you all for the information
Re: Lagging in a just started game
you are welcome ....
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Who is online
Users browsing this forum: No registered users and 15 guests