[1.1] Update Unity for multithreading

Started by HelloKitty, October 01, 2019, 09:38:32 AM

Previous topic - Next topic

HelloKitty

During this year Unity introduced performance improvements, which seem to include multithreading. I'm no C# expert, but if this could be incorporated into Rimworld, this would massively improve the playability of the game. Mods are really what make Rimworld what it is, and when there are a lot of them and some years have passed, performance often gets a gamebreaking impact. If such a patch was released as DLC, I'd buy it twice.

vzoxz0

There are cleaning mods for this -- multithreading wouldn't fix it, either.

Pangaea

This fairly recent post by Tynan could indicate this happens in the future.

Quote from: Tynan on October 20, 2019, 02:05:26 PM
I have to admit I'm kind of stumped and frustrated that apparently Apple is now breaking working software.

I hope a future RimWorld update will fix these issues; we'll probably update the Unity version at some point and that might help. But it's not something that'll be released super soon. I'm sorry I can't fix this now, I just have no insight into the problem and can't reproduce it at all.

HelloKitty

"Getting Started with the Job System in Unity 2019"
https://youtu.be/C56bbgtPr_w

Bumping for the Great Salvation of Mankind. Isn't it lovable how it goes from 7 fps to 240 in just a couple clicks? The job system has been out for over a year. As I understand this wasn't implemented in the 1.1 update...

MSDOS

#4
Quote from: vzoxz0 on October 24, 2019, 10:11:57 AM
There are cleaning mods for this -- multithreading wouldn't fix it, either.
Rimworld uses an outdated version of the framework 3.5 that does not support multithreading. What does it mean to initialize mods in one thread in turn. In this case, the minimum load on the computer processor, which does not allow the use of multicore processors in full. It's time to switch to the new version of the framework 4.
In addition, the old framework will not allow modders who understand multithreading to make an effective modification to quickly loading mods that will use the computer 100%. Sorry for google translator :).

Serenity

Just because you enable support for something doesn't mean it's used. Generally when people ask that games make more use of multi-threading they have no idea what they are talking about it. It's not that simple and in some situations makes things actually worse.

HelloKitty

Quote from: Serenity on February 22, 2020, 01:30:56 PM
Just because you enable support for something doesn't mean it's used.
Whom is this addressed to? Did you watch the video?

Elrood

If you never ever worked with legacy code while trying to change base architecture from single to multi-threaded, than you have no idea how much work it takes, how hard it can be, how many bugs you are going to introduce and how long it will take to get any gains without making future development 10 times harder.

Quote from: MSDOS on February 21, 2020, 02:36:34 PM
Rimworld uses an outdated version of the framework 3.5 that does not support multithreading. What does it mean to initialize mods in one thread in turn. In this case, the minimum load on the computer processor, which does not allow the use of multicore processors in full. It's time to switch to the new version of the framework 4.
In addition, the old framework will not allow modders who understand multithreading to make an effective modification to quickly loading mods that will use the computer 100%. Sorry for google translator :).
Not true. .Net 3.5 support threading well enough - for example System.Threading.Thread, Threadpools, etc.
Problem may have been with Unity and with how incredibly hard it is to make good multithreaded application which is more complicated than a demo of how nice multithreading is.

HelloKitty

Quote from: Elrood on March 06, 2020, 04:46:13 AM
If you never ever worked with legacy code while trying to change base architecture from single to multi-threaded, than you have no idea how much work it takes, how hard it can be, how many bugs you are going to introduce and how long it will take to get any gains without making future development 10 times harder.
I actually worked with exactly that. In java. Took years. So what? Doesn't mean it'll take as long for Rimworld, especially since the platform is ready.

Whifflepits

Quote from: HelloKitty on March 06, 2020, 05:30:05 PM
Quote from: Elrood on March 06, 2020, 04:46:13 AM
If you never ever worked with legacy code while trying to change base architecture from single to multi-threaded, than you have no idea how much work it takes, how hard it can be, how many bugs you are going to introduce and how long it will take to get any gains without making future development 10 times harder.
I actually worked with exactly that. In java. Took years. So what? Doesn't mean it'll take as long for Rimworld, especially since the platform is ready.

Doesn't mean that working on Multithreading takes away from development on other parts of the game either. It's strictly background technical work, which can be contracted out. Assuming you hire the right person, it'll even be done cheaper. Tynan would probably spend less time supervising a contractor to multithread the game than he would trying to optimize current performance.

Multithreading would be nice. You get a colony with 30+ people, couple hundred animals and Randy throws a raid at you things chug no matter what you're running. 4.5-5ghz with DDR4 3800-4000? Doesn't matter, you're still in the single-digit frames. And it's all AI scripts/pathing just smashing your CPU. Want an example just go and take a hundred animals and change their area all at once, no raid needed. The instant stuttering is almost impressive.

No mods necessary.

Anarcraft

OK, my mind is blown!  Saying "no matter what you throw at it won't help, it's single-threaded and won't matter" isn't true anymore!  I just got an AMD Ryzen 9 3950X (16 cores/32 threads) and they must be doing something new at the hardware level, some sort of CPU parallelizing.  It depends on what your thread is doing (depends on the math probably).  For example when RimWorld is starting up it uses 100-104% CPU.  When my game is running with 147 mods and speed 4 (600-700 TPS) it uses 167% CPU consistently.  I've seen it jump to 600% CPU when a group of pawns generates, for example (trade caravan).  RW using 15GB of RAM as well, heh.

It's probably something like the following:
You have 9 bits of data in a thread, the CPUs can handle as follows:
CPU A: Bits 1, 4, 7
CPU B: Bits 2, 5, 8
CPU C: Bits 3, 6, 9
I'm no expert but it's a guess...

Eribrenes

The description of your knowledge has made us much more acceptable to the common people.