Page 1 of 1

8-Bit Pet Wurm

Posted: Thu Oct 17, 2024 6:04 am
by voidstar
Concept demo featuring the interactive 8-Bit Worm: he's 8-pixels long!

Turn by press LEFT/RIGHT, and can also speed up a little bit by pressing the UP arrow.

Uses the approach discussed here: (dynamic background)
viewtopic.php?t=7947
but uses the scaling registers to operate effectively at 160x82 (could have used 160x80, was just experimenting)

For a little fun, just hold down LEFT or RIGHT arrow to spin in a circle and see which way you end up launching.

One major thing I learned in this: I think there is a bug in cc65's handling of the unsigned long type. I had trouble storing the 3-bytes of the clock into a native long type (I think the operator = assignment is faulty, for the long type). This caused trouble when doing "delta time" checks. I worked around it by not using operator= and just poke-copy the values myself. But also then I realized for my purposes, I can just use 2-bytes of the clock anyway (actually even 1-byte would be sufficient).

Also learned that time(0) call doesn't seem to work in cc65 - but the rand() call does work (just init with srand using your own clock call, as done here).

The attached ZIP file contains the C source code (cc65). But the PRG itself is standalone and can run on its own.

Could probably evolve this into a two-player Tron-cycle game (and using 8-direction rather than the classic 4-direction only). Keep the cycle as 2 or 3 pixel, and etch the path into the background - think there is performance there for it (with a full colored background, not just black screen).

Try It Now!


8BITWORM.PRG
(7.39 KiB) Downloaded 44 times

Re: 8-Bit Worm (demo)

Posted: Wed Oct 23, 2024 5:41 am
by voidstar
Minor revision:
- to show how to adjust palette colors with some POKE's
- unrolled some loops for a little better performance
- worm now meanders on its own (unless you press the up arrow to go turbo-mode)
- adjust to 160x80, just showing how it's easy to scale the "engine" to different sizes

cc65 C-source code in the SRC.ZIP (and sample batch file to get it compiling)

EDIT: fixed the PRG and ZIPs, had earlier version by mistake. Keeping this separate to incrementally show the difference. Guess this might be in the category of "screen saver" of sorts.

EDIT2: I just noticed - it seems the web emulator TryItNow, the srand random seed isn't working (gets same pattern every time). But it is working on the desktop emulator version. Hmm, it's just using the lower two bytes of a call to $FFDE

Try It Now!
8bitworm.jpg
8bitworm.jpg (305.62 KiB) Viewed 744 times

Re: 8-Bit Worm (demo)

Posted: Wed Oct 23, 2024 4:06 pm
by desertfish
since the update I can't seem to control the Wurm anymore using the keyboard? (web emulator)

Re: 8-Bit Worm (demo)

Posted: Thu Oct 24, 2024 2:14 am
by voidstar
dang, nice catch! Ok - have an update coming, with a big surprise!

(and I'm gonna change it to Wurm -- so the internet doesn't confuse with some other nefarious worm ^.^ )

Re: 8-Bit Wurm

Posted: Thu Oct 24, 2024 3:48 am
by voidstar
The 8-Bit Pet Wurm from Planet Xiphod. Named due to looking like pixels of a famous retro computer from the 21st century Earth. Xenobiologist suggests there is evidence that these are ancestors to the Shai-Hulud, but at a micro-computer scale.

A force field perimeter prevents the Wurm from escaping. While mostly harmless, escaped Wurms have been known to slightly corrupted VRAM. Discovered in a shoebox at an abandoned Xiphodian outpost, the following Instructions-For-Care have been translated:

- Eats crumpled polystyrene chunks (left click to drop some, right click to pick it up)
- Responds to silly facial expressions (left arrow to turn left, right arrow to turn right, up arrow to go fast)
- When ignored, does its own thing (after 3 seconds of no commands, goes into cruise-control mode)
- Excited by loud "volume" (mouse wheel up to increase the wiggle-ness factor, mouse wheel down a lot to just bounce around straightly) [ memo: Jennifer believes the word "volume" has been incorrectly translated, and that increased wiggle-ness is a fear response, but nobody is really sure - after a while, the Wurm will go back to its normal less-wiggly motion on its own ]
- Never gets full. (apparently this means this critter can eat indefinitely)
- "Do not thump the box" - nobody is entirely sure what this means (the translation accuracy of Hoshi Sato was always questionable)
- Wurm excrement is non-toxic, but do not eat.

NOTE: Due to a natural repulsion effect, the Styrofoam chunks won't stick next to the perimeter field. You can still encircle the wurm, but it is very sly and will inevitably eat his way out. Scientists believe this creature actually eats using the tip of its tail.

REMINDER: In the emulator (including the web emulator) use CTRL+M to better enable mouse control. <<<<<<
Try It Now!

Re: 8-Bit Pet Wurm

Posted: Thu Oct 24, 2024 9:38 pm
by desertfish
Haha you actually called it wurm :lol:

Re: 8-Bit Pet Wurm

Posted: Sun Nov 03, 2024 4:42 am
by voidstar
In-game graphics may vary.
_8572802a-9c49-4618-83ae-040e1f48cdd3.jpg
_8572802a-9c49-4618-83ae-040e1f48cdd3.jpg (197.93 KiB) Viewed 294 times

Re: 8-Bit Pet Wurm

Posted: Mon Nov 04, 2024 8:37 pm
by kelli217
voidstar wrote: Sun Nov 03, 2024 4:42 am In-game graphics may vary.

_8572802a-9c49-4618-83ae-040e1f48cdd3.jpg
And it only took the power of 200,000 X16s to generate that! 😝

Re: 8-Bit Pet Wurm

Posted: Wed Nov 06, 2024 6:19 am
by mortarm
voidstar wrote: Sun Nov 03, 2024 4:42 am In-game graphics may vary.

_8572802a-9c49-4618-83ae-040e1f48cdd3.jpg
AWWWWW! :D