Jump to content

Multithreading in Unity..... Loom available in asset store. thoughts?


Recommended Posts

PhysX is fully multithreaded, and even works on NVGPU:s (for about a 10-100x performance increase using low-level cards, more with high-end (eg, titan class) cards).

However, unity has choosen to remain with a very compatible version.

FTFY. Actually the version Unity uses is so old it doesn't have the multithreading optimizations added (if it had just been 1 version higher...) Unity however doesn't want to break it's old webplayers (for some stupid reason).

The limitation of Physx GPU mode only working with NV cards is also a major headache (as I've stated many times NV could do worse than remove this artificial limitation) a growing group in the Unity community are moving over to a bullet based solution and Unity itself seems to have noticed this going so far as to hire a bullet implementer...

Link to comment
Share on other sites

Yes that's the issue, and unfortunately I think the answer is no.

Now that I've seen the video and given a brief look at the API, I'm pretty sure all LOOM does is allow threadsafe read/write of Unity objects. This is very useful if you're writing your own CPU-intensive worker threads, as he is doing with the flocking demo. He is writing all the crunch-heavy stuff and just needs to interact with Unity to get it drawn.

As I understand it, KSP uses the RigidBody solver internal to Unity, which uses PhysX under the hood. The crunch-heavy code is written, maintained, and controlled by Unity, and due to limitations in their PhysX version they cannot multithread it. Totally out of KSP's hands, and LOOM would not change that.

I would love to hear a Dev confirm/deny/elaborate on this.

Please dont get offended by this but i am sure Unity does not use PhysX at all it uses a software physics engine where PhysX is Nvidia and i could not see any Nvidia's PhysX files anywhere. I hope KSP drop the Unity engine as they are thinking about "read somewhere" i think they should use the UDK engine as it supports everything PhysX and 64bit plus multi-threading out of the box.

i would really love to do alot with KSP its such a great game but based on a poor engine.

Link to comment
Share on other sites

Please dont get offended by this but i am sure Unity does not use PhysX at all it uses a software physics engine where PhysX is Nvidia and i could not see any Nvidia's PhysX files anywhere. I hope KSP drop the Unity engine as they are thinking about "read somewhere" i think they should use the UDK engine as it supports everything PhysX and 64bit plus multi-threading out of the box.

i would really love to do alot with KSP its such a great game but based on a poor engine.

It uses physx and no they have said multiple times they do not plan to move over to another engine.

Link to comment
Share on other sites

Writing multi-threaded applications is not that difficult really. I've written quite a few myself (and still do). However, converting an existing code base is extremely difficult and laborious. Just slapping some threads on your code will introduce (not so) subtle bugs and issues that can be very hard to reproduce. It also takes a whole new way of thinking as rather than doing things step by step you now suddenly have steps passing one another which may not be desired. So now you have to deal with thing synchronization to keep things sane. Then you'd like to share some related data and now messaging tags along as well and you are forced to make really hard decisions regarding whom owns what in order to reduce duplication and wasted time on copying bits around.

Link to comment
Share on other sites

Didn't we have a huge update to unity 4 that was a vast performance boost for all? I remember just not the version of ksp it was. It would be cool for a 64bit version but then again they would have to comply four version of ksp. Mac, Linux, 32 win, and 64 win. Then support for each version is hard too. Adding one more to the equation with its own set of bugs. Sounds like a nightmare to me but it is nice to dream!

Link to comment
Share on other sites

My day job is to handle nasty performance bottlenecks where I can put my CS education and research experience to use.

I typically do four things:

*Replace hot spots written in java/c#/perl/python with little bits of c/c++ structured carefully for auto-vectorization.

*Recognize instances where routines boil down to algorithms doing things in big-O exponential ways that can be done in logarithmic time. These are typically problems that reduce to graph search, max flow, binary search, and sometimes your typical linear algebra problems where LAPACK can be dropped in and do it 100x faster.

*Divide execution in the simplest manner possible into multiple threads.

*Implement any image processing, video processing, procedural texturing, or anything else possible without heroic effort in OpenCL. This is often quite difficult, but can yield 1,000x speedups.

KSP sounds like a typical complex game project where an experienced performance person could make big improvements without exploding code complexity in ways that more straightforward approaches (multithread everything!) would. The very best way to do it is include such a person early in the design process, but even a big nasty ball of interdependent, non thread safe code can be sped up in ways that surprise the original authors.

Alternatively, a company can make the first version without regard to performance to see if there's a market, and then do version 2 with an eye towards performance from the get go. This isn't a bad idea at all :)

Link to comment
Share on other sites

Alternatively, a company can make the first version without regard to performance to see if there's a market, and then do version 2 with an eye towards performance from the get go. This isn't a bad idea at all :)

Which is what they are doing btw, they have done some minor performance (and some not so) tweaks but they have yet to do a performance pass I'd expect the first one of those to be just before RC1.

And for those talking x64 the unity x64 code bugs out on how complex KSP is they are in contact with Unity though and working together to fix it :)

