Carl Mueller Jr, on Sat Apr 21, 2012 8:56 PM, said:
I didn't mean to suggest that you are trying to imitate the EXEC, but you did say you are trying to develop something as general as possible, which was definitely the goal of the EXEC's programmers. Of course, any time you program something to be generalized, you're definitely not going to be pushing the machine to its limitations – that requires specialized programming.
Even if you're setting a dirty flag to sequence GRAM for only those MOBs that require it, you should still be mindful of situations in which many MOBs need their bitmaps updated in a single frame, particularly if you're also sequencing cards used by the background.
One additional thing you might consider updating during VBLANK is the PSG. I find that, when the main game loop falls behind, updates to the graphics are rarely noticeable, but a lag in the music definitely is. That's one thing I would like to change with my engine.
Anyway, good luck, and looking forward to your future releases! :-)
Carl
Carl,
Thanks for the feedback, I really appreciate it.
The strategy I'm taking is that the game program is divided into primary states (e.g. title, game-play, game-over, etc.) and the programmer registers animation objects at design time with the framework, for each state. Each animation object keeps track of its frame-rate and the number of GRAM tiles it uses, and the animation driver sets the "dirty" flag of any objects whose GRAM needs updating.
The animation driver runs as a task outside VBLANK context, along with collision detection and sprite movements, which are also tasks of the main game loop. The tasks will be prioritized to allow the game loop to "drop" tasks if the queue is falling behind.
The animation objects will also be prioritized, so that whatever is of lower priority can be "dropped" for a particular frame if necessary.
You are right in that skipped frames are more noticeable on music than on graphics; this is something of which I was already aware. To solve this in Christmas Carol, I process the PSG in the ISR, within VBLANK context. I may change this in the generalized P-Machinery framework to be a high-priority task, to guarantee that it is updated.
One more thing I would like to make clear is my target audience. Obviously this framework will not be applicable to intricate and highly complex games like Space Patrol and D2K, which touch the limits of the hardware. The goal is to simplify development of most common games, in order to attract new programmers to the platform.
You see, every year I see plenty of talented programmers join the list, ask a few questions, share some ideas of what game they would like to work on, only to be hit by the hard realities of programming a game in Assembly Language
from scratch. Some games are started and never finished, and even more never even go beyond the concept stage.
The worst part, to me, is the lack of abstractions. Some of us struggled to get our first "Hello World" sample program going, only to find out that it did not get us any closer to putting a moving avatar on the screen, or helped us understand in any way how to manage the very limited memory and graphics capabilities.
My goal is to provide a somewhat sophisticated, yet simple, high-level-
ish framework that will allow some of those ideas to come to fruition. I plan on implementing a fully-featured game with it as an example, along with a tutorial, to allow fledging home-brewers to cut their chops with minimum pain. They will need to learn Assembly Language, and they will need to write the game logic, but they won't have to worry too much about how to manage and handle sprites and stuff like that.
All of a sudden, those clones of Utopia or ports of Ms. Pac-Man become very much possible, even to the newcomer.
Not every home-brewed game need be a ground breaking, technical masterpiece.
And lastly, more than an encapsulated "operating system" as is the EXEC, P-Machinery is an open framework with a runtime environment. The programmer only uses those libraries that he wants, and remove from the runtime environment (within reason) whatever features he doesn't want, at assembly time. With full source, commented and documented, he can also modify any part of the system to specialize it for his own particular game requirements.
Sure, it's ambitious, but I think the community will profit from it, so it is a worthy cause. Anybody who wants to collaborate in this project is welcomed to.
-dZ.
Edited by DZ-Jay, Sun Apr 22, 2012 5:45 AM.