Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhysX bindings #124

Open
dustContributor opened this issue Dec 28, 2015 · 15 comments

Comments

@dustContributor
Copy link

@dustContributor dustContributor commented Dec 28, 2015

Hi! I've been thinking, afaik there aren't many 3D physics libs available for Java gamedevs, I know of two flavors of Bullet: An outdated Bullet Java port, and libGDX's Bullet bindings. The later being more complete (it has heightmap collider for a change).

It would be awesome to have another option based on a different library.

Source is available for registered "NVIDIA developers" (ie, gotta register in their thingy, free account, can download Gameworks SDK stuff). And I believe there are some requirements to fulfill if you use PhysX in your game (add NVIDIA logo, "powered by PhysX" somewhere in the opening, stuff like that), but that should be it.

It used to be that PhysX was free to use on Windows only but recently they made free to use the whole stack https://developer.nvidia.com/physx-source-github Although I haven't checked if 32 bit and 64 bit libs are available for all platforms that LWJGL supports (probably they are).

They swear for their performance relative to Bullet, particularly on 3+ versions. Sadly I can't find the performance review I read right now.

EDIT: Here http://physxinfo.com/news/tag/bullet/ You can follow the links to one of the PhysX dev's blogs, although I warn you: They're half and half of ranting/drama and technical data.

@Sylvyrfysh

This comment has been minimized.

Copy link

@Sylvyrfysh Sylvyrfysh commented Jan 7, 2016

While signing up for the developer program, the EULA clearly statess that if you wish to use nVidia's SDKs you must either: use personally; or apply for a commercial license through their gameworks licensing team. The former is impossible for this and the latter MAY be possible but I doubt this.

EDIT: agreement here https://developer.nvidia.com/content/apply-access-nvidia-physx-source-code

@dustContributor

This comment has been minimized.

Copy link
Author

@dustContributor dustContributor commented Jan 8, 2016

Um where exactly?

It only says " use of the NVIDIA GameWorks Licensed Software with platforms other than the Authorized Platforms requires entering into a separate commercial license agreement with NVIDIA. "

That means you're free to use it on Windows, Linux and Android as long you accept that EULA you linked. It mentions the "Authorized Platforms" a little bit above.

Although now that you mention it, OSX isn't included, hm.

@Sylvyrfysh

This comment has been minimized.

Copy link

@Sylvyrfysh Sylvyrfysh commented Jan 8, 2016

I would say this part

You are required to notify NVIDIA prior to use of the NVIDIA GameWorks Licensed Software in the development of any commercial Game, Expansion Pack or Demo. Please send notification by email to: gameworkslicensing@nvidia.com and provide the following information in the email:
- Company Name
- Publisher and Developer Name
- Game Title or Application Name
- Platform (i.e. PC, Linux)
- Scheduled Ship Date
- WebLink to product/video

where as LWJGL would not be distributing the games, everyone who makes games with LWJGL would be.
But hey, I'm 16, and am not by any means a legal expert.

@dustContributor

This comment has been minimized.

Copy link
Author

@dustContributor dustContributor commented Jan 9, 2016

where as LWJGL would not be distributing the games, everyone who makes games with LWJGL would be.

No. Only if you use PhysX, not if you use LWJGL. You have the option to use PhysX or not. And I already mentioned those kind of conditions. You have to put a few nVidia logos here and there, and let them know you're going to release a game with it. It literally says just send a mail. Not "applying" for anything, it doesn't says they have to greenlight your game, it doesn't says you have to pay for it. It only says you have to accept those conditions. Thats it.

Still I understand why some of this might be annoying to do for some people. Plenty wouldn't want to put nVidia's logo in their game. Then again, if anybody is going to sell their game, certainly it isn't the biggest paperwork he/she is going to do (taxes, company papers, bank accounts, steam eulas, etc). And as I said, simply go and use Bullet or something if it annoys you.

Gah, this obviously won't go anywhere, better just close it.

@Spasi

This comment has been minimized.

Copy link
Member

@Spasi Spasi commented Jan 10, 2016

