Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.98a is out! (03/27/25)

Pages: [1] 2

Author Topic: How to make Starsector use Vulkan to improve battle performance  (Read 6789 times)

MnHebi

  • Ensign
  • *
  • Posts: 45
  • Updater of Mods, Seeker of Archives
    • View Profile

So, I've been using Mesa3D to improve Starsector's performance in battle. I get up to 110 fps stable with no freezes or anything with it.

https://github.com/pal1000/mesa-dist-win is a prebuilt package of Mesa3D for Windows. You can use either msvc or mingw build, most systems should be able to run msvc just fine, if not use the mingw build.

Install anywhere you like, as long as it is not a protected system path(such as Program Files, Desktop etc). Use perappdeploy.cmd to set up usage for Starsector(select Starsector.exe), and you have to add a new Environment Variable(look up how to do this if you don't know) to make the Vulkan part work. Add new User Environment Variable called VK_ADD_DRIVER_FILES , and as value declare where lvp_icd.x86_64.json is. For example my value is G:\Utility\Mesa\x64\lvp_icd.x86_64.json
Also follow the usage instructions on how to force Mesa to use either zink or GLonD3D12 drivers: https://github.com/pal1000/mesa-dist-win?tab=readme-ov-file#desktop-opengl-drivers


Now Mesa3d should be set up, and Starsector should work with Vulkan providing you with immense performance boost in battles.
« Last Edit: July 08, 2024, 03:52:46 PM by MnHebi »
Logged
Currently maintaining:
Outer Rim Alliance - Forum Thread

Fringe Defense Syndicate - Forum Thread
Former updater of SCY Nation, Seeker - Unidentified Contact, Diable Avionionics

mrpras

  • Lieutenant
  • **
  • Posts: 62
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #1 on: July 09, 2024, 02:22:01 AM »

Nice, thanks for sharing. Will try
Logged

Jang

  • Lieutenant
  • **
  • Posts: 83
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #2 on: July 09, 2024, 04:52:44 PM »

Would this help if I'm CPU limited? I only get slowdowns when I use a lot of missiles which spikes my CPU usage (Diable micro missiles, namely)
Logged

MnHebi

  • Ensign
  • *
  • Posts: 45
  • Updater of Mods, Seeker of Archives
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #3 on: July 09, 2024, 05:03:55 PM »

It should if your GPU is Vulkan capable.
Logged
Currently maintaining:
Outer Rim Alliance - Forum Thread

Fringe Defense Syndicate - Forum Thread
Former updater of SCY Nation, Seeker - Unidentified Contact, Diable Avionionics

Jang

  • Lieutenant
  • **
  • Posts: 83
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #4 on: July 09, 2024, 05:16:52 PM »

I can't get perappdeploy.cmd to work with either the msvc or mingw version. It just opens and closes a cmd window too fast to see anything, and running as admin doesn't change anything. I have a Ryzen 5600X and a 3090, and I think I unzipped the packages in a folder that isn't a protected system path (it's in C:\RandomFolder\RandomFolder).
« Last Edit: July 09, 2024, 05:20:13 PM by Jang »
Logged

MnHebi

  • Ensign
  • *
  • Posts: 45
  • Updater of Mods, Seeker of Archives
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #5 on: July 10, 2024, 07:06:03 AM »

Put "cmd" into your search bar and run the .cmd via that and see what it says, you are probably getting an error.
First you put in the drive you want to access like G: , then use cd foldername like cd RandomFolder to access folders. Then when you get to the folder perappdeploy.cmd is in you can just type that in and it'll execute.
Logged
Currently maintaining:
Outer Rim Alliance - Forum Thread

Fringe Defense Syndicate - Forum Thread
Former updater of SCY Nation, Seeker - Unidentified Contact, Diable Avionionics

Jang

  • Lieutenant
  • **
  • Posts: 83
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #6 on: July 10, 2024, 03:03:05 PM »

Thanks! I was able to get perappdeploy.cmd working by running Command Prompt as admin and then running perappdeploy.cmd from within Command Prompt. During setup I chose the x64 option and selected Yes for all the follow-up questions. Then I set up the user environment variable for Vulkan and system environment variables for GLonD3D12 and restarted my PC. After all this, I get the same performance as before when there's tons of missiles on screen so I'm thinking I either bungled the setup or this just doesn't help much when you're CPU-limited like me.
Logged

MnHebi

  • Ensign
  • *
  • Posts: 45
  • Updater of Mods, Seeker of Archives
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #7 on: July 11, 2024, 05:53:43 AM »

Well my old computer had an Ryzen 5 2600, and it gained performance with GLonD3D12. Did you set LIBGL_ALWAYS_SOFTWARE=1 environment variable?
You can also ensure it is loading Starsector with the right environment variables set by making a .cmd file. In my case I made this for running Miko's JDK23.

@set GALLIUM_DRIVER=zink
@.\Miko_Rouge.bat
« Last Edit: July 11, 2024, 06:13:49 AM by MnHebi »
Logged
Currently maintaining:
Outer Rim Alliance - Forum Thread

Fringe Defense Syndicate - Forum Thread
Former updater of SCY Nation, Seeker - Unidentified Contact, Diable Avionionics

maxismooth

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #8 on: July 12, 2024, 12:35:25 AM »

I have an AMD laptop with a Ryzen 5800h and struggle running this game above 20 fps in big battles. I am using MIKO's JAVA 23 as well. Unfortunately, I don't have enough computer knowledge to pull this off or attempt to do it afraid I'm going to mess it up. I'm going to save this in case I turn back to this in the future, or not if I get a new PC that can run Starsector well. Thank!
Logged

