Multi-core support please!

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

2457
Engineer
Engineer
Posts: 126
Joined: 06 Dec 2009 21:57

Re: Multi-core support please!

Post by 2457 »

actually 2 engine 2 transmission and 2 clutch powering the same thing IS reality.
lotta DIY tractors used to do this.
check it out:
http://www.youtube.com/watch?v=_AmMeixh_LQ

not to mention, its a verry good arrangment.
anyhow...


at least, if there are enough cores available,
witch is nowdays quite common, as instead of double core, quad cores are getting more than popular,
ship, airplane, and RV/rail PF may have theyr own cores.
least that is something...

so i understand train pathfinding is hard to do multi-core, as calculations depend on eatch other.
if there was enough cores, could one of them check and filter pathfinding dependencies, so the rest of the cores can do the tasks that do not interfer ? (or given a quad core, make that 2 cores findling with it) ?
would that increase performance quad-cores?
The Prophet -thx Pikka-
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Multi-core support please!

Post by Eddi »

you could try making ship, train and road (except onto level crossings) movement use one core each. everything else creates a HUGE administrative overhead, which is likely to eat up almost all of the speed improvements you might get. and then you touched maybe 20% of the game and sped that one up by possibly 30%, making an overall 6% speed increase of the game, but lots of potential desyncs.
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Multi-core support please!

Post by Transportman »

Eddi wrote:you could try making ship, train and road (except onto level crossings) movement use one core each.
But don't you get issues at stations then, with cargo loading and unloading?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
kutagh
Engineer
Engineer
Posts: 17
Joined: 30 Aug 2013 09:01

Re: Multi-core support please!

Post by kutagh »

Transportman wrote:
Eddi wrote:you could try making ship, train and road (except onto level crossings) movement use one core each.
But don't you get issues at stations then, with cargo loading and unloading?
If you do those in a sequential manner before calculating routes, by iterating over all stations and handling the loading/unloading aspect there, that should allow you to do it multithreaded. Whether it is worth it is another question entirely and should be viewed as a test case.
User avatar
YNM
Tycoon
Tycoon
Posts: 3574
Joined: 22 Mar 2012 11:10
Location: West Java

Re: Multi-core support please!

Post by YNM »

Eddi wrote:you could try making ship, train and road (except onto level crossings) movement use one core each. everything else creates a HUGE administrative overhead, which is likely to eat up almost all of the speed improvements you might get. and then you touched maybe 20% of the game and sped that one up by possibly 30%, making an overall 6% speed increase of the game, but lots of potential desyncs.
Hmm, well, 6 cores (includes the existing ones).

Yes, I think there might be desyncs, but after all, trains and road vehicles don't run on water tiles and ships don't run on rails (apart from IH). :mrgreen:
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Multi-core support please!

Post by Rubidium »

Vehicle movement still updates the same set of collision and location caches. For every vehicle (part) you will update these caches for each (sub) move they make, which in short means on average about once every tick. Fast vehicles are moved several times a tick, slow vehicles once every few ticks. In any case, this means lots and lots of locking/unlocking calls.
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Multi-core support please!

Post by Eddi »

that probably shouldn't be done by locking the cache, but rather by making sure the update function is atomic/thread safe. (assuming there's one phase where only updates to the cache are done, and another phase where the crash detection is done)
Baldy's Boss
Tycoon
Tycoon
Posts: 1396
Joined: 23 Feb 2014 22:02

Re: Multi-core support please!

Post by Baldy's Boss »

Is the "near future" referred to when this thread started in 2008 coming to a close yet?
User avatar
Dave
Moderator
Moderator
Posts: 17243
Joined: 26 Dec 2005 20:19
Location: North London

Re: Multi-core support please!

Post by Dave »

No, in short.
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
AdolfoRojo
Engineer
Engineer
Posts: 13
Joined: 26 Jun 2015 16:32
Skype: adolforojass
Location: Bogotá, Colombia

Re: Multi-core support please!

Post by AdolfoRojo »

Yexo wrote:OpenTTD won't support multiple cores in the near future, as that will create lots of problems (mostly with multiplayer desyncs);

About the 200 plane limit, go to "configure patches" -> "vehicles" and set "Max aircraft per player" higher.

