Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large numbers of trains and signals cause low FPS #7767

Closed
BlackPlague666 opened this issue Oct 13, 2019 · 22 comments
Closed

Large numbers of trains and signals cause low FPS #7767

BlackPlague666 opened this issue Oct 13, 2019 · 22 comments

Comments

@BlackPlague666
Copy link

Version of OpenTTD

1.9.3

Sorry im new to this....

Since a few months i have terrible lag or low FPS while playing openttd.
It;s in singeplayer and online.

Today i had a Video FPS of 2. Unplayable.
My windows 7 seems to work fine, processor is not on his max.

I never had this before (last years).

@James103
Copy link
Contributor

Do you have a save file, screenshot, and/or dump file showing the low video FPS? Does it affect the game TPS (ticks per second)? Have you tried running with debug output enabled (openttd -d 9 in the terminal and script console-out.log in the ingame console or in autoexec.scr)?

@Eddi-z
Copy link
Contributor

Eddi-z commented Oct 14, 2019

There is a performance monitor in the ?-Menu, can you make a screenshot of that?

@LordAro
Copy link
Member

LordAro commented Oct 14, 2019

Please give more information about your system's hardware. Also, under which versions did it work fine, and when did the performance problems start?

@BlackPlague666
Copy link
Author

Thanks for your replies! I was out of the country, so i couldnt reply earlier.

@James103
Here is a screenshot. I dont understand what u mean by TPS? I guess the other screenshot will tell you more.

openttd
openttd-2

@Eddi-z
Here it is.

@LordAro
Its win7 machine, Intel i5 3.30 Ghz-8gb ram-64 bits. And a NVIDEA GeForce GTX960
It runs GTA5, World of Tanks or Wreckfest with no problems for several hours. It's not the fastest machine in the world, but it should run OpenTtd?

I can't remember when the problems started. I haven't played it for several months. The screenshot of the local game was from march this year. So far as i know, i didnt had any problems then.

@BlackPlague666
Copy link
Author

Oh, i forgot to mention this:

With last multiplayer game, when i joined the game it was fine. In a few hours it went to unplayble.
I had that several times, so it isnt my internet connection. There werent that much trains in the game t.b.h.
The singleplayer game (screenshot above) had 800 trains and runned better than then multiplayer.

@nielsmh
Copy link
Contributor

nielsmh commented Oct 19, 2019

The game you took those screenshots probably has a very large number of trains, since the simulation of them takes more than 30 ms per tick. You may also be hitting the situation described in #7247, when there's sufficiently many vehicles the framerate-measurement code itself has an effect on the framerate. We have some ideas how to improve that particular issue but it's not ready yet.

The difference between FPS and TPS is that FPS is how fast the screen is drawn, while TPS is how fast the game world is simulated. In your case, they're the same.

Two points worth keeping in mind: OpenTTD does not benefit from a GPU, all graphics rendering is done in software. And OpenTTD is largely single-threaded, there is only very little benefit from multi-core CPUs.

@BlackPlague666
Copy link
Author

Hi @nielsmh
Thanks for your reply.

That's exactly the strange thing. While in singeplayer 800 trains is a bit laggy but playable. In a multiplayer game there were less trains but unplayable.

There were more players in the game (and other games where i encountered this) and they had no problems with lag. If there were too much trains, you would expect other players would have the same problems.

@LordAro LordAro changed the title Terrible lag, low FPS Large numbers of trains and signals cause low FPS Oct 19, 2019
@nielsmh
Copy link
Contributor

nielsmh commented Oct 19, 2019

In multiplayer, the framerate is always locked to the server's simulation rate, or perhaps even the slowest client's simulation rate. This is required due to the network game model used, there is no other way for all clients to stay in sync with the server other than everyone simulating everything, so everyone has to run at the same speed.

@BlackPlague666
Copy link
Author

sorry i dont understand what that has to do with a FPS of 2 in multiplayer game, when everybody else is running smooth.

@BlackPlague666
Copy link
Author

So, now i can hardly even enter the multiplayer server.
It freezes, with some luck i got the screenshot.

openttd3

@BlackPlague666
Copy link
Author

Still no solution?

Maybe anyone has an idea to solve this?

@nielsmh
Copy link
Contributor

nielsmh commented Oct 31, 2019

We don't know the cause yet.

Are you able to get a savegame from the multiplayer server that causes this slowness, and load that save as a singleplayer game?
Try doing that to see if it's still slow then, we need to rule out whether it relates to something with that game, or if it relates to something with multiplayer/the server/other players on the server.

