Making a 1-bit game engine

ftech

New Tinkerer
Mar 31, 2025
9
16
3
A few months ago, while learning C to make applications for my Mac SE, I was challenged by my son to make a cool game that would work on those old 68k compact Macs.
I took the challenge but without knowing what sort of game I would make. Therefore, I started by understanding the concept of sprites; how to animate them, how to move them around. Then, I tried to understand collisions, then I realized that the my code would require a lot of optimizations in order to run correctly on a 68000 Mac. Therefore, from solving one problem to another and still having no clue about what my game would be, I ended up building a game engine which I called ClassicSprite and which I am releasing under a GPL v3 free software license.

It is still a work in progress and I still don't know the best way to publish the code, but I wanted to share a quick demo of a dummy game (an intro and 2 levels) I made with it. I worked very hard on speed optimizations. When launching, the engine pre-calculates as much data as it can to help improve performances (especially movement curves). Although the video shows it running on an SE/30 (my SE is not operational at the moment), the speed is the same on the SE.

So far the engine can handle:
- Sprite animations through sprite-sheets (loaded in the rsrc file)
- Sprite movements with built in easing curves (linear, sine, bounce, elastic...)
- Sprite Z position (automatically calculated for RPG levels)
- Forces (currently only gravitation)
- Collisions
- Events with callbacks for movements, animations and collisions
- Tiles to build the background
- Levels
- Visual helpers to help debug show collision areas
- A profiler showing FPS and memory state

In the future I plan to implement:
- Moving tiles
- Background scrolling
- Using the alternate screen when available (to optimize speed for background scrolling)
- Mouse drag and drop
- More forces (magnetic field)
- Audio


 

ftech

New Tinkerer
Mar 31, 2025
9
16
3
Thanks @JDW ! I will see how to publish the source code. It is a bit messy at the moment. I have a folder for the actual source files next to a THINK C 5 project and a CodeWarrior Pro 5 project in their own folders. This way, I keep making sure that the engine works from System 6 all the way up to MacOS 9 on PPC. I have also successfully tested this demo on A/UX 3! :)
 
  • Like
  • Wow
Reactions: Eric's Edge and JDW

eric

Administrator
Staff member
Sep 2, 2021
1,111
1,834
113
MN
bluescsi.com
Fun to see more new games come out for the classic mac!

Looks like you're pretty familiar (modern?) game dev? What were your biggest challenges working in classic mac/toolbox/etc?
 
  • Like
Reactions: JDW

ftech

New Tinkerer
Mar 31, 2025
9
16
3
I am a graphics designer and I like to play with my old Macs to make drawings and animations. I am new to game design and I discover the joy of making sprites as well as pixel art in general. I have worked as a software developer 20 years ago so I have some knowledge in this area. However, I am new to the Macintosh Toolbox and I discover how fun it is! :)

The most challenging thing was to find documentation. I found this forum (and some of your posts @eric) while searching for code examples. That helped me getting started. I also got myself the Inside Macintosh books. The next challenge was to optimize the logic so that it has the right balance between memory consumption (caching data) and speed. I made sure that any floating point operation is made before the game starts. I also try to do as less CopyBits as possible. I know there are ways to optimize the code even more (like with the alternate screen hack) but I still have to learn those things.

By the way @eric are there any guidelines out there about code syntax and code publishing? I would like to make this project a collaborative effort if anyone is interested.
 
  • Like
Reactions: JDW

eric

Administrator
Staff member
Sep 2, 2021
1,111
1,834
113
MN
bluescsi.com
Ya it's hard to find code examples. Old usenet posts and MacTech are great resources too. AI can sometimes help explanations but sometimes tries to use too new of API's.

Biggest part is understanding the lingo - they talked differently back then about systems and when we read it 30-40 years later the meanings behind common abbreviations, slang, references is lost.

I use Amend/AmendHub for sharing. Github is fine too but line endings/encoding/etc.
 

Mu0n

Active Tinkerer
Oct 29, 2021
644
604
93
Quebec
www.youtube.com
Thanks @JDW ! I will see how to publish the source code. It is a bit messy at the moment. I have a folder for the actual source files next to a THINK C 5 project and a CodeWarrior Pro 5 project in their own folders. This way, I keep making sure that the engine works from System 6 all the way up to MacOS 9 on PPC. I have also successfully tested this demo on A/UX 3! :)

Very cool to see more C development for old Macs. I have a long term goal of developing games for my Mac Plus as well and I've taken a long winded path as well, collecting tech demos along the way.

I also went into rabbit holes with sprite animation and background preserving and I agree that it's pretty hard to vanquish in all areas.
For the past year, though, I've made a lot of progress understand MIDI and pairing it with 20 year old code of mine that uses the Sound Driver.

You seem to be on solid ground on the graphical side. I would love to help you with audio and offer whatever I have. Here's a repo that I started this year where I just stashed disjointed code from the last 20 years https://github.com/Mu0n/1bitdreammachine

 
  • Love
Reactions: ftech and JDW

Eric's Edge

Tinkerer
Oct 31, 2021
128
95
28
This is so awesome! I am currently building some tools in C for HyperCard. And look forward to learning more for classic game development.
 
  • Like
Reactions: JDW

ftech

New Tinkerer
Mar 31, 2025
9
16
3
Thanks for your comment @Mu0n ! I really like what you are doing with audio and I believe that your project is as advanced on the audio side as mine on the graphics side. If we mix both projects we could have something pretty nice at the end. I will try to publish my code some time this week. I have used Amend for backuping my work so I guess AmendHub is a nice place to start. I'll keep you updated here.