Jump to content

Recommended Posts

Before starting
Q1. What is this simSimDLL
A1. Simulate SimDLL
 
Q2. What is SimDLL
A2. ONI uses this dll for world simulation
 
Q3. What is this mod aiming for
A3. Do what SimDLL can do, and do what SimDLL can't do.
----------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------
SIMDLL_PLUS Features
* You can enable these features by compiling with __SIMDLL_PLUS__. These featrues are NOT included in the above mod
 
1. Enable liquidCompression parameter. Mass factor of stacked liquid is not fixed 1.01, but can be influceced by liquidCompression .
2. Gas distriubted by molar volume, not mass.
molar volume = mass / molar mass
     BTW, it is well know that, for most gas, their molar mass are different from earth in ONI world.
3. High pressure gas will liquefy
4. Use maxmass instead of molar mass as the density of liquid
----------------------------------------------------------------------------------------------------------------------------------------------
Notice
1. This mod is under development. So I insert a lot of outputs. You can find them in Game Root Path (simlog.txt & simlogPara.txt) and regular log path (%USERPROFILE%\AppData\LocalLow\Klei\Oxygen Not Included\Player.log)
2. This mod is written by C# and C++. If your game crashes while loading, please install newest Visual C++ Redistributable Package. You can also find a copy in the mod folder.
----------------------------------------------------------------------------------------------------------------------------------------------
Compile
This project contains following parts:
  • SimDLLPlus       : Used for replacing origin SimDLL
  • simSimDLL        : Link SimDLLPlus and main program
  • simSimDLL_lib: Text part
  • cp.bat                  : Combine the above parts together. Please configure %gamedir% to the correct location.
Compile environment:
  • SimDLLPlus       : VS2022, c++, v143
  • simSimDLL        : VS2022, NET Framework v4.7.2
Predefine option for compile SimDLLPlus (you cant find them in pch.h):
  • __DEBUGED__          : Fix bugs like liquid duplication. Actually, for some reasons, this option must be enabled otherwise this mod will crash.
  • __DEBUG_PRINT__: Enable/Disable generate log.
  • __SIMDLL_PLUS__ : Enable/Disable features metioned above.
  • __THREAD_DECOUPLE__: Remove ParallelTaskQueue to avoid performance overhead caused by thread switching
  • __PARALLEL__                      : Multi-threading/Single-threading
----------------------------------------------------------------------------------------------------------------------------------------------
Report new issue
  • If this mod crashed, please send me your logs (simlog.txt & simlogPara.txt & Player.log)
  • If this mod leads to strange simulation result, please describe your situlation. If you don't enable any DLC or only enable spceout, a save file will be helpful.
Edited by FIXBUGFIXBUGFIX
  • Like 1
  • Big Ups 1

This is some impressive work!

Would you mind reaching out to me for some deeper discussion of your mod? I've been working on a similar thing and have some questions and suggestions. I think I could contribute something to your mod because you're way further along than I am.

  • GL Happy 1
12 hours ago, RomenH said:

This is some impressive work!

Would you mind reaching out to me for some deeper discussion of your mod? I've been working on a similar thing and have some questions and suggestions. I think I could contribute something to your mod because you're way further along than I am.

Sure. How to contact you?

On an Intel i9 13th gen with 32GB DDR5 ram I had with this mod a around 33% loss in frame rate on a freshly generated map of roughly 600x600 and at 30x speed. I know this an extreme scenario but there certainly tradeoffs between the limitations of single threadedness and waiting for other threads.

So I decided to see if this mod would improve my mid-late game performance, but notice a very strange issue. I play on the same seed and have all the DLC except the prehistoric pack. V-SNDST-C-1929442672-0-D3-6MDT5 

I mention the seed because I know the location of all the plants, critters, etc on this seed. When this mod was loaded with a new game things had moved or were missing. I stopped at Cycle 2 when I noticed the issue and came here. I can't imagine why this mod would impact the map generation and can't rule out the possibility another mod is interfering, but it was such an odd issue I felt I should report it right away.

  • Developer

Plant and critter locations will vary based on the results of the sim ticks used during world generation, changes were made to the sim a little while ago to make sure this was deterministic so that seeds are consistent but a new sim will almost certainly effect them.
Multithreading the sim computations has been considered and left as a stretch goal a few times, I think a concern you will run into trying this is the performance of the sim is almost entirely cache/memory fetching on most hardware and not actually computation (with some exceptions) so without changing the access patterns throwing more compute at it will be unlikely to improve things but that assessment is just a cursory evaluation it may well have overlooked something.

  • Thanks 1
16 hours ago, HarryMcCleave said:

Multithreading the sim computations has been considered and left as a stretch goal a few times, I think a concern you will run into trying this is the performance of the sim is almost entirely cache/memory fetching on most hardware and not actually computation (with some exceptions) so without changing the access patterns throwing more compute at it will be unlikely to improve things but that assessment is just a cursory evaluation it may well have overlooked something.

Thanks for your reply. I have some different perspectives about the game performance.

For easily understanding, I split the computational tasks of ONI into two parts, main program (C#) and world simulation (SimDLL). The two parts are running simultaneously in different threads, and the slower one will limit the final fps.

This mod only affects on world simulation. I wrote both the single threading mode and the multi threading mode, and they can be switched by __PARALLEL__ flag. I measured the time consumption of generating a simulation frame by calling UnsafeSim200ms(0.2) repeatly. The single threading mode can reach about 80%~90% performance of original simdll, and the multi threading mode can give double performance. However, due to the performance bottleneck form main program, the final fps doesn't change in my computer.

In my observation, the main program limited the final fps in most cases. So no matter how you accelerate the simulation computation, the final fps may not change. In the worst case, the extra computational tasks from multithreading may drag down the performance of the main program.

In conclusion, before finding a way to improve the performance of the main program significantly, I hold the view that multi-threaded SimDLL is not really necessary.
  • Like 1
  • Haha 1

small bug: if you place temp-shift palte next to neutronium the temperature of the temp shift plate gets the value NaN after some time and when you try to decontruct it, the game crashes.  Afterwards I need to run the installer of the Visual C++ Restribution with the option "repair" so that the mod is not crashing the game on unpause

Edited by darkpyro23
wrote "temp **** plate" instead of "temp shift plate"

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...