Mod breaking changes in the next patch
Max
Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
in Modding
Hi everyone,
As most of you probably know, the next patch for Natural Selection 2 is going to add support for Linux. In order to make this happen we had to create an OpenGL backend for the game. Whenever we make changes to the engine, we try really hard to provide backwards compatibility and not break any existing mods; we know from our history developing Natural Selection 1 as a mod how frustrating this can be. For the most part, our changes to accommodate OpenGL and don't affect mods at all, but there are 2 exceptions.
The first is the .fx files which will no longer be used by the engine. FX files are a Direct3D format for specifying shaders. Because they are D3D specific, we had to create our own system which can also work with OpenGL. Our format is similar and generally it's a straight-forward process to convert from one to the other.
The second is the .screenfx files, which have also changed formats. The old screenfx file format was our own invention and we could have preserved it with our OpenGL changes. However, since the fx files that the screenfx files reference would already need to be updated, we decided to improve the format by unifying it with the render_setup files that are used to control the entire rendering pipeline. The render_setup files were essentially a superset of the functionality in the old screen effects, so this makes the screen effects quite a bit more powerful and simplified the code for dealing with them.
So, if your mod contains either .fx or .screenfx files, it will not work properly with the next build we release. It's not done yet, but I plan on making it so that this will be detected automatically and the mod will be de-activated. We'd love to work with the creators of existing mods to get them up-to-date for when the release goes out. If you're interested or have any questions, e-mail me at: max@unknownworlds.com.
As most of you probably know, the next patch for Natural Selection 2 is going to add support for Linux. In order to make this happen we had to create an OpenGL backend for the game. Whenever we make changes to the engine, we try really hard to provide backwards compatibility and not break any existing mods; we know from our history developing Natural Selection 1 as a mod how frustrating this can be. For the most part, our changes to accommodate OpenGL and don't affect mods at all, but there are 2 exceptions.
The first is the .fx files which will no longer be used by the engine. FX files are a Direct3D format for specifying shaders. Because they are D3D specific, we had to create our own system which can also work with OpenGL. Our format is similar and generally it's a straight-forward process to convert from one to the other.
The second is the .screenfx files, which have also changed formats. The old screenfx file format was our own invention and we could have preserved it with our OpenGL changes. However, since the fx files that the screenfx files reference would already need to be updated, we decided to improve the format by unifying it with the render_setup files that are used to control the entire rendering pipeline. The render_setup files were essentially a superset of the functionality in the old screen effects, so this makes the screen effects quite a bit more powerful and simplified the code for dealing with them.
So, if your mod contains either .fx or .screenfx files, it will not work properly with the next build we release. It's not done yet, but I plan on making it so that this will be detected automatically and the mod will be de-activated. We'd love to work with the creators of existing mods to get them up-to-date for when the release goes out. If you're interested or have any questions, e-mail me at: max@unknownworlds.com.
Comments
and question two, how exactly would I get my alienvision.fx to work again? it's the same base file the only thing that's been changed in the colors; so would this no longer work? or would it be unaffected as that's not really a mod
What are the new file format names?
Can you maybe provide the NS2 shaders with the new format as a reference to mod authors?
We did find one bug with some of our surface_shaders that had no effect with D3D9 but resulted in graphical corruption with OpenGL and D3D11. This was caused by non-finite floating point values being written into the frame buffer. The most common case was in code that looked like this: abs(pow(x, y)). In some cases x would be negative and result would be an undefined value. The fix was simple: pow(abs(x),y). Any mod surface_shaders that copied our code or has similar problems will need to be updated.
Because the surface_shaders are written in HLSL (which is D3D-specific) to make them work with OpenGL we had to create a HLSL parser and a GLSL generator. It is possible that a surface_shader could contain some HLSL code that our parser doesn't handle properly.
The new format FadeBlink screen effect is attached as an example.
Yes, currently you can choose between OpenGL, D3D9 and D3D11 on Windows.
For your alien vision mod, you would need to take the same steps again with the updated file (make a copy and alter the colors). You shouldn't directly modifying the files in the installation directory though, since this may prevent you from joining servers that have consistency checking enabled for that file. Instead you should create a mod and upload it to the workshop.
The new file extensions are *.hlsl and *.shader. The old *.fx extension is obsolete and won't require consistency checking anymore. I've updated the default server config to include these.
It'd be really nice to hear from Brain and/or Andi about what Lua related mod-breaking changes are going in as well.
This also causes the game to crash when changing a file with hotload enabled.
Add this