[Kde-games-devel] Kapman sprite system (also, connecting-tiles systems)

Matthew Woehlke mw_triad at users.sourceforge.net
Wed Dec 10 05:28:49 CET 2008


Ok, so in fiddling with Kapman graphics, I ran into some problems with 
the sprite system, mostly in the set of assumptions it makes (only one 
enemy graphic, number of animation frames or lack thereof), and the 
kdegames-wide item that has been the bane of my existence since 4.0, 
requiring every bloody thing to have an id.

So I came up with an action plan (README, attached), and applied it to 
the "simple" theme I am working on and will probably use as fodder to 
implement this and the tile system.

Let me say it again. I *hate* assigning id's to every blody thing. I 
also hate having to group, and I really, *REALLY* hate having to make 
invisible objects so that id'd things are the right size. As you'll no 
doubt see from the attached svg's, I very much prefer defining elements 
based on their position in the document. It's much easier (easier to 
make, easier to edit, leads to neater svg's, no invisible objects, no 
need to group)... and even allows tricks like frame re-use (check out 
where the second four of eight frames for the blink animation are ;-) ). 
Not to mention that for the enemies I have 22 id'd objects versus 80 I'd 
need otherwise (and for the player, I'd otherwise need 36, and I have a 
whole *2*).

Anyway, one question is obviously if I can convince people to see the 
light in this respect :-).

The other big question is on the animation system itself, if it looks 
sane, etc. Most of it is described in the README (which is written to 
describe the whole theme but is incomplete at the moment). Basically, 
it's magic-id to identify each sprite or block of sprites, with 
additional magic id's to give the animation parameters and other hints. 
Plus one magic id gives the size scale for everything. Obviously the 
colors aren't important, but I've consistently used blue for block 
identifiers, green for art hints (only one), and magenta for animation 
hints. And red for the scale-indicator.

I'm also throwing in the wall tiles for this theme so y'all can have a 
look at that. Seeing as how the tiles in this theme are all symmetrical 
(i.e. you could reduce them by around 65-75% by rotating/flipping) it's 
not a great example, but it should be fairly obvious where more 
complicated tiles would tend toward each tile being more distinctive. 
Anyway, it's using the same basic system, which is two id'd elements to 
give the tile size and spacing, one id'd element to give the tile 
system, and the rest needs no grouping, id's, or invisible elements.

So... thoughts? Especially from Thomas and/or Pierre-Benoit? It's a 
decent amount of work but will *really* open up new theming possibilities.

Implementation-wise, the first thing I plan on writing is obviously a 
class to import multiple frames from a so-laid-out SVG; this will be 
used both for the sprites and also the wall tiles. Then comes tile 
logic... :-) I'm not sure if I'll want to tackle improving the animation 
system or tying in a tile engine first; both are not changes to be made 
while in freeze. (Maybe I should start a work branch in playground?)

(And yes, I do have theme ideas that would use everything described in 
the README.)

-- 
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
-- 
You are in a meadow. A huge red dragon stands before you.
 > FIGHT DRAGON
With what? You don't have any weapons.
 > RUN AWAY
You wisely exercise the better part of valor.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: README
Url: http://mail.kde.org/pipermail/kde-games-devel/attachments/20081209/5bfe47d7/attachment-0001.bat 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sprites.svgz
Type: image/svg+xml-compressed
Size: 16778 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20081209/5bfe47d7/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wall.svgz
Type: image/svg+xml-compressed
Size: 4311 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20081209/5bfe47d7/attachment-0003.bin 


More information about the kde-games-devel mailing list