C Graphics Library for the X16

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
User avatar
Dr.J
Posts: 13
Joined: Sun Dec 24, 2023 12:16 am
Location: United States
Contact:

C Graphics Library for the X16

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

Re: C Graphics Library for the X16

Post by mortarm »

Hey, anything that helps the development process is certainly welcome in my book.
User avatar
JimmyDansbo
Posts: 450
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

Re: C Graphics Library for the X16

Post 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
Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
User avatar
Dr.J
Posts: 13
Joined: Sun Dec 24, 2023 12:16 am
Location: United States
Contact:

Re: C Graphics Library for the X16

Post 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!
Post Reply