@BlackPlague666
Copy link
Author

Hello Niels,

Yes i did,

When i reloaded the savegame in singeplayer it was very good playable.
When i left the game online, FPS was below 12 and i couldnt play any futher.

Other players seem to have no problems continueing.

Here some other information, maybe its usefull:
I joined the online game in 1945. No problems untill 1957, there was a noticible lag starting.
In 1958 serieous lag spikes were there. In 1960 there was serious lag and slower trains, and about 1961 it was unplayable.

I have savegames of about every year if you want to have them.
The server was reddit.com/r/OpenTTD#1 - Vanilla. I always play there.

Thanks in advance!

@nielsmh
Copy link
Contributor

nielsmh commented Nov 5, 2019

If the same game plays fine in singleplayer mode, but is bad performance in multiplayer, then the cause is likely the network. The same amount of simulation is going on regardless of singleplayer or multiplayer, every client simulates everything.

I'm not entirely sure and I hope someone else can chime in on this, but I think if you have a slow, high packet loss, or high latency, connection to the server, then that can disturb the network performance and cause your client to show this kind of symptoms.

@BlackPlague666
Copy link
Author

Network issues sound very logical.

However with other games like World of Tanks or GTA5 I don't have any internet issues, while they will take more data than OpenTTD? Or can't those games be compared with this?

I haven't changed anything with my Internet host, and since it has run smooth before, could an update provide these problems? Or maybe something like a firewall?

The problems occured in a few (openttd) years. Could it be buffering?

I shall try it with a laptop at home. If that runs smooth we can exclude some.

@nielsmh
Copy link
Contributor

nielsmh commented Nov 5, 2019

As I mentioned earlier, the game is very sensitive to delays since the server and all clients need to run in sync. So large buffers causing delays somewhere on the network route to the server could be a possible reason, as could other contention or congestion.

If you can try playing with the same computer on a different internet connection that could maybe shed some light on it. Or a different computer with the same internet connection.

@ldpl
Copy link
Contributor

ldpl commented Nov 5, 2019

Don't think network issues can cause FPS drop like that. Usually when there are network issues UI stays responsive and FPS is fine, it's just the gameplay that starts lagging and if it gets too much client simply disconnects. But here it looks like client side simulation just takes way longer than it should.

So I'd rather focus on how the game is ran. @BlackPlague666 are you sure you're running vanilla version from openttd.org not some patchpack or debug build? What command line options do you use (e.g. -d that can slow down the game)? Is there enough free RAM for the game to run without swapping? M.b. there is some other stuff on pc that can affect performance like idk hidden crypto miner? xD

@BlackPlague666
Copy link
Author

Hello Idpl,

I only use updates from openttd.org. I usually update when i can't join vanilla cause of version difference.

I don't use any command lines, I even don't know why I should.

I don't have other software running, only AVG.

Looking at my RAM (with ctrl-shift-esc) im seeing my RAM memory uses 5,22 gig of 8. Aint that a bit much? Its piling up, doenst go down anymore...

task

@ldpl
Copy link
Contributor

ldpl commented Nov 6, 2019

@BlackPlague666 well, if there is a lot of stuff is in the game openttd can use quite some ram but as long as there is some free ram left it should be fine. So, just to be clear, is that 5 gig screenshot taken when the game is lagging?
Also, another thing to test is when it starts lagging if you close openttd then start it again and connect to the same server is performance improving? If not will restarting your pc help?
Btw, the way openttd is made there is not much difference between playing the same save online and offline, especially performance-wise. So it's very likely that some other factor is causing issues here and it'll be very helpful if you can find out what it is. Until then, I'm afraid, not much can be done about this issue.

@BlackPlague666
Copy link
Author

BlackPlague666 commented Nov 6, 2019

@ldpl
Sorry, I should have been more clear, The 5 Gig was playable, no real major lag.

I can remember that i rejoined after reopening openttd without improvement. Haven't tried rebooting.

I will try sorting some stuff out. I got an other tip to delete my 850mb(!) of savegames. I will keep you updated.

So far thanks for the help!

@glx22
Copy link
Contributor

glx22 commented Nov 6, 2019

Deleting savegames won't help, you can keep them.

@andythenorth
Copy link
Contributor

Thanks for this. There's been no activity on this for some time, and as it stands, it doesn't look likely that it will go any further. I'm closing it as we try to keep the issue count low for OpenTTD, it helps us focus on things that are important and fun. Feel free to discuss in irc or request re-opening if you disagree. Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants