Page 1 of 1

C Graphics Library for the X16

Posted: Sun Jan 14, 2024 3:44 pm
by Dr.J
Since I learned about the X16 about 1-2 months ago, I've been enthusiastically diving into the world of retro game development on this awesome system.

The existence of the cc65 compiler that specifically supports the X16 has been a godsend, because for the purposes of faster development given my somewhat limited time, being able to develop in C rather than hand-crafted assembly is really a game-changer in terms of making development feasible.

Likewise, the ZSound library also makes a huge difference in terms of being able to pursue X16 game development -- I've never done any kind of sound programming at all, and trying to learn that and development on 80s hardware at the same time probably would have been too great a task. Huge thanks to ZeroByteOrg for having rendered that a non-issue with ZSound.

Even with all that, constantly trying to manually juggle moving things around in memory, controlling all the sprite and tile parameters, etc., is an inefficient and error-prone way to develop -- so I've been working on my own C graphics library to act as an abstraction layer and make it a lot easier to interact with the VERA, VRAM, high-RAM, and just deal with graphics in general. I've got working functionality for:

-A file format for defining animated sprites and parser for same;
-Struct and functions to simplify rendering animated sprites;
-A function for grabbing "chunks" of graphical data out of high-RAM and copying into VRAM, so you can have a bunch of images encoded in a single file, put them in a bank of high-RAM, and copy the parts you need into VRAM;
-A custom text display system with a Sega Genesis-font-like character set, ability to display strings anywhere onscreen, and support for a "typewriter text" effect (i.e. displaying strings character-by-character instead of all at once);
-Some functions and macros to simplify input checking that's useful in games (not just checking if a button is pressed, but if it has just been pressed and then released; i.e. is a falling edge).

This functionality has all been tested and working. It's not quite in shape to share publicly yet -- it needs some clean-up to be broadly useful to other people -- but if there is interest, I'd certainly be willing to share it. Even more importantly (for my own purposes), having this functionality complete is going to greatly speed up and simplify the process of making some actual games, the starting of which is the next step.

I'm also putting together a video devlog chronicling my experiences with game development on the X16. I've posted the first video. The first one is basically just an introduction, but more videos are coming and will get into deeper detail on the development of this library and then some actual games.

It's here if anyone is interested: https://www.youtube.com/watch?v=ntGPAemAkcA

Dr.J

Re: C Graphics Library for the X16

Posted: Mon Jan 15, 2024 7:08 am
by mortarm
Hey, anything that helps the development process is certainly welcome in my book.

Re: C Graphics Library for the X16

Posted: Mon Jan 15, 2024 8:43 am
by JimmyDansbo
I am looking forward to following your videos.

As far as I know, the zsound is no longer actively maintained. I would like to point you to the zsmkit by MooingLemur instead - https://github.com/mooinglemur/zsmkit

Re: C Graphics Library for the X16

Posted: Tue Jan 16, 2024 9:37 pm
by Dr.J
JimmyDansbo wrote: Mon Jan 15, 2024 8:43 am I am looking forward to following your videos.

As far as I know, the zsound is no longer actively maintained. I would like to point you to the zsmkit by MooingLemur instead - https://github.com/mooinglemur/zsmkit
Thanks for the heads up, I will certainly give it a look!