Dynamic background without sprites

Talk about your programs in progress. Discuss how to implement features, etc.
Forum rules
This section is for testing Commander X16 programs and programs related to the CX16 for other platforms (compilers, data conversion tools, etc.)

Feel free to post works in progress, test builds, prototypes, and tech demos.

Finished works go in the Downloads category. Don't forget to add a hashtag (#) and the version number your program was meant to run on. (ie: #R41).
Post Reply
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Dynamic background without sprites

Post 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 531 times
Attachments
DYNBACK.ZIP
(2.98 KiB) Downloaded 20 times
DYNBACK.PRG
(5.1 KiB) Downloaded 41 times
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: Dynamic background without sprites

Post 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 418 times
Attachments
DYNBACK2.PRG
(4.93 KiB) Downloaded 23 times
DYNBACK2-SRC.ZIP
(69.05 KiB) Downloaded 33 times
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: Dynamic background without sprites

Post 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!
Attachments
DYNBACK3.jpg
DYNBACK3.jpg (147.92 KiB) Viewed 351 times
DYNBACK3.PRG
(7.84 KiB) Downloaded 21 times
DYNBACK3-SRC.ZIP
(145.37 KiB) Downloaded 44 times
Post Reply