Canvases, Games, and the Future Thereof
As an update to yesterday's post, two items of interest in the vector graphics rendering performance vein: Karl Lattimer (of gnome-system-monitor) reports a similar class of problem with rendering the hardware graphs, Ars Technica reports on GTK+ efforts to come up with a future vision of the toolkit that addresses the need for animation.
The Short Term
I will implement the trivial block-moving invalidation algorithm discussed yesterday. It's probably only 50 lines of code, or so. Hopefully, this will make it in to 2.22.2. So, that's the stop-gap measure that gives us the performance we need right now. However, this approach will not work with any kind of advanced animation. If we want pretty effects, we need a real canvas.
The Long Term
We need to decide if we want to adopt a canvas API in the 2.24-2.26 time frame so that we can start working on advanced animation effects. Alternatively, we can wait for GTK+ 3.0 which should provide the facilities that we need; there's no time frame for GTK+ 3.0.
The following canvas options are stable enough to consider for the 2.24-2.26 timeframe:
- Clutter+Cairo. Upsides: home-grown, good GTK+/GObject integration. Downsides: requires OpenGL hardware support
- Webkit. Upsides: very easy programming interface, Webkit's canvas performance is phenomenal, sets a precedent for merging web-based games with desktop UI, good documentation. Downsides: yet another set of languages to maintain in Gnome Games, large surface area
- QtGraphicsView+QtGTK+-MainLoop support. By this option, I mean a QtGraphicsView would be embedded in a GTK+ UI. As progressive as our community is, I don't think people are open-minded enough to consider this even an option. Maybe you'll all surprise me with your responses, though. Upsides: hardware acceleration when available, good fall-back software rendering mode. Downsides: a new, large external dependency.
I should note that a11y and i18n are not considered features since all of our strings are in the GTK+ UI which has nothing to do with the playing field.
The fourth option is to just sit on our hands and wait for GTK+ 3.0.
Still thinking about all of this. What do you guys think?