I’m interested in using PhysX, and possible using FleX for water and particles in my game engine, but I am worried about one thing. How platform indipendent is PhysX and FleX? Do they use any platform specific features?
I’m interested in using it on Linux, Windows, Android, MAC/IOS, PS4 and Nintendo Switch. Also, I am interested in using it in a game server, where there is no OpenGL/DirectX and no GPU at all.(So everything must be CPU) My servers mostly run Linux and Windows, but some use older OS.
Also, I am correct that PhysX and FleX can be rendered and used with any GPU(NVidia, AMD, Intel, Mobile GPU’s) right(as long as I write a renderer)?
Thanks!
And one additional question, what do PhysX and FleX require to compile? Let’s say, I only have c++14 with stl library, software renderer and a timer/clock, will it run?
PhysX can run on CPU on all platforms you mentioned. In addition, there are CUDA-based implementations of clothing, particles and rigid bodies that can run on NVIDIA GPUs on Windows and Linux.
You get full CPU source code with PhysX. It comes with visual studio solution files, OSX and makefiles for Linux. You should not need anything besides the visual studio/xcode/basic compilers like gcc. GPU implementations are delivered in binary-only form so you don’t need to worry about having the relevant tools installed.
For access to source code/binaries for consoles, you need to contact PhysX licensing.
Flex can only run on GPUs. There is a CUDA-based implementation for Linux/Windows that will only work with NVIDIA GPUs and a DirectX port that works on Windows that can run on any D3D11-class GPU.
Flex is delivered pre-compiled through GitHub so you don’t need to build it. You get source access to a flex demo application so you can learn how to use the various flex features, but you do not get source access to the simulation code.
CPU and GPU in PhysX are easily interchangeable. In order to use the GPU features, the GPU DLL must be present (either explicitly loaded by your executable or in the same folder as the executable so it can be automatically loaded if needed). You must also initialize GPU features - examples of all of this are provided in the samples and snippets. In addition, the user must also have a compatible GPU and permit PhysX to run on that GPU in the NVIDIA control panel (it should be permitted by default). If there is not a compatible GPU or the user has disabled PhysX in the control panel, all simulation will fall back on CPU, even if you set your application up to use GPU PhysX.
I am not involved in licensing but, as I understand it, we are restricted from providing console solution/makefiles to anyone who isn’t a licensed developer on that platform by the platform holders’ NDAs so there are additional steps to access code for those platforms.
The majority of the code for PhysX is the same for all platforms. However, to support a new platform, you would need to fill in a lot of platform-specific blanks (how to create/destroy/synchronize threads, atomic operations, SIMD maths implementations, memory fence and barrier instructions, file access, networking etc.). You would also need to create makefiles or solutions that work with a given platform’s compilers and toolchains.
We do not currently support PSP or Nintendo DS so, for those platforms, you would need to do some work yourself to support them.
You are allowed to modify the engine and a lot of developers do for their projects. This is the primary reason we provide source code. There are some licensing restrictions involved, which I don’t know the full details of. One of the key restrictions is that you can’t share the PhysX source code (modified or otherwise) unless the recipient has agreed to our EULA and has access to the PhysX source code already.
There is some fluid/particle simulation in PhysX which can run on CPU or GPU.
APEX also provides volumetric fluid simulation (gases etc.) called turbulence.
PhysX does not specifically provide a soft body feature but you can create something that looks quite similar from a set of rigid bodies and springs.
If you take a look in the source code for any folders called “windows” or “unix” or “osx”, they contain platform-specific code for that platform.
Other than that, there are solution/makefile changes required (to build those platform-specific cpp files), pre-processor directives (in PxPreprocessor.h) and code changes to include any platform-specific headers that may be required.
It’s a relatively big job.
The lack of samples for VS2017 is an omission. We will be pushing a new distro to gitHub soon, which will include them. You should have solutions for the snippets for VS2017 already, and they are probably more informative than the samples.