https://kotlinlang.org logo
#compose
Title
# compose
x

xxfast

02/15/2023, 10:15 PM
Anyone working on a game engine with Compose?
r

romainguy

02/15/2023, 10:20 PM
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

xxfast

02/15/2023, 10:22 PM
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

romainguy

02/15/2023, 10:23 PM
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

xxfast

02/15/2023, 10:26 PM
Yeah tooling is going to be non-existent 😅
l

Landry Norris

02/16/2023, 12:14 AM
Does korge have an Android version? If so, they may have bindings for compose.
x

xxfast

02/16/2023, 12:32 AM
it does - dont think they have compose bindings.
l

Landry Norris

02/16/2023, 12:38 AM
Does it use ANativeWindow then? If they used Android Compose, then I'm sure code could be copied.
a

andrew

02/16/2023, 1:03 AM
Your best bet is probably to use an existing renderer and physics engine + write a custom applier for the two
d

dewildte

02/17/2023, 6:44 PM
Is anyone working on Compose with a game engine?
a

andrew

02/17/2023, 7:07 PM
No, but I want to use it to create a scene graph for filament
r

romainguy

02/17/2023, 7:13 PM
I would love that 🙂
a

andrew

02/17/2023, 7:16 PM
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

romainguy

02/17/2023, 7:17 PM
Lots of
DisposableEffect
a

andrew

02/17/2023, 7:17 PM
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

Marc

02/20/2023, 7:59 AM
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

Marcin Wisniowski

02/20/2023, 11:25 AM
This example of Compose + Filament is relevant I feel: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1591839943061900
290 Views