tomatopaste

  • Captain
  • ****
  • Posts: 322
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #9 on: July 18, 2024, 10:21:52 AM »

Mesa3D is not making starsector "use" vulkan, the title is meaningless. Mesa is a driver that may implement the opengl functions used in starsector more efficiently if it is used than whatever existing default graphics driver stack the user has.
Logged

MnHebi

  • Ensign
  • *
  • Posts: 45
  • Updater of Mods, Seeker of Archives
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #10 on: July 21, 2024, 10:54:50 AM »

Zink very specifically translates OpenGL calls into Vulkan ones to utilize hardware acceleration, so in a way it is using Vulkan. GlonD3D12 does the same except it uses DirectX12. AMD quite often fumbles their OpenGL driver, and in my case the performance improvement was over 60fps in battles. Without Mesa my FPS was 40-50 at most with constant stalling every time weapons fired or a phase ship phased.
Logged
Currently maintaining:
Outer Rim Alliance - Forum Thread

Fringe Defense Syndicate - Forum Thread
Former updater of SCY Nation, Seeker - Unidentified Contact, Diable Avionionics

tomatopaste

  • Captain
  • ****
  • Posts: 322
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #11 on: July 23, 2024, 11:09:07 PM »

Zink very specifically translates OpenGL calls into Vulkan ones to utilize hardware acceleration, so in a way it is using Vulkan. GlonD3D12 does the same except it uses DirectX12. AMD quite often fumbles their OpenGL driver, and in my case the performance improvement was over 60fps in battles. Without Mesa my FPS was 40-50 at most with constant stalling every time weapons fired or a phase ship phased.

My mistake, this software is pretty convoluted and I missed reading that part of your post when I was researching it out of interest. It definitely seems like a valuable tool so thanks for posting
Logged

MnHebi

  • Ensign
  • *
  • Posts: 45
  • Updater of Mods, Seeker of Archives
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #12 on: August 26, 2024, 10:10:40 PM »

So, one user alerted me to the fact, when you do the per application deployment for Starsector, and at least when using mikohime, you gotta copy the .symlinks the per application deploy creates to the jdk-23+7\bin folder, otherwise its still running the renderer on OpenGL, but the Mesa driver instead of whatever your system provides. I did get similar performance with Vulkan(tho Vulkan speeded up the loadtime from around 15 minutes to less than 5). Found this out by using rivatuner, added an text field with <APP> as the hyperlink into the overlay and it provides the renderer info.

I'll try to see if I can find the time to edit this guide this week so it provides more steps(with pictures) so less technically inclined persons can understand how to implement it.

[attachment deleted by admin]
« Last Edit: August 26, 2024, 10:38:54 PM by MnHebi »
Logged
Currently maintaining:
Outer Rim Alliance - Forum Thread

Fringe Defense Syndicate - Forum Thread
Former updater of SCY Nation, Seeker - Unidentified Contact, Diable Avionionics

Zoro89

  • Ensign
  • *
  • Posts: 42
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #13 on: September 07, 2024, 09:28:29 AM »

So, one user alerted me to the fact, when you do the per application deployment for Starsector, and at least when using mikohime, you gotta copy the .symlinks the per application deploy creates to the jdk-23+7\bin folder, otherwise its still running the renderer on OpenGL, but the Mesa driver instead of whatever your system provides. I did get similar performance with Vulkan(tho Vulkan speeded up the loadtime from around 15 minutes to less than 5). Found this out by using rivatuner, added an text field with <APP> as the hyperlink into the overlay and it provides the renderer info.

I'll try to see if I can find the time to edit this guide this week so it provides more steps(with pictures) so less technically inclined persons can understand how to implement it.

Thank you very much. It was very complicated.
I execute the perappdeploy.cmd. I think for opengl ES and offscreen rendering I selected no. After that I copy 8 symlink files (which was created in the Starsector folder) into jdk-23+7\bin. In the Starsector folder I created a bat file which contain:

@set VK_ADD_DRIVER_FILES=D:\Games\Mesa3D\x64\lvp_icd.x86_64.json
@set LIBGL_ALWAYS_SOFTWARE=1
@set GALLIUM_DRIVER=zink
@.\Miko_Silent.bat

I don't know the function but it seems to work? The performance is very poor in main menu, but I'm sure some settings was wrong, because I don't understand the part "how to force Mesa to use either zink or GLonD3D12" See screenshot.

My system:
Laptop 7840HS with 780M, 32GB W11.
I hope to avoid the poor AMD OpenGL performance.

Update: After I just removed the "@set LIBGL_ALWAYS_SOFTWARE=1" it seems to work fine now. No issues at the moment. Before I had 5 fps in tactical map in big battles. I will further test it.

[attachment deleted by admin]
« Last Edit: September 07, 2024, 12:15:01 PM by Zoro89 »
Logged

Sionetta

  • Ensign
  • *
  • Posts: 19
    • View Profile
Re: How to make Starsector use Vulkan to improve battle performance
« Reply #14 on: September 14, 2024, 05:59:52 AM »

I followed the instruction
But d3d12 wouldn't work, it even get as low as 15fps on main menu (from ~115) and the vsst showed that the game still use OGL to render
Zink on the otherhand did change renderer to VULKAN but the fps displayed on vsst is higher than actual in game fps, which actually had no noticeable improvement.
Idk where did i do wrong, pls help
Logged
Pages: [1] 2