utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
562 stars 38 forks source link

Add option to pass arguments to scene JVM #584

Closed LukasVykuka closed 3 months ago

LukasVykuka commented 4 months ago

This add new parameter to godot_kotlin_configuration.json to pass argument to the JVM, which runs in the scene regardless of whether the scene was launch from editor or from command line. My use case is possibility of writing Kotlin code and connecting debugger in IntelliJ and at the same time running scene from Godot editor. For example

{"max_string_size":512,"vm_type":"jvm","scene_jvm_args":"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"}

Also it can be used for any JVM arguments. I will add docs after we agree on parameter name.

CedNaru commented 3 months ago

So the goal is that you can use those JVM argument even when starting the scene from the editor itself instead of having to launch it from command line only with the argument. So, the arguments written in the configuration JSON are guaranteed to be used for the non editor usages of the project. Given the usage, wouldn't that be better to call it debug_jvm_args or similar ?

LukasVykuka commented 3 months ago

I think debug is misleading because this parameter can be used to pass any args to JVM (not only to enable debugging) and also can be used in release build of game. So just jvm_args can be enough?

CedNaru commented 3 months ago

I think it's mostly for convenience. We can easily edit the json before starting the editor, meanwhile using project parameters require to already start the engine (so after reading said parameters) or to edit a much more complex godot file.

chippmann commented 3 months ago

Yeah it was mostly because of graalvm so that the user could chose to use graalvm on editor start IIRC.

@LukasVykuka Yeah i think just jvm_args is fine as well

CedNaru commented 3 months ago

I'm fine with jvm_args

CedNaru commented 3 months ago

As part of the overhaul of the C++ code, the argument parsing part of the module is currently being completly changed. To avoid conflict, I am going to add the feature of this PR into mine: #601 I added you a co-author.

LukasVykuka commented 3 months ago

Ok, cool. This PR can be closed, I guess.