DaymareOn / hdtSMP64

hdt-smp for 64 bit Skyrim
MIT License
30 stars 17 forks source link

hdtSMP with CUDA for Skyrim SE/AE/VR

Fork of [https://github.com/Karonar1/hdtSMP64] by Karonar1, of fork of version by aers, from original code by hydrogensaysHDT

Changes

CUDA support

CUDA support is disabled by default, but can be enabled in configs.xml or from the console. It will automatically fall back to the CPU algorithm if you do not have any CUDA capable cards. However, it does not check capabilities of any cards it finds, so may crash if your card is too old. It was developed for a GeForce 10 series card, so should work on those or anything newer.

The absolute minimum required compute capability is 3.5, to support dynamic parallelism. However, the plugin is compiled for compute capability 5.0 for better performance with atomic operations. Therefore you will need at least a Maxwell card to use the stock plugin, or a late model Kepler card if you compile it yourself.

If you have more than one CUDA-capable card, you can select the one used for physics calculations in the configuration file. The code is designed to allow it to be changed at runtime, but there is currently no console command to do this. By default it will use device 0, which is usually the most powerful card available.

The following parts of the collision algortihm are currently GPU accelerated:

The following parts are still CPU-based:

This is still experimental, and may not give good performance. The old CPU collision algorithm was heavily optimized, so matching its framerate is not easy. You will need a high end GPU and a low end CPU to see any real performance benefits.

Radeon support?

Nope, sorry. CUDA and nVidia cards are pretty much the industry standard for scientific computing, so that's what I use. In any case, I can't support GPU architectures that I don't have. The plugin should work fine in CPU mode with any type of card - I have tested it with Radeon 7850 and no nVidia drivers installed.

The plugin will use the most powerful available CUDA-capable card, regardless of whether it's being used for anything else. In theory, it's possible to have a Radeon as the primary graphics card, and an nVidia card in the same machine for CUDA and physics. I've tested this with two GeForce cards (a 1080Ti and a 1030) in the same system, but not a Radeon and a GeForce.

Note about NPC head parts

Head parts work fine for NPCs without valid facegen data, but this isn't very useful because it triggers the infamous dark face bug. Special restrictions apply to NPCs that do have facegen data:

Console commands

The smp console command will print some basic information about the number of tracked and active objects. The plugin recognizes the following optional parameters:

Coming soon (maybe)

Known issues

Build Instructions

Here is the article by DayDreamingDay. These should be complete instructions to set up and build the plugin, without assuming prior coding experience. I'm checking everything out into D:\Dev-noAVX and building without AVX support, but of course you can use any directory.

You will need:

Open a VS2019 command prompt ("x64 Native Tools Command Prompt for VS2019"). Download and build Detours and Bullet:

d:
mkdir Dev-noAVX
cd Dev-noAVX
git clone https://github.com/microsoft/Detours.git
git clone https://github.com/bulletphysics/bullet3.git
cd Detours
nmake
cd ..\bullet3
cmake .

If you want AVX support in Bullet, use cmake-gui instead of cmake, and check the USE_MSVC_AVX box before clicking Configure then Generate. This should give a fairly significant performance boost if your CPU supports it.

Open D:\Dev-noAVX\bullet3\BULLET_PHYSICS.sln in Visual Studio, select the Release configuration, then Build -> Build solution.

Download skse64_2_00_19.7z and unpack into Dev-noAVX (source code is included in the official distribution), then get the HDT-SMP source:

cd D:\Dev-noAVX\skse64_2_00_19\src\skse64
git init
git remote add origin https://github/com/Karonar1/hdtSMP64.git
git fetch
git checkout master

Open D:\Dev-noAVX\skse64_2_00_19\src\skse64\hdtSMP64.sln in Visual Studio. If you are asked to retarget projects, just accept the defaults and click OK.

Open properties for the hdtSMP64 project. Select "All Configurations" at the top, and the C/C++ page. Add the following to Additional Include Directories (just delete anything that was there before):

On the Linker -> General page, add the following to Additional Library Directories:

Open properties for the skse64 project. Select General, and change Configuration Type from "Dynamic Library (.dll)" to "Static Library (.lib)".

Credits