REGULAR FEATURE
Database Delphi
by Matthew J.W. Ratcliff
Can you create a fast arcade game with C? Which is the preferred C development package for the ST? See what the experts have to say.
To C or not to C…
From: JUANSTXE (Juan Bravo)
To: MATRAT (Matthew J. W. Ratcliff)
Do you think C is powerful enough to produce a fast arcadelike game with over thirty sprites at the same time—without using machine language subroutines? I'm working on a "home-brew" version of the popular arcade game Gauntlet, and trying to capture the look and "feel" of the arcade original.
From: MATRAT
To: JUANSTXE
If your code is still on paper, you have a long way to go before you get something working on the ST—unless you're talking about C on the 8-bit. No high-level language is practical for the 6502 machine when it comes to something as huge and complicated as a full-blown video game.
On the ST, the 68000 microprocessor was designed to suit the UNIX/C philosophy. Yes, you can write a fast game in C on the ST, but you can write a faster one in assembly. How much faster? It depends on your programming talents.
A great C programmer might be able to write programs that run ten times faster than a sloppy assembly language programmer. I subscribe to the common belief that 90 percent of the time your program is running 10 percent of the total program (the low-level screen I/O drivers, for example).
What you do is write it all in C, get it debugged and working flawlessly, then sit back and play it. Let your friends play it. Got feedback as to what's too slow and figure out how to speed it up. You then rewrite those sections of code in assembly, about 10 percent rewrite, not 100 percent assembly—and you end up with the same result with a lot less effort. Megamax C has an ASM directive, allowing you to drop into 68000 assembly any time you like, then immediately switch back to C. The benefits can be phenomenal.
C compilers.
Are you still unsure about which C compiler is best for you? So was ATARI-FLASH (Stephen G. Roquemore), until he started asking around Delphi. Below are the pros and cons of the top three C compilers for the ST.
From: ATARIFLASH
To: CFJ (Charles F. Johnson)
I'm seeking advice on which C compiler to buy. I have pretty much narrowed my choices to Megamax and Mark Williams C, with Lattice a distant third. Can you offer any advice?
From: CFJ
To: ATARIFLASH
I have the Megamax C package, and when I program in C (I still do most of my work in assembly), I like it a lot. Megamax is very fast, and the included shell makes it relatively painless to get through the edit, compile and link procedure. I personally haven't tried Mark Williams C, but the impression I have is that it's a very nice package, perhaps not as friendly as Megamax, however.
From: MATRAT
To: ATARIFLASH
CFJ is an assembly genius when it comes to programming the ST, but uses Megamax when he does do C work. I have Megamax and just love it. The development environment is excellent, the compiler is fast. The editor stinks, but you can always use MicroEMACS or any word processor (which can output your files as ASCII only). When I have a lot of "surgery" to do on some code, or cutting and pasting of routines between programs, I'll often use Word Writer for those tasks.
Mark Williams C has a much better and faster floating point than does Megamax; that's why Tom Hudson switched over to it for his latest version of CAD 3D, 2.0. But it comes on four (count them four) disks. Tom tells me that it just isn't practical to use it without a hard drive under you. Megamax fits on a single floppy.
If you plan to do a lot of serious floating-point software development, MWC may be the better choice. But, I think that Megamax is the best choice otherwise.
From: DLM (Daniel L. Moore)
To: ATARIFLASH
If you don't have a hard drive get Megamax. Mark Williams C is huge and really slow without a hard drive and a large RAMdisk. Megamax runs well on a DS/DD floppy, although that doesn't leave much room for source code. If you don't have a second floppy, a RAMdisk—even a small one—fills the bill.
Both are very good compilers and both have some big problems. I own both (plus Alcyon and Lattice), and use both Megamax and Mark Williams C on a regular basis, depending on what I'm writing. MWC has a debugger, albeit a lousy one, but it's better than nothing. Megamax has a resource editor. MWC is designed to run from a UNIX-style command shell, but I prefer Beckemeyer's shell. Megamax has a GEM operating shell, which isn't bad.
MWC comes with a lousy version of EMACS for editing. Megamax comes with a clone of Edit (a popular editor on the Mac), which is a real pain to use and very buggy. Whichever you get, I'd recommend another editor, such as the version of EMACS by Russ Wetmore, here on Delphi, or possibly Tempus from Eidersoft.
Megamax gives you the minimum you need (compiler, linker, librarian) and ignores the fancier tools (egrep, diff, etc.) that MWC has. MWC compiles slower and produces slower running programs, except in floating-point intensive applications. Megamax compiles very fast and produces faster code by 20 or 30 percent. Megamax also provides a resource editor for creating menus and dialog boxes, which is currently not available for the MWC package.