Today 24 July/2015: seven years later...
My conclution: Is a shame that game dont have multicore support, (and today don't work in that) this is the future in computers. OpenTTD was condemned to die does not suit multi-core process.
Plase consider idea.

Thank You.
Mister_X
Engineer
Engineer
Posts: 54
Joined: 27 Apr 2005 18:40
Location: The Netherlands

Re: Multi-core support please!

Post by Mister_X »

The most steps should be executed sequentially, but some could be executed parallel. For example, all ships could execute the path finding part parallel instead of sequential, because there are no dependencies between ships.
But trains are dependent to other trains, and a lot of code for moving trains should be rewritten to make it usable for threads. (For example: Signal states and track reservations at junctions should be handled by the junctions self instead by trains.)
AdolfoRojo
Engineer
Engineer
Posts: 13
Joined: 26 Jun 2015 16:32
Skype: adolforojass
Location: Bogotá, Colombia

Re: Multi-core support please!

Post by AdolfoRojo »

Mister_X wrote:The most steps should be executed sequentially, but some could be executed parallel. For example, all ships could execute the path finding part parallel instead of sequential, because there are no dependencies between ships.
But trains are dependent to other trains, and a lot of code for moving trains should be rewritten to make it usable for threads. (For example: Signal states and track reservations at junctions should be handled by the junctions self instead by trains.)
Yeah. And the airplane can ejecuted in parallel.
For reduced resourses, you can eliminated unnecesary signals in trains (finally reduced a lot of code).
Worth a try!
Mister_X
Engineer
Engineer
Posts: 54
Joined: 27 Apr 2005 18:40
Location: The Netherlands

Re: Multi-core support please!

Post by Mister_X »

AdolfoRojo wrote: Yeah. And the airplane can executed in parallel.
For reduced resources, you can eliminated unnecessary signals in trains (finally reduced a lot of code).
Worth a try!
As long as most programmers never want to program multi core, this part of code will never be multi core because no one want to give support on it. (And it stays an never ending story.)
User avatar
Expresso
Tycoon
Tycoon
Posts: 1760
Joined: 09 Aug 2004 00:14
Location: Gouda, the Netherlands

Re: Multi-core support please!

Post by Expresso »

AdolfoRojo wrote:
Yexo wrote:OpenTTD won't support multiple cores in the near future, as that will create lots of problems (mostly with multiplayer desyncs);

About the 200 plane limit, go to "configure patches" -> "vehicles" and set "Max aircraft per player" higher.

Today 24 July/2015: seven years later...
My conclution: Is a shame that game dont have multicore support, (and today don't work in that) this is the future in computers. OpenTTD was condemned to die does not suit multi-core process.
You have been brainwashed by the marketing machines of the processor manufacturers. Just because a game doesn't support multiple threads, doesn't mean it stops being fun all of a sudden. And last time I checked fun is what matters more to a game to be fun then the amount of threads it manages to generate.

OpenTTD uses a separate thread for cargo distribution, but I'm sure you do not mean that.

I have not seen a game (closed or open source) which supports the amount of modification openttd does. In OpenTTD NOTHING is constant and EVERYTHING is open to change... and keep in mind the maps can be HUGE.

In that regard I'm quite appreciative of the openttd devs that they manage to make the game run fast, even at higher map sizes, and features being added over time.

But if you want to modify the rest of openttd to run everything at the same time, without loosing stability or performance, go right ahead. OpenTTD is an open source project and everybody is free to make changes to it. That includes you too.
User avatar
Phreeze
Director
Director
Posts: 514
Joined: 12 Feb 2010 14:30
Location: Luxembourg

Re: Multi-core support please!

Post by Phreeze »

in 2015 you have computers that give a blablubb about performance needs ^^ i have never stuffed up a 4k map,but evenon full 1024 maps, the cpu is nearly not used^^
leifbk
Chairman
Chairman
Posts: 814
Joined: 23 Dec 2013 16:33
Location: Bærum, Norway

Re: Multi-core support please!

Post by leifbk »

On my five year old Linux system with a 2.8 GHz i7 Quad and 6 GB RAM, OTTD runs comfortably in one thread; the load is barely noticeable. But then, I've only got a few hundred vehicles on a 256x512 map.

The original TTD was designed to run on a 20 MHz 386 with a few Megabytes of RAM, I believe. Even if OTTD is a reimplementation written in C++ while the original was written in assembler, it's no resource hog. You might of course hit the wall with a huge map and thousands of vehicles, but I don't think that is the normal way of playing the game. On the contrary, I guess that most people appreciate the challenge of a rather small map. Even a 512x512 size map tends to get boring in my experience, it's just more of the same. Too much mechanical routine work and too few chances to sit back and just watch the traffic.
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Multi-core support please!

Post by Eddi »

leifbk wrote:The original TTD was designed to run on a 20 MHz 386 with a few Megabytes of RAM, I believe.
Let me tell you from personal experience, that this was totally not the case. after like 10 years of game time, you maxed out the 80 trains with 1 engine+5 wagons each, and the ticks took like 2 seconds. that is 0.5fps. you should have had a 60 MHz 486 to play the game at a reasonable speed.
leifbk
Chairman
Chairman
Posts: 814
Joined: 23 Dec 2013 16:33
Location: Bærum, Norway

Re: Multi-core support please!

Post by leifbk »

Eddi wrote:
leifbk wrote:The original TTD was designed to run on a 20 MHz 386 with a few Megabytes of RAM, I believe.
Let me tell you from personal experience, that this was totally not the case. after like 10 years of game time, you maxed out the 80 trains with 1 engine+5 wagons each, and the ticks took like 2 seconds. that is 0.5fps. you should have had a 60 MHz 486 to play the game at a reasonable speed.
OK, I stand corrected :)

A 60 MHz 486 was actually what I had at the time I purchased the game on a 3½ inch floppy, about 1995. I didn't have that machine for long before I replaced it with a 133 MHz Pentium.
User avatar
kamnet
Moderator
Moderator
Posts: 8589
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Multi-core support please!

Post by kamnet »

From what I've read in recent discussions, the bottleneck is not the single core processing, but the fact that video driver support has moved from hardware to software. Your newest PC likely has a built-in video card with mostly software driving the video, where your PC from 10 years ago had all of that working on a separate hardware video card.
Mister_X
Engineer
Engineer
Posts: 54
Joined: 27 Apr 2005 18:40
Location: The Netherlands

Re: Multi-core support please!

Post by Mister_X »

Since the original game, a lot of game limits are improved.
The supported screen resolution of 640x480 is increased up to a HD resolution and above.
The maximum number of vehicles are increased from 500 to 20.000.
Number of network players are increased to 15 and all traffic is fully synchronized.

And of course the many bug fixes and improvements like pre-and path-signals, path finding algorithms, bigger stations and support to load extra grf-files.

The most improvements will cost more CPU power. For example, we could use 15 x 20.000 = 300.000 vehicles in one map and that's 6000 times more than the 500 vehicles in the original version.

For the original version, we needed 60 MHz for 500 vehicles. So for 300.000 vehicles, we need at least a CPU speed of 60x6000 = 360.000 MHz = 360 GHz !
This calculation is a little but overstated of course, but I want to explain here that due to all improvements now and in the future the game needs more and more CPU speed to run this game.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 20 guests