If an LWJGL user decides to use PhysX or any other library that comes with legal/marketing obligations, it's their decision and not LWJGL's. As long as it doesn't affect other users or the library itself, I don't see a problem with supporting such libraries.

With that said, PhysX has the same problem with Bullet afaik: it's a C++ API. Technically that's not a major problem, but I personally won't have time to work on C++ bindings support until well after the 3.0.0 release. See #22.

@dustContributor

This comment has been minimized.

Copy link
Author

@dustContributor dustContributor commented Jan 11, 2016

I understand. Glad that you're open to the idea though.

@Spasi Spasi moved this from Requests to Low Priority in Bindings Jul 30, 2018
@Pitj3

This comment has been minimized.

Copy link

@Pitj3 Pitj3 commented Jan 31, 2019

PhysX is now open-source, Should this become an active idea again?

@dustContributor

This comment has been minimized.

Copy link
Author

@dustContributor dustContributor commented Feb 1, 2019

It being a C++ API is still an issue. I've detailed a few other options in #428 Personally I take a jab at Newton bindings every now and then when I have time for example.

@Pitj3

This comment has been minimized.

Copy link

@Pitj3 Pitj3 commented Feb 1, 2019

I very much enjoy PhysX due to its physx visual debugger. I've never used Newton before, Bullet3D was nice back in the day, but I really think PhysX is the way forward. I see how C++ API might be an issue. @Spasi said it wasn't a huge problem but he just didn't have time until 3.0 released. Which would be now :) ?

@tlf30

This comment has been minimized.

Copy link

@tlf30 tlf30 commented Feb 8, 2019

I have heard of people doing JNI bindings to PhysX, is that not a possibility?

@dustContributor

This comment has been minimized.

Copy link
Author

@dustContributor dustContributor commented Feb 12, 2019

It is, nobody is saying that it isn't possible at all.

LWJGL is built around a bindings generator engine, which with a (fat) bit of manual input in a DSL Spasi made in Kotlin, and some magic sprinkled on top, it can generate Java bindings, with native interop code and all, from C libraries. It can generate the Java side and the native glue that casts JVM types back and forth when calling said native libraries, with all the LWJGL ecosystem supporting it (ie, type safe struct handling, memory management utilities, debug mode that checks for nulls and array sizes on each call, etc).

Mind you, this is all still using JNI. It's just that JNI alone isn't enough to make bindings work as you would expect. You might have a nk_font_color(nk_color* color) function in C, but LWJGL makes sure you have a "NkColor" class that has neat set_red(float) and set_blue(float) methods that place those 4 bytes each in the right offset from the memory allocation, it makes sure that NkColor gets unwrapped nicely into a long/int64 and passed to nk_font_color as a pointer like it expects, all the while making it so it's easier for HotSpot to allocate that NkColor object in the stack if you play your cards right.

What I am saying is that C++ library bindings aren't possible within the LWJGL framework for now, it has no concept of classes, methods and all that jazz that makes C++ the Zee Plus Plus. That's why all the bindings right now are pure C libraries like stb, or C++ libraries that expose a C API like bgfx.

@tlf30

This comment has been minimized.

Copy link

@tlf30 tlf30 commented Oct 30, 2019

Talking to @Spasi in slack, there is a C wrapper for physx that is built for use by rust. It could be used for lwjgl to get a working c wrapper for it.

https://github.com/EmbarkStudios/physx-rs/tree/master/physx-sys

@lukehutch

This comment has been minimized.

Copy link

@lukehutch lukehutch commented Nov 14, 2019

With the C wrapper for PhysX, somebody could generate a Java binding automatically using Project Panama:

https://openjdk.java.net/projects/panama/
https://jdk.java.net/panama/

@tlf30

This comment has been minimized.

Copy link

@tlf30 tlf30 commented Nov 15, 2019

I believe that LWJGL has its own way to generate the bindings.

@octylFractal

This comment has been minimized.

Copy link
Contributor

@octylFractal octylFractal commented Nov 15, 2019

LWJGL is already planned to migrate to Panama regardless: #509 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Bindings
Low Priority
7 participants
You can’t perform that action at this time.