68k Source code available online for Megaroids ][?

Relating to a 68k application

Mu0n

Active Tinkerer
Oct 29, 2021
609
560
93
Quebec
www.youtube.com
The about screen in Megaroids is TANTALIZING:

1694664680866.png


This is a great promise to see the source code of a fluid, action oriented game, this can serve as a beacon of inspiration and teaching for would-be programmers of the platform. This in fact, was crucial for the developpers of "Continuum", another mac action game for b&w compact macs which you could easily sum up as "asteroids in a maze with gravity". They learned the structure and speed oriented tricks from the Megaroids source code. You can read about their recollection here:


The C compiler Megamax is trivial to get these days on Mac Garden: https://macintoshgarden.org/apps/megamax-c

However. I thought I remembered I saw the source code in digital format somewhere, but I can't readily find it.

But, I do own a programming book that has it listed ENTIRELY from p.279 to p.358, including super annoying to type hexadecimal data for some of the resources (sounds, graphics). Everything is in code, there's no need to get external files from a disk that you have to link to the project, it's all raw data! The book is "Programming C on the Macintosh" by Terry A. Ward, which I talk about a bit in my website Foray to 68000. https://mu0n.github.io/ForayInto68k/index.html

1694665058246.png

You can find a pdf of the book here:


CALL FOR HELP:
It would be cool if we could find it and put it in digital form, stored on archive.org. It's a cool little asteroid clone game, but it has worthwhile assembly routines where it has to count and a program structure in C to drive it all. It would also be fun to play around and mess with the parameters and get some variants going!

BUT WAIT, through the magic of OCR and PDFs, we can copy paste the code, barring some minimal mistakes that we correct along the way. Sample code test:

C:
main()
initialize
initgraf
initfonts
initwindows
initmenus
teinit
initdialogs
getpaintdo c

do (check menubar)
dowindowstuff
initialize
draw background
set regions
f Lush events
setupmenus
initcursor
set rectangle
set port
expandpic
update mywindow
if first invocation
initgamestuff
e x pan d_s ma L L de f
exp a nd_def
expand_bigdef
expand-ships
unload Cinitgamestuff)
do (main event Loop)
switch based on event
inmenubar: docommand
systemclick: return event record
if return value == game
game
check for primary screen
set free pointer Lists
initialize score
position ship in center of screen
initialize counters
do while (count OK and ships OK)
wait for start time
i n i t _m e t e o r s
erase_meteors
erase_fig <ship and alien ship)
erase_shots
erase_explosions
d r a w_e x p l o s i on s
draw_meteors
if (alien not present)
check for probability of occurrence
draw alien ship (random & position)
 

trag

Tinkerer
Oct 25, 2021
280
133
43
If this interests you, you might try to track down the author of Asterax. I guesss it's a later game, so maybe not interesting in the original 68000 sense, but it's fun and runs really well.
 

lobust

Tinkerer
Nov 14, 2021
51
34
18
If this interests you, you might try to track down the author of Asterax. I guesss it's a later game, so maybe not interesting in the original 68000 sense, but it's fun and runs really well.

Pretty sure asterax uses SAT doesn't it?

 
  • Like
Reactions: trag

lauland

New Tinkerer
Dec 12, 2023
30
20
8
Because the source code was available, someone gave a challenge to port Arashi to run on B&W machines like the SE/30. I took the challenge since I had a Mac Classic II (actually slower than an SE/30):

It was certainly a challenge, and you can read about my numerous missteps and fumbling above, but lots of fun.

I took it further and eventually got it running on MacPlus (actually an Amiga with AMax) with base 68000 and System 6...well...it RUNS, but it is too slow to actually play, more like a slideshow! It is just barely playable with a 14mhz '020 in my Amiga, but runs well on SE/30 and Classic II (except for higher levels when many enemies on screen).

I took the vector graphic engine and wrote QuickDraw versions to replace the assembly (which was strictly tied to 256 color framebuffers). This was just fast enough on '040's, but I ended up doing some tricky C to hit the framebuffer directly (1 bit or 8 bit, because 8 bit pixels are trivial to do). I eventually removed all reliance on '020 cpu and Color QuickDraw in rom to get it to run on the "MacPlus".