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

Native c++ and C# #89

Closed
srcrip opened this issue Dec 22, 2019 · 6 comments
Closed

Native c++ and C# #89

srcrip opened this issue Dec 22, 2019 · 6 comments

Comments

@srcrip
Copy link

srcrip commented Dec 22, 2019

Now that there's first class c++ and C# scripts in Godot is there any chance of being able to implement this plugin with that so that the compiling from source step isn't needed?

Would C# scripts be as fast as the current approach?

@TokisanGames
Copy link
Contributor

I can safely say there's no chance Zylann will rewrite the module in C#. However your C# code can call the module.

C# has been measured at 2 - 7.5 times slower than C++.
http://www.royaldonut.games/2019/03/29/cpu-voxel-benchmarks-of-most-popular-languages-in-godot/

Converting the module to a plugin remains a possibility in the future, but it's low priority.

Rebuilding the engine with the module compiled is really no big deal for one who is becoming a game developer. However it is no longer a requirement:
https://www.youtube.com/watch?v=zfzmcbR1H_0

@Zylann
Copy link
Owner

Zylann commented Dec 23, 2019

I am considering "librarizing" the module in the far future so that it can have a GDNative implementation (or use in other engines), but currently GDNative symbols don't get represented in C# (i.e you have to use reflection to call it). A P/Invoke-ready build could work too for a library but all this is pretty much far in the future. I'm not considering porting to C# at all because it would just make it slower and too much work for my free time. You are free to do it, though.

Having it as a module right now is a good compromise, as all languages and platforms can use it without hassle apart from engine compilation, which is not a big deal anyways since @tinmanjuggernaut gracefully provides such builds now.

@srcrip
Copy link
Author

srcrip commented Jan 2, 2020

I know C# code in Godot will sit somewhere between C++ and GDScript in terms of speed, but I was curious if that would be "enough" to make a good implementation.

@TokisanGames
Copy link
Contributor

To write your game in C# and call this module will be quite performant. To rewrite the module as C# is not worth your time. It will be 2-7.5x slower and it's already not as fast as we'd like, though decent. There are gdscript implementations of blocky voxels around. But smooth voxels are quite taxing.

@blockspacer
Copy link

If you will convert the module to a plugin - support for some platforms (like HTML5) will be lost

Both GDNative and C# are not supported for HTML5 export.

BTW godot_voxel may work fine in HTML5 with threads disabled (or web workers and shared memory manually enabled in browser settings). I made godot_voxel work in browser long time ago and planning to add HTML5 support. godotengine/godot#12699 (comment)

If you want fast prototyping with C++ modules without recompiling - please try Cling for dev builds godotengine/godot#31630 (comment)

@Zylann
Copy link
Owner

Zylann commented Nov 13, 2021

Superseded by #333

@Zylann Zylann closed this as completed Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants