Oct 24 2010
More comic generation work, finally
I’ve spent the last few days heavily reworking my comic book generation code in order to finally get over some of my conceptual and logistical humps. I’m not yet at the stage where I have redone all my undoing, ie I’ve taken the entire contents of the cupboard and spread it out across the floor in order to tidy up. :-) So it doesn’t compile at the moment.
Placing speech bubbles has always been the nub of this program and one that I’ve never satisfactorily solved. Last time I tried simulated annealing but was never able to come up with good heuristics to guide the evolution of a solution. I’ve still got the code, so I may experiment with it in the future if I have the inclination.
The current angle of attack is more straightforward. Speech bubbles can be placed at any point along a set of “arms” which emanate from the character. (I was actually thinking about the clip clock we have on our kitchen wall when I imagined this.) For simplicity’s sake the arms are the four compass points and their intermediate diagonals.
I’m then just searching through each speaker’s arms for the first valid position and trying again with the next speaker until all the elements in the panel are done. If at any point we can’t place an element I’m just backtracking: depth-first search on element positions.
I haven’t got to the stage where I can see output from this approach but there will inevitably be problems. The most obvious at the moment is that the search stops when all elements can be placed, rather than being in their optimal positions. As always it comes down to the thorny problem of teaching the computer what “optimal positioning of speech bubbles” actually means. And sadly I don’t have an answer, though every new approach I take results in some interesting ideas. This is inevitably what happens when you try to automate artistic judgement.
For now I will follow the worse-is-better dictum and stop fiddling with speech placement until the rest of it is in place. I’m currently looking at the next stage in the pipeline, putting the graphics together. As with all things graphics-related there’s a lot of fiddling with co-ordinates and printing out (x,y) values and munging in order that various primitives (drawing ellipses, rectangles, text) all work off the same origin. Hopefully I’ll soon have some clean abstraction so that the elements I want will be drawn where I want them. Til next time!
Comments Off

