kool-engine / kool

An OpenGL / WebGPU engine for Desktop JVM, Android and Javascript written in Kotlin
https://fabmax.github.io/kool/kool-js
Apache License 2.0
306 stars 20 forks source link

kool-project.json not found #47

Closed Protoxy22 closed 1 year ago

Protoxy22 commented 1 year ago

Hi, I'm having some problems to run the editor template, I get a IllegalStateException("kool-project.json not found") when I run the project from local intellij command (because run application is not available on the gradle project)

Is there something I missed ? And I also can't figure out how the kool-editor works (I have nothing on the mainscreen except two panels), I know it's in early state, but I would like to get the example working :)

Thanks in advance fabmax, and the vulkan fix is quite good, you explained that the vulkan rendering was a bit hacky, but glad it works again !

fabmax commented 1 year ago

The kool-project.json is generated on first start of the kool-editor (without -template). After starting the editor it should be located under kool-editor-template/src/commonMain/resources. Currently, the editor requires the working directory to be the top-level project directory. Depending on your project setup that might not be the default case but you can set it in IntelliJ by editing the Launch configuration (e.g. via Menu -> Run -> Edit Configurations...)

When everything is setup correctly you should see the two panels and a green cube in the 3D viewport. You can add more meshes by right clicking any object in the Scene Browser (left panel) and edit some basic object properties by selecting an object (e.g. the cube) in scene browser or 3d viewport. Currently, primitive meshes are the only things that can be added to the scene. Next thing is definitely some kind of asset manager you can use to add models, textures, etc.

One neat thing however is that the editor observes the source code of the editor-template project and hot-reloads it when changes were made. You can test that by adding something like this to the end of startApp() method under kool-editor-template/commonMain/.../App.kt:

(scenes[0].children[0] as Mesh).shader = KslPbrShader { color { constColor(Color.RED) } }

When the editor is running and you change the color in IntelliJ and go back to the editor it should recompile the template-project and change the color of the cube without restarting the editor (takes one second or so). The goal I'm aiming for is a Unity-like workflow where you can edit 3d stuff in the editor window and edit your game logic in code in IntelliJ and see immediate results in the editor window without having to restart the application.

Protoxy22 commented 1 year ago

Excellent as usual, thank you for your explanations !