Anyone working on a game engine with Compose?
# compose
x
Anyone working on a game engine with Compose?
r
What kind of games do you have in mind? Compose and its APIs aren’t really designed for this use case. The canvas is hardware accelerated but probably not suited for most game types
x
Thinking 2D for now. What sort of limitations would one run into if they were to make a game engine on top of compose?
r
Custom shading is limited to recent versions of Android, you can’t really add any 3D effects. etc.
Which might be fine depending on what you want to do
I would add that the most important part of a game engine is not really the engine but the tools, and Compose has no tools to help you build a game. And given how many offerings there are out there in terms of good Open Source game engines with tools… 🙂
x
Yeah tooling is going to be non-existent 😅
l
Does korge have an Android version? If so, they may have bindings for compose.
x
it does - dont think they have compose bindings.
l
Does it use ANativeWindow then? If they used Android Compose, then I'm sure code could be copied.
a
Your best bet is probably to use an existing renderer and physics engine + write a custom applier for the two
d
Is anyone working on Compose with a game engine?
a
No, but I want to use it to create a scene graph for filament
r
I would love that 🙂
a
It's one of those things where I think lifecycle management gets complex when I started haha
(ideally everything would be a composable with its own composable scope)
r
Lots of
DisposableEffect
a
Yes, it did use it a lot
I think I got a black canvas to render with filament, but nothing else, yet
It's been a while since I touched that code
m
korge has been experimenting with compose with the approach mentioned in this thread of the custom applier. that said i asked and it doesn’t seem like this is a top priority vs other things on their list
they are active on discoord, not on slack anymore, so you could ask there
i think it would be amazing if there was some way to implement the window interface with a compose canvas or something like that. as of today what would be supported is to use a regular android view and embed it in your composition tree i think
there are also some examples online doing simple 2d games directly on canvas. writing a game loop using the monotonic clock is trivial but i think for real games one would have to write too much (ie: everything a real engine offers)
I think having something lightweight like they have in flutter with flame would be killer 🙂 Anyhow, happy to see examples or hear about how people are approaching this beyond drawing a couple of shapes on the canvas. 🙇
m
This example of Compose + Filament is relevant I feel: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1591839943061900
463 Views