Making a 1-bit game engine

feeef

6502
I am making a game engine for our old B&W Macs. I have posted the full story at Tinker different as it was my main source of inspiration for coding, but I thought I would post about it here too.

You can find the source code at https://gitlab.com/ftech31/classicsprite

It is still a work in progress and there is no documentation at this time. I plan to work on that as I move forward with finalizing the code structure and the syntax. The entire project is released under a free software licence so feel free to use, share, and modify as you wish! I learned a lot during the process so it can also be a source of code example for anyone who wants to learn how to program with 1-bit QuickDraw.

Here is a quick demo of a dummy game that I made with the engine:

 
I am mainly focusing on the graphics at the moment (I still have my mind in optimizing the frame rate) but sound is part of the plan. This project from @Mu0n seems quite advanced in term of sound. We may be able to merge efforts at some point.
 
Here's what I have:
-modal tunes that use the square wave synth in some very old project
-modal tunes that use the four-tone synth in some very old project
-real time manipulation of the wave shape buffer with the mouse for a four-tone synth while it plays
-MIDI in data coming from a piano controller, passing through a serial MIDI interface, and being dissected and correctly interpreted
-MIDI out data correctly dispatched out to an external midi module like the Roland Sound Canvas or Roland MT-32 or any module, of course
-Standard MIDI file opened, dissected and played back programmatically in C to that same midi interface. Basically I mimick what Space Quest III did for its intro sequence music or gameplay music.
-Link MIDI in to the four-tone synth for real time playback

Here's what I'll soon reach:
-use a MIDI in controller as a joystick just for fun
-Link MIDI in to the square wave synth
-Link MIDI in to the freeform synth and play instrument files from Studio Session at arbitrary note values
-Studio Session song file, played back in real time programmatically since it's just a notch more complicated than doing a standard midi file playback
-Use a standard midi file but dispatch it through a four-tone synth by focusing on 4 instruments at most for quick and dirty game music that doesn't require a hardware MIDI interface and a hardware MIDI module.
 
That's awesome @Mu0n ! When looking at your code, I realize that I should rethink my syntax. I am used to naming my function and variables in lower_case and instead, I should go for the camelCase syntax that is used in the entire Toolbox. That will look a lot cleaner.
 
Thanks a lot @maxoakland ! As I said in my previous message, I plan to refactor the syntax so it better aligns with the syntax of the Toolbox and existing libraries. I hope to do that soon when I have a bit more time for it, and I will try to come up with some documentation as well.
 
This is great to see, @feeef, and it’s clear this has been a labour of love. Having read your Tinker Different post as well, it’s impressive the amount of work you’ve gone to in order to familiarise yourself with the Mac Toolbox in purchasing the Inside Macintosh books, etc.

I’ve just started teaching myself C as an absolute beginner with the ultimate aim of trying to make a small game for classic Mac OS, so your efforts are inspirational.

In your research to learn how to code for classic Mac OS, did you come across the book “Tricks of the Mac Game Programming Gurus” by McCornack et al. (1995)? I own a copy and I’m hopeful it will be a useful resource. Also, I may have missed it, but did you work within THINK C or CodeWarrior? Cheers!
 
Thanks for the nice word @LazarusNine !

I have used quite some books but I did not come across this one. Is it available online? Do you have a link?
I have mainly relied on the Inside Macintosh books. I started by following the programming tutorials from Joshua Stein. Then, I looked for as many info and code examples that I could find. I also tried to get some help from AIs but this was not always useful as AIs tend to mix System 6 and System 7 APIs. You come up with non working code that is difficult to debug unless you are already familiar with the differences between those APIs.

Regarding the IDE, I used THINK C 5 on my Mac SE, as suggested by Joshua Stein. However, I also made my code to build on CodeWarrior so I could use on the big screen of my 9500 when I needed to do some refactoring that required scrolling through a lot of files. That said, for writing new code, I suggest working directly on the System 6 machine because you can easily end up with some code that works on the more modern OS (7, 8 or 9) and doesn't build on System 6. When that happens, you will lose more time debugging than you saved by writing on the newer machine. This happened to me once.

I look forward to seeing your game anyway! :)
 
Many thanks for those responses. It’s helpful to know what your setup and approach are, and the Joshua Stein videos seem like an excellent resource. I’ll keep an eye out on your development journey, and I hope your son is as impressed with your efforts as some of us are!

Here’s a link to the physical copy of the book I mentioned. It may be available in PDF, but I’m unsure:

I also saw that the accompanying CD is available on archive.org:
 
Last edited:
Back
Top