godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Allow specifying the library path in the HTML5 export #2839

Open acroquelois opened 3 years ago

acroquelois commented 3 years ago

Describe the project you are working on

I work on web site made with Vuejs to give access to my games (build with Godot in GDNative) thanks to WebAssembly.

Describe the problem or limitation you are having in your project

So I work wih webpack and at build time I export .wasm and .pck files in specific folder for each game, godot.js is the same for all games(bundeled along vuejs bundle): image

I have one page by game, in the javascript I import Godot engine with the right config for each game(correct index.wasm, index.side.wasm, index.pck and libgdnative.wasm). Import path depend on route: image

At this step all files are loaded and finded by Godot. But I encounter errors when Godot try to load the library: image To make the page work I must edit ENV["LD_LIBRARY_PATH"] but, with this method, I can't specify a particular path for each game.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The engine should be able to take the generic library as a parameter when config

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

We could probably take the value of the Godot configuration parameter in the function in charge of loading library files.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I don't think we can fix this issue without edit the codebase.

Calinou commented 3 years ago

cc @Faless

Faless commented 3 years ago

Are you sure the gdnativeLibs path is correct? Shouldn't it be without the /src/godot/, i.e. just the route and the name? Does the network request for that file complete correctly?

acroquelois commented 3 years ago

Thank you for your response.

Yes, the gdnativeLibs is correct, it is well loaded by Engine.log in godot.js: image But when gdnativeLibs is loaded by _dlopen module the path is wrong because it does not take into account GODOT_CONFIG, and the following error is returned: error