Hmm, this is going to be interesting, to say the least, but I don’t see any alternative at this point. We’ll have to find some way to pull this off. Here are some thoughts, organized as best as I can.
SCRIPTING
Adobe Flash Professional basically had all the vector items as “objects” that could be either manipulated via the IDE or modified via code on the timeline, in an object-oriented fashion. It sounds to me like layers behave very similarly. I’m wondering if we can accomplish something similar here.
Ratscript’s main feature is that it is a “runtime interpreted language.” The first step on that front would be to create a “script layer” in Synfig, which can have Ratscript code (or another language’s code, though I’ll refer to Ratscript exclusively herein for brevity) linked to the timeline, much like the sound layer. Thus, the code is actually stored in the Synfig document, and taken into account during rendering (see below.)
If Ratscript has programmatic access to the various other layers, it could be used to directly modify their properties. The main purpose of this is to change the vectors based on various conditions. Another role of Ratscript would be to change the flow of the timeline - stopping playback, jumping to a particular frame, etc. (Yoyobuae outlined both of these quite well, thank you.)
Ratscript’s runtime interpreted nature plays to our advantage. All we need is for an object to exist at the moment the script is scheduled to be executed in order for it to work, thus it should tie in quite nicely with the declarative structure.
EVENT LISTENERS
Runtime interactivity is a crucial aspect, otherwise we still only have a movie. GTK is almost entirely useless in this respect, as we actually need to be able to click, drag, and drop animatable objects, and have them respond based on that action. We also need the game to respond to keyboard events.
Somehow, I get the feeling this isn’t as hard as it sounds. If Synfig Core knows A) the position and size of every layer, and B) the position of the mouse cursor, it can mathematically determine mouse collision with an object.
Furthermore, runtime drag functionality can be duplicated by way of 1) detecting mouse collision with the object, 2) detecting a mouse down at that position, 3) calculating the distance from the cursor to the “registration point” of the object (the point that determines the object’s x/y position), and 4) moving the object to the mouse position, adjusting using the numbers from step 3.
Keyboard events are trivial, honestly. The only possible obstacle here is that we would need a text input object in Synfig Studio…but if we can modify any layer’s properties, we can certainly modify a text layer based on key presses.
RENDERING
On the topic of rendering, a strange thought…since this can render animations via Cairo, couldn’t we actually somehow generate code from a Synfig animation/project that could duplicate all of the vectors and their movement, seperately from Synfig, in a GTK/Cairo GUI? In other words, it renders at runtime.
Now, all that said, one other option (and probably an easier one) is to actually write a piece of software that renders synfig XML data, in the same manner that Synfig Studio does. Basically, we just need to give it the same specs that Synfig Studio has hard-coded in. This piece of software would essentially be to this as Flash Player is to Adobe Flash - it unpacks the file format and displays everything in the proper order.
I bring that up because my team would need SWF-like functionality.
GUI ADJUSTMENTS
As you mentioned, most of this makes more sense in the core. However, in order to make Synfig a viable game design tool, it would need the scripting tools built into the GUI. Again, I know GTK fairly well - that’s my company’s go-to GUI toolkit - and we’ve been working with Flash Professional long enough to know what works well in that context, and what is simply a pain in the rear.
The GUI features for scripting, of course, should not interfere with the animation workflow in any way.
MY BACKGROUND
I should note a little bit about my background with game design. I have been custom-building a lot of these features (such as drag-and-drop, movement, and animation) in various languages and GUI toolkits, including Visual Basic/WinForms (that was not fun), Python/wxWidgets, Python/PyGTK, and Adobe Flash (they don’t have everything prebuilt). Thus, I think all of the above is doable, as long as the plan is tailored around how Synfig is already build.
By the by, XML is my favorite file format, bar none.