bryanedds / Nu

Repository hosting the open-source Nu Game Engine and related projects.
MIT License
1.1k stars 155 forks source link

Live2D Cubism integration in Nu. #615

Open bryanedds opened 10 months ago

bryanedds commented 10 months ago

@reinux is looking into integrating this into Nu.

I think it should be workable given its SDK's C-based API along with a .NET wrapper generator, or perhaps even with a manually created .NET wrapper.

Here's some imgui code with whose usage pattern should be similar -

https://github.com/bryanedds/Nu/blob/12ac13cb840b3661b9c48a1ac0c5e0d1dd401699/Nu/Nu/World/WorldModule2.fs#L1290-L1297

https://github.com/bryanedds/Nu/blob/12ac13cb840b3661b9c48a1ac0c5e0d1dd401699/Nu/Nu/Render/RenderImGui.fs

Presumably we can offer a higher level way for Live2D to send its verts and indices info to both the 2D and 3D rendered via user-callable messages so that we don't need to integrate Live2D too deeply in the engine. But we'll have to look at that level of detail when we get there.

bryanedds commented 10 months ago

Discussion from discord - @dump - as far as implementing Live2d integration, you should start by inheriting from an EntityDispatcher rather than a Facet. It needs to be a specific character controller like thing similar to SideViewCharacterDispatcher. The workflow intends people to start with dispatchers then only refactoring the truly reusable stuff to facets when the time comes. If you try to start with a facet, I fear you will try to be too general and not really make something definite enough to be usable. so something like SideViewCharacterLive2dDispatcher might be a good way to start. like SideViewCharacterDispatcher, it's based on a capsule physics body and plays walk and jump animations depending on velocity and touchingGround states. this makes sense? i would presume the built-in live2d 'models' will come with side view walk cycles at a minimum so it would just be a matter of hooking that up based on the same sort of velocity and touchingGround states as SideViewCharacterDispatcher uses

reinux commented 10 months ago
reinux commented 10 months ago

A couple more Live2D marketplaces: Skima Nizima

bryanedds commented 10 months ago

New cubism branch with stubbed types / functions here - https://github.com/bryanedds/Nu/tree/cubism