It's very rare in an NES game that you have a lot of objects that are all able to collide with eachother. Off the top of my head I actually can't think of any that do it. Usually, the worst case situation you'd have in a conventional 8bit action game is if you are able to fire a lot of projectiles at once, and all of them have a chance of colliding with the enemies. Thinking about this, it's probably not a coincidence that almost every 8bit title limits the player to 3 shots on screen at a time, causing interesting rapid-fire potential by pointblanking enemies, like you'll often see in Mega Man, Gradius, etc.
So while there's a lot of potential optimization to be done by grouping "collidable" objects in separate areas, there's usually more to gain by rethinking your business logic and avoiding unnecessary collision checks. First of all, if you have a large scrolling stage, are you calculating collisions for objects that aren't even visible? And if you are, how much would you really lose by removing those from the equation compared to the potential performance gain?
You also need to decide whether you really need subpixel precision on your collisions? Players definitely won't be able to see it, and if you could convert all your coordinates to 8bit values, that should also make comparisons much faster.
Of course this all depends on the design of your game, and there is never a single good solution. The NES DOES have a lot of limitations, but as long as you keep them in mind, you can usually design your game around it.
tomaitheous wrote:If the projectiles move one pixel at a time, you can cheat this; do certain collision detections on the next frame if you run over your allotted time limit. Or just assign certain collisions to always be done across two frames, while others are done in a single frame. I'm pretty sure there are some NES games that do this.
Definitely a lot of NES games that do this, and if you implement it well, it can be a really good solution - SMB at least is famous for only detecting harmful collisions at some frames.
As a general rule of thumb, you probably want to give your collisions a priority based on whether they are harmful or beneficial to the player, or the risk (and consequence) of items passing "through" eachother.
Most recently I noticed this practice in a Super Nintendo game. In Super Ghouls n Ghosts stage 5, near the checkpoint, ice tendrils start growing from the ground, and twisting in various directions.
Not only are their formations random, they obviously can't have completely square hitboxes, so to accurately detect collisions, each joint needs to detect separately. Even though only three tendrils can be spawned at a time, this suddenly requires a lot of collision detection, so what I suspect the game of doing, is only checking collisions on one joint per frame, moving an internal counter for each time collision is checked. On a tendril with ten joints, this means the player won't be able to stay inside any spot in a tendril for more than 10 frames, ie. ~167ms, which is still short enough for it to not be an issue, considering the slow pace of the game.
It does create some awkward situations where you think you're somehow standing in a safe space, only to get killed off a fraction of a second later. Of course, if the detection was done "properly", you'd be dead anyway, so it's still a preferable solution compared to excessive slowdown, which other parts of the games suffers heavily from.