Update: Part II is now available.
If one reads the Riven X project page, one can read “but I expect something barely playable in November”. Obviously, that’s not going to happen. Without going into boring details, let’s just say it’s been one hell of a semester.
So I thought I’d discuss a particular issue that’s been annoying me with Riven X: how to render a card. Specifically, how to efficiently render what needs to be rendered in a way that will yield the proper display order while allowing reasonably fast object rendering activation and deactivation.
Background theory
Essentially, Riven is made of stacks and cards. Just like in real-life, a stack contains multiple cards. But what does a card contain? Essentially, renderable objects: pictures, movies, sound effects. Obviously, sound effects are completely different from pictures and movies because they are strictly acoustic in nature. That leaves us to deal with pictures and movies as far as graphics are concerned. The biggest problem by far is to respect the display order. You see, initially a card is blank: it has no active renderable objects. But as scripts are executed in reaction to game state changes or user events, renderable objects start getting activated and deactivated. The rule of the game is then simple: whatever gets activated last is drawn on top of everything. In other words, you “pile things up” as you activate them. Deactivating an item means removing it from the stack while preserving the order of the other elements. We can make a simple diagram to illustrate this:

This seemingly simple problem has caused me more than one headache, and I’m still unsure the solution I settled upon will be satisfactory. Only sampling will tell, and I’m far from being able to do that. At this point, you may continue reading for details about potential solutions, or wait for my next entry which should be concerned with the solution I have chosen and the unavoidable reasons supporting that choice.