[1.0] RimThreads (WIP, UNRELEASED)

Started by laser50, March 07, 2019, 06:29:54 AM

Previous topic - Next topic

laser50

RimThreads - When lag gets you down

Inspired by Blas88, source code for his mods RotTickFix, Tick Multithread and IdleFix have proven to be of major help to my ability to understand any of this, parts of the Tick MultiThread code is currently being used and adapted. And I hope with this new knowledge I can start doing something great for everyone!


What is this?
RimThreads is a new mod/pack filled with tweaks to the game's basic code to try and speed it up a little, including as the name implies some basic threading capabilities. This will allow Rimworld to use some unused resources as the game is primarily single threaded. Obviously the performance gains for these mods are heavily dependent on mods, game state, game speed, CPU, CPU cores and all that jazz, so this may prove ineffective for some, and slightly more useable for others.

PRE-USE WARNING: It is also fair to warn you I have not that much experience in C#, this is my first Rimworld mod and I have little idea of what the hell I am doing. I have done extensive optimizations on a different game/game engine/code language which I hope will assist me in figuring this out. All features are tested modded and unmodded to behave as they should normally. Performance gain or not.


Current Features/Future Plans
I currently have in a working state:

  • Rotting Food checks detoured and delayed processing.
  • Idle Pawn Work Check now checks for less fires!
  • Rewrote ticker to add threads to the separate game loops.
I currently am brainstorming for this:

  • More locations that can use threading as safe as possible.
  • More tickers that don't have to run as often as they do.
  • More tweaks to list usages across the code
  • Anything I can desperately do to make some performance happen!

Download Link? Testing?
As of yet there is no download link, and there will not be held any tests. I'm taking things a bit slow, but this should ultimately end up with a better mod, and my dumb ass understanding parts of what I'm doing! I will update this topic frequently with new updates if I have any.
If you are a modder and you think you know where performance issues are coming from that I haven't mentioned, feel free to post here to help me out, we can make things happen!

atewithouttabIe

HugsLib comes w a distributedtickscheduler which is hardly ever used by mods from what i could tell w my limited patience sniffing through stuff being pi$$ed about the laggy stuff going on ingame

If you get some equivalent to the idle fix and such going, excellent

laser50

IdleFix I have been looking at, cross comparing the original and new, the only difference is a check if the pawn is drafted and.. not an animal. So I really don't assume that had a lot of use to begin with.
RotTickFix has been re-implemented differently and *should* theoretically allow for slightly better performance.

I will check hugslib out though, I haven't yet gotten to it but I am sure it can prove interesting


jager666

#4
Any news on that one? [EDIT] Last active on March, what's the point of making such threads?

XhameX


MostNimbus

It's sad the team's not going to ever upgrade Rimworld to the new version of Unity. It literally has threading in a box, solving problems like race conditions itself. It would just require integrating it into pathfinding and job checking

Reality is often disappointing


Or maybe they are doing it but won't tell us. Dreams, dreams

jager666

Yeah, I've read something about the new Unity threading capabilities, I would pay for the game again for it to run smoothly in the late game with mods :)

HelloKitty

#8
Quote from: jager666 on September 09, 2019, 01:57:18 PM
Yeah, I've read something about the new Unity threading capabilities, I would pay for the game again for it to run smoothly in the late game with mods :)
I'd pay twice!
I tried to read news on Unity for this matter and couldn't figure this out. Probably about https://unity.com/dots ? Can somebody make a bug report please with details as a friendly nudge to do this? :)
UPD: Okay, I posted it myself. https://ludeon.com/forums/index.php?topic=49593.0

MostNimbus

If job system goes stable anytime soon we'd have a grain of hope

P.S By soon I mean within a year or so