Mysterious Lag (can't be avoided?)

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
Buggi
Engineer
Engineer
Posts: 124
Joined: 02 Feb 2005 19:03
Location: Now in North Dakota

Mysterious Lag (can't be avoided?)

Post by Buggi »

This is a question to the devs and a query to the other players to see if they see the same issues I have been seeing.

It seems the threading on the game needs a close look. I've tested this "phenomenon" a half dozen times now and come up with the same lag problem.

I play on a 10x10 map, nothing fancy, about 20 towns, no major industry, no super complex rail junctions and on my latest game only 29 trains and 24 road vehicles.

Yet, there's a consistant lag/freeze in the game every second or so. This only seem to appear in the late 2000's by game year. My processor never goes above 30% usage...

Now my system should be MORE than capable of powering this setup...
I have a 3.2 Ghz with 1 gig of ram and a Ge Force 6800 GT video card with 256 meg ram on it. Yet I can't get rid of this lag.

Also I find that turning off Autosave actually doesn't do anything, it still autosaves at the beginning of every month.

Anyway, I'd like to hear some theories and feedback on the lag.

-Nick
-Buggi
Programmer and TTD fan...
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

There is no threading in OTTD, it's all one single loop :P

Clearly the game was NOT designed for anything bigger than 256x256. If for example you have a TON of towns and they get processed every day, the game would lag every day (every 2-3 seconds) to get this done.

We've done the easiest step by just allowing you to create more and bigger things. The even harder part is to get the game out of these 'design limitations' and 'performance issues' that only surface wit these huge maps and numbers, which as said before were not designed during the creation of TTDLX.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
User avatar
Buggi
Engineer
Engineer
Posts: 124
Joined: 02 Feb 2005 19:03
Location: Now in North Dakota

Post by Buggi »

Can we do something in the meantime to *help* the situation?

I'm no expert with low-level (or multi-platform) C code though. :(

Any thoughts?
-Buggi
Programmer and TTD fan...
Roo
Engineer
Engineer
Posts: 72
Joined: 13 Dec 2004 17:47
Location: Roudnice, Czech Republic
Contact:

Post by Roo »

Disable NTF and NPF. That will remove a "dayly" lag. I have 762 trains on my scenario and it still works without any lag.
cdfbr
Engineer
Engineer
Posts: 33
Joined: 02 Mar 2005 01:15

Post by cdfbr »

Acctaly, on your server machine.

Reduce your screen to 16bit 640x480. And see if that dosent help.

If your useing windows 2000/xp then you might wanna visit

For 2000 - http://www.blackviper.com/WIN2K/servicecfg.htm

And XP - http://www.blackviper.com/WinXP/servicecfg.htm

If gives you a description of windows services and which ones you can disbable.

If your useing xp, then that may be the problem, as xp aint really made for being a server as 2000 or linux would be.

http://ttd.redgoldcreations.com/

My server runs the bare minimal, and most people say that they dont get any lag. Even well past 2000. No lag what so ever. Even for me on a remote computer.

* most these high end computers now adays, aint all there cracked up to be :) *
User avatar
Buggi
Engineer
Engineer
Posts: 124
Joined: 02 Feb 2005 19:03
Location: Now in North Dakota

Post by Buggi »

It could have been my 6 or so 20x20 train stations... :shock: I took the max size to 10 and it seems to be helping the lag issue... although I need twice the trains :)

What causes large stations to slow down the game anyway?

Also, why the 4,095 cap on goods at a station? What processes loading of trains? I looked for a VERY long time for this and couldn't find it... :(

Sometimes I'll have one or more trains sitting at a station that's maxed at 4095 and nothing is getting loaded for many many days... It's annoying.
-Buggi
Programmer and TTD fan...
Roo
Engineer
Engineer
Posts: 72
Joined: 13 Dec 2004 17:47
Location: Roudnice, Czech Republic
Contact:

Post by Roo »

New loading Alghoritm is unusable when you want to load lots of goods from a factory. It's too slow. So If you want to reach high % transported, disable it.
User avatar
LordOfThePigs
Route Supervisor
Route Supervisor
Posts: 435
Joined: 01 Jul 2004 10:28
Location: Jura/Switzerland

Post by LordOfThePigs »

Buggi wrote:Also, why the 4,095 cap on goods at a station?
While I haven't really looked at tha particular part of the code, this looks suspiciously like they store the waiting cargo on 12 bits (2^12 = 4096) and use the remaing 4 to store some more information about this particular cargo.

I could be wrong, but the symptoms point to the very common OTTD "designed for TTDX" things...
Sometimes I'm told "Brilliant"...
Sometimes I'm told "Charming"...
And Often I'm told "Shut Up"!
StarLite
Engineer
Engineer
Posts: 52
Joined: 02 Apr 2004 14:27
Contact:

Post by StarLite »

I also noticed the game can run VERY sloppy on a 10x10 map, in my case I have well over 500 trains running.

I found the problem to be in the PATHFINDING of the trains, as soon as theres a jam/holdup somewhere, the game wil start to jerk and generally become unplayable. As soon as the jam/holdup is solved, it runs smooth again:)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 19 guests