Link to comment
Share on other sites

It uses physx and no they have said multiple times they do not plan to move over to another engine.

Nope this game does not run PhysX at all.

check for your self go into Nvidia CP then click on Manage 3D Settings then at the top on the bar you will see 3D settings click on show PhysX Visual Indicator, then run the game and watch as nothing happens.

Lastly PhysX is for Nvidia and only runs on Nvidia GPU's there is a Software mode but its not the same thing as PhysX is Hardware instructions writen into Cuda cores as well the Multi-threaded and Multi-cores to run many calculations......

well if Unity supports Real Nvidia PhysX they need to impliment that as it would get rid of the LAG and half the time as they would not need to spend so much time tweaking there current Physics engine.

Link to comment
Share on other sites

Nope this game does not run PhysX at all.

check for your self go into Nvidia CP then click on Manage 3D Settings then at the top on the bar you will see 3D settings click on show PhysX Visual Indicator, then run the game and watch as nothing happens.

Lastly PhysX is for Nvidia and only runs on Nvidia GPU's there is a Software mode but its not the same thing as PhysX is Hardware instructions writen into Cuda cores as well the Multi-threaded and Multi-cores to run many calculations......

well if Unity supports Real Nvidia PhysX they need to impliment that as it would get rid of the LAG and half the time as they would not need to spend so much time tweaking there current Physics engine.

From my understanding;

1. Nvidia bought PhysX and made a version that runs on their hardware.

2. Unity licensed the software only version from Nvidia to use on Unity.

3. KSP uses Unity, and the built in PhysX software engine.

Read here: http://answers.unity3d.com/questions/147735/physx-on-ati-cards.html

Edited by dlmarti
Link to comment
Share on other sites

Alternatively, a company can make the first version without regard to performance to see if there's a market, and then do version 2 with an eye towards performance from the get go. This isn't a bad idea at all :)

+1 from me! I'd pay triple A money for KSP if they went for a triple A engine.

Link to comment
Share on other sites

  • 4 weeks later...
  • 5 months later...

It's not simple. Read the info on the side, especially the disclaimer at the bottom of the scroll-box. It would take a considerable amount of time to fully implement multithreading in KSP, I should think... and in programming, it always seems to be more complex than it first appears.

Link to comment
Share on other sites

I have a feeling that it isn't getting updates anymore because it still has a "winter-is-coming-sale". Also read the disclaimer, it doesn't speed up Unity itself, and if I understand it correctly all it does is offer an API that let's developers use multiple cores for their own code.

Also Unity is actually using PhysX contrary to what some people here think, but it uses an old version of PhysX which doesn't support GPU acceralation.

Link to comment
Share on other sites

It was my understanding that KSP is already multithreaded, just that the physics thread is far, far more CPU intensive than all the other threads, so KSP is effectively single CPU thread bound.

Yep, this is the case currently, and it uses software PhysX to retain cross platform compatibility.

Link to comment
Share on other sites

well, I currently use 2.2ghz and 4gb ddr3 (ram, also happens to be the limit ksp can use), and from what do, my problems are with my intel hd gpu, the rest seems fine....

and it seems I could have a solution, there is such a thing as external gpu's that you plug into your laptop, then when you get around to building your own computer, you just re-use it....

Link to comment
Share on other sites

you know i see a lot of coding projects get hung up on one library or another. when i work on my game engine, i usually just write my own to suit my needs.

Link? The only ones I've seen are Thunderbolt, which seems to only be on more expensive laptops anyway.

http://hackaday.com/2011/10/19/beefing-up-your-laptops-gaming-chops-with-an-external-gpu/

lol

Link to comment
Share on other sites

you know i see a lot of coding projects get hung up on one library or another. when i work on my game engine, i usually just write my own to suit my needs.

http://hackaday.com/2011/10/19/beefing-up-your-laptops-gaming-chops-with-an-external-gpu/

lol

wow, you managed to find the very image that i was thinking of....

good for you !

Link to comment
Share on other sites

meh, just a regular reader of hackaday. :D

its hardly an elegant solution. the express card 2.0 interface is just a one lane pcie interface. so you can get an adapter and trick some video cards into running on just one lane. it gives you only 1/16th of the bandwidth but in some cases its better than integrated.

some gpus even have a debugging interface hidden amongst the traces on the card. ive seen hacks where people used various mcu dev boards to hack into said interface allowing the mcu to issue rendering commands, awesome stuff.

http://hackaday.com/2012/10/08/stm32-driving-a-pcie-video-card/

im kinda derailing here, my bad.

Edited by Nuke
Link to comment
Share on other sites

Yep, this is the case currently, and it uses software PhysX to retain cross platform compatibility.

But doesen't PhysX supporting multi-threading? YES it IS!

However my KSP uses only 1 core for sure, the other three core's potential aren't utilized at all! :sealed:

Why we don't have this option working?

Please make it work! I really don't like when my part count "kills" my game, and playing with less than 25 FPS is less fun than playing with more than 25 FPS :D

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...