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

Export questions #116

Open
insomniacUNDERSCORElemon opened this issue Nov 17, 2021 · 2 comments
Open

Export questions #116

insomniacUNDERSCORElemon opened this issue Nov 17, 2021 · 2 comments

Comments

@insomniacUNDERSCORElemon
Copy link

insomniacUNDERSCORElemon commented Nov 17, 2021

  1. Is it possible to do an export from Godot where the library file is embedded as well (or maybe embed into .pck for projects that don't embed that)? Note that this file seems to contain project-specific logic, therefore is not something likely to be useful(linked etc.) for multiple Godot-Nim applications. I am not sure why it's named like this (for instance nim_linux_64.so) rather than something more clearly specific to when it was exported.
  2. Godot now can now export HTML5 with GDnative, any directions for Godot-Nim? I've tried multiple things (including copying files manually) and while the app itself works (via nimhttpd) I cannot get code to run.

EDIT: Also exporting for multiple platforms, but I assume that is just something that must be manually done before exporting with Godot. Unless it's possible to make Godot-Nim-specific export templates?

@endragor
Copy link
Member

godot-nim by itself is just a Nim library. It doesn't do anything out of the ordinary when you use it.

godot-nim-stub provides an example (a rather basic one) of how to build your Nim project in a way that Godot expects it. You can modify it to your needs, name libraries differently or even have multiple libraries in your own project. That project was meant to provide a basic template that you can expand as needed.

As about the specific questions here:

  1. You cannot package a native dynamic library into another file. OS APIs expect it to be a separate file. The only exception is iOS where dynamic libraries are not allowed and so GDNative libraries are linked statically. The last time I checked GDNative didn't support static linking for other platforms, but things may have changed since then.

  2. I haven't looked into exporting Nim projects for HTML5. You should look into how it's done for C and replicate the same steps for Nim. Nim supports overriding the commands used for compiling C files, which may come in handy here.

  3. For exporting to multiple platforms I'd recommend making a task like nake package html5 that does the necessary preparations, compiles the library for Godot, and then invokes Godot to export the project.

@insomniacUNDERSCORElemon
Copy link
Author

insomniacUNDERSCORElemon commented Nov 18, 2021

To be clear on one of the questions: you can copy the nim-lang library from 1 exported project over to another and it will carry over logic (most notably window settings if set via nim). It might be interesting if 2 games were developed similarly enough that swapping files like that would produce a playable (though odd) result. Though I suspect the more common issue will be people updating/replacing .pck files and not also the libraries, and thus not actually fixing code errors.

So It'd be more clear if it were nim_gamelogic_OSbits.libext (or something like that) as default instead. Though sure, I do see how I could do that myself in nakefile.nim in your stub project (which yes, I have used obviously). EDIT: Actually the gdnlib file needs to be edited as well


The other stuff I don't know where I'd even start (a while ago I wanted to test Bunnymark and couldn't get C++ bindings installed), I'm not far enough for it to really matter that much (well, I've now done 1 project that I tried to export to HTML5) but it'd be nice to have actual info/directions.

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

2 participants