Page 1 of 1

Dynamic background without sprites

Posted: Wed Sep 18, 2024 6:37 am
by voidstar
This is an experiment where I borrowed the animation-process I used in DestinyHunter (text-mode for the PET), to see how well it scaled to graphics mode and 8MHz. I want to be able to dynamically (or programmatically) draw shapes and animate them across a mixed-color background, without using sprites.

So this initial demo does that, it both dynamically alters the color and shape of an object that you can move around using the arrow keys. The shapes doesn't have to be square dimensions.

Code was done using cc65 with a bit of inline assembly. Will share it after cleaning up a bit more.

Try It Now!
DYNBACK.jpg
DYNBACK.jpg (55.83 KiB) Viewed 478 times

Re: Dynamic background without sprites

Posted: Thu Sep 19, 2024 4:21 am
by voidstar
Updated:

- Increased from 160x50 to 252x100 (notice the PRG is smaller than before, removed memset call)
- Can now use the mouse (left click to "etch" into the background, i.e. user can dynamically impact the background)
- An additional dynamic image appears when pressing mouse buttons (gets larger the more buttons you press)
- Can still move the original object (arrow keys) and "etch" while pressing buttons

Kept col/row under 255 for now to try to stick with 8-bit maths, but including the PRG itself this is probably close to maxing out the ~32K LoRAM. Performance isn't too bad, might be able to make something with it (like the object could leave trails into the background, like footsteps or snail trail). Or maybe little effects like water ripples, smoke, background birds (without costing a sprite index).

cc65 / C-source is in the ZIP. Might be interesting to see a comparable port to prog8, nxtBasic, etc. (for both performance and code size)

(remember to use CTRL+M in the emulator to better align your host mouse with the emulator mouse cursor)
Try It Now!
DYNBACK2.jpg
DYNBACK2.jpg (120.73 KiB) Viewed 365 times

Re: Dynamic background without sprites

Posted: Fri Sep 20, 2024 5:24 am
by voidstar
Ha, still rough, but the concept is working: use the arrow keys to drive the tank around.
(left/right to turn, up/down for forward/back)



Uses no sprites and no floating point, still a self contained PRG.
cc65 C source in the zip archive.

Try It Now!