8-Bit Pet Wurm

Post Reply
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

8-Bit Pet Wurm

Post 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 49 times
Attachments
8BITWORM.ZIP
(291.59 KiB) Downloaded 69 times
8bitworm.jpg
8bitworm.jpg (305.34 KiB) Viewed 916 times
Last edited by voidstar on Thu Oct 24, 2024 3:56 am, edited 2 times in total.
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: 8-Bit Worm (demo)

Post 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 814 times
Attachments
8BITWORM2-SRC.ZIP
(8.96 KiB) Downloaded 51 times
8BITWORM2.ZIP
(295.43 KiB) Downloaded 53 times
8BITWORM2.PRG
(8.54 KiB) Downloaded 41 times
User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: 8-Bit Worm (demo)

Post by desertfish »

since the update I can't seem to control the Wurm anymore using the keyboard? (web emulator)
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: 8-Bit Worm (demo)

Post 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 ^.^ )
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: 8-Bit Wurm

Post 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!
Attachments
8bitwurm.jpg
8bitwurm.jpg (329.26 KiB) Viewed 706 times
8BITWURM.ZIP
(628.02 KiB) Downloaded 75 times
8BITWURM-SRC.ZIP
(10.08 KiB) Downloaded 44 times
8BITWURM.PRG
(9.05 KiB) Downloaded 42 times
Last edited by voidstar on Fri Oct 25, 2024 2:33 am, edited 3 times in total.
User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: 8-Bit Pet Wurm

Post by desertfish »

Haha you actually called it wurm :lol:
voidstar
Posts: 494
Joined: Thu Apr 15, 2021 8:05 am

Re: 8-Bit Pet Wurm

Post by voidstar »

In-game graphics may vary.
_8572802a-9c49-4618-83ae-040e1f48cdd3.jpg
_8572802a-9c49-4618-83ae-040e1f48cdd3.jpg (197.93 KiB) Viewed 364 times
kelli217
Posts: 531
Joined: Sun Jul 05, 2020 11:27 pm

Re: 8-Bit Pet Wurm

Post 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! 😝
mortarm
Posts: 299
Joined: Tue May 16, 2023 6:21 pm

Re: 8-Bit Pet Wurm

Post by mortarm »

voidstar wrote: Sun Nov 03, 2024 4:42 am In-game graphics may vary.

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