• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Offscreen GWorld examples?

atariangamer

Active member
Good day, all.
I've been looking into the classic Mac OS (late 68k, early PPC era) for developing a game project I had in mind. And while I'm making a little bit of progress, so far it's been hard to find examples of what I'm looking to do, or if it's even possible. I was originally thinking about the Sega Genesis as a target platform so perhaps my approach to graphics is a bit too geared towards 'dedicated video hardware' instead of the Mac mentality, but I'd like to ask it here and see if I'm on the right track and if there are any specific examples to study.

Without going too deep, I'd like to make a kind of overworld map or hub area by loading a large background map into RAM. Based off the player position, I would then take a sub-area of the map and copy it to a back buffer. I'd then figure out what "sprites" or actors need to be drawn, copy them to the back buffer, then flip the buffer to the front, then start working on building the next frame.

It seems like part of this is done with offscreen Gworlds, at least to handle the taking a small area of a larger image. And I even saw some mention of front and back buffering. But I've yet to find an actual decent example to understand. A lot of documentation that is pertinent in Inside Macintosh is in Pascal, and even the end of chapter C formatted stuff isn't truly clicking with me.

Does QuickDraw have a front/back buffer system? Or does that have to be built in memory and then just rely on CopyBits to hopefully be fast enough to redraw the entire window?
 

ymk

Well-known member
There are some examples here:

Top level: https://vintageapple.org/macprogramming/

You can draw more detailed and less repetitive backgrounds on the Mac.

Do you need smooth scrolling or multiple layers? The Genesis will be better for that, however, the 64KB VDP RAM doesn't allow for much bitmap data, and tilemaps cut into that further.

If you can get away with scrolling in chunks and not redrawing the background each frame, you'll save lots of cycles. Just patch the background behind each sprite.

See Warcraft, which runs well on an 040.

Since it's common for any given video mode to use more than half of VRAM, you can't rely on a double buffer.
 

atariangamer

Active member
I was hoping for some semblance of smooth scrolling, though not super necessary. Will look at that book, it's one I haven't checked yet.
Graphics limitations was part of the reason I stopped looking at the Genesis, though it is definitely better suited to what I was envisioning.

Basically, was hoping to build a background from tiles, and scroll over it, updating the sprites where I wanted/needed. Just wasn't sure how to really handle scrolling it. I know that's one of the 'holy grail' techniques, so it's not happening easily.

Fair point about VRAM size, wasn't even thinking about it.

Thanks!
 
Top