Sprites

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andrew Davie

A long time ago, Konstantinos Giamalidis [@TIX on AtariAge] did an awesome sprite set for Wen Hop?
Remarkably good, actually. I was really surprised at the fluidity of the animations, and his ability to stick to the requirements. Still very much appreciated.

Anyway, I had some/most of his sprites disabled in the original Wen Hop, due to space constraints. Now with CDFJ+ I'm able to enable all the sprites. I don't have them installed as animations yet, but I do have all the data in pretty good shape.

The recent "emoji" comments have been most useful here - providing an in-source-code graphical representations of the sprites. But also, AI to the rescue - I asked for a tool that would parse the arrays and produce the graphical comment for me. Furthermore, I asked the AI tool to mark the centerpoint with a red dot - parsing this data from bytes 2 and 3 of the array...


So, what's the point of the centerpoint?  It's the "locked pixel" representing the pixel which is always displayed at the (x,y) coordinate of the sprite.  So, basically, the graphics for each frame put this center point at the same point onscreen, no matter what frame is being displayed.  It makes getting the animations looking good very easy - even if the sprite itself is shifted around in the data.

Just a comment on the Claude AI/tool.  It's astounding, really. In the past few days I've just asked for a tool, described concisely what I wanted, and given some sample data arrays. And out comes a working tool.  Just recently, when putting all of Konstantinos's frames in I grabbed an old commented-out block which had many duplicates (over the years cut/paste/copy/comment-out/duplicate etc), and variable naming. I ended up with 89 frames in the list, many duplicates. I wanted to remove the duplicates.

So, I started with the first frame in the left split view in the editor.  Then I scrolled down in the right split-view to eyeball any frames that were duplicates. Remove the duplicates, then do the next frame in the left view. And I though "mmh, maybe I can automate this".  So I asked Claude AI - and it took a couple of minutes to deliver a tool that identified all duplicates - correctly - and I just removed those and job done.  Probably saved me well over an hour of work, right then and there. It's astounding, really.

The c file with all the sprite shapes (and the pretty graphics!) is attached.

Andrew Davie

So here's a video of using the sprite array parsing tool.
Here I change the 1st byte (sprite height) to something incorrect.
I also play with the (x,y) of the center point (bytes 2,3).
You see I then go to the terminal window below and run the tool.

It corrects the sprite height, and puts the red dot where the centerpoint is.
Pretty cool cookies!  Makes getting the centerpoint exactly right very simple!
And, I'll never have an incorrect height value.



Andrew Davie

#2
I'm adding a couple of frames for "pickup", and was struggling to get the colours consistent. Colours are hand-added to the source-code; one colour per sprite per line.  I thought, since I already have a tool to draw a pretty emoji version of the data, why not have the tool add colour, too.

So, of course, I asked Claude.


Quotemodify tools/sprite_vis.py. It currently creates a visual emoji version of frames. The solid pixels are yellow;  I want to change the colour (an emoji square still) based on the suffix after the sprite data.  The suffix is a 4 character code for colour, being the following...

    NONE = 0x00,
    BONE = 0x08,
    HMT0 = 0x09,
    HMT1 = 0x0A,
    HMT2 = 0x0B,
    HMT3 = 0x0C,
    BDY0 = 0x0D,
    BDY1 = 0x0E,
    BDY2 = 0x0F,

Choose an emoji square colour (NONE=black) re-using colours if needed.

That was all it took. Remarkable. Here's the response.

Quotesprite_vis.py now colours "on" pixels by the trailing colour-code argument instead of hardcoding yellow:

NONE → ⬛ (black — invisible against background, as requested)
BONE → ⬜
HMT0 → 🟥, HMT1 → 🟧, HMT2 → 🟨, HMT3 → 🟩
BDY0 → 🟦, BDY1 → 🟪, BDY2 → 🟫

For TWO(a, b, c, d) rows, the left 8 columns use colour c and the right 8 use d (matching the macro's own pairing). ONE(a, b) rows use b for all 8 columns. Ran it on sprites.c — verified against the raw TWO/BDY0/BONE/HMT calls in the file, and confirmed the tool is idempotent (re-running produces byte-identical output).
Also caught and fixed a pre-existing bug: PADDING_ROW_RE (used to strip old generated rows on re-run) was matching a stale set of emoji that no padding row ever actually contained, so re-running the script on any sprite with rows outside its visible bounds would duplicate the padding/border comments instead of replacing them. Fixed it to match the real markers (🟢 centre, ❌ out-of-bounds).

Images show examples of the result. Note: the colours shown are not the colours used - they are merely to show DIFFERENCES in colour usage in the frame!

Andrew Davie

#3
Now I can easily see, in the example shown, that I can shift the whole sprite pair one pixel left, allowing the right-side of the helmet glass to be coloured the same as the left - and the pick/axe will be independently coloured (being the 2nd sprite, rightmost 8 pixels).

Compare this image with the one in the prior message.