NES games with a lot of character logic going on

You can talk about almost anything that you want to on this board.

Moderator: Moderators

User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

NES games with a lot of character logic going on

Post by DRW »

I'm trying to find out how many characters in an NES game are possible at the same time without the game lagging. That's why I'd like to check out commercial games that push the NES to its limits in this regard.

So, what would you say are NES games that have a lot of enemies on the screen?

I'm not talking about shoot'em ups that simply have a lot of bullets. Bullets have an immensely simple game logic, only following their pre-determined path, not having to worry about the structure of the level itelf.
I'm only talking about real enemy characters who also have to check themselves against the level map or do other meaningful stuff.

Even non-bullet enemies in shoot'em ups, like spaceships, are probably simpler because they can fly through walls. A koopa troopa or a moblin on the other hand has to check against walls and platforms and therefore requires a more complicated game logic.

In "The Legend of Zelda", you can spawn up to 11 ghosts in the graveyard. But those ghosts aren't influenced by walls either.
I haven't found out how many octorocs or moblins can be on the screen at once, but when only four or five of them and a few arrows are visible, the game already starts to lag.

I'm still impressed by how many enemies "Gauntlet II" can have in a level. Countless characters who never get deleted when they're out of screen. But as far as I see, their movement patterns are very simple: Basically, it's either random. Or moving towards the hero. Or moving away from the hero. They don't have more sophisticated stuff like the "Zelda" enemies who stop and go, who turn around at corners etc. So, there are probably not too many status checks in the "Gauntlet II" enemy logic.
However, it is impressive that no two characters can overlap with each other, so unlike in "Zelda", enemies have to check their own position with all the surrounding enemies.

What other NES games come to your mind where a lot of non-mundane characters are calculated by the game logic at the same time?
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: NES games with a lot of character logic going on

Post by Oziphantom »

megaman games can get pretty busy.
Fiskbit
Posts: 891
Joined: Sat Nov 18, 2017 9:15 pm

Re: NES games with a lot of character logic going on

Post by Fiskbit »

For what it's worth, there's a lot of inefficiency in Zelda leading to slowdown. Handling movement is kind of slow, and collision detection between enemies and weapons is extremely slow, so much so that a simple optimization to fail fast on weapon collisions saves up to 6000 cycles with a screen full of 11 enemies.

Background collision is inexpensive because it's only done every 8 pixels of movement, and because enemies spawn a frame apart, these collisions are staggered so they don't all happen on the same frame. There are some objects that do background collision every frame, though, like octoroks' projectiles, and these do have a large impact on performance.

There's also a lot of core functionality that can be pretty easily optimized to save substantial cycles. The joypad reading function, which does extra reads to be DMA-safe, performs more extra reads than it should and reads joypad 2 in contexts where it doesn't do anything, which wastes about 1100 cycles. Clearing sprites is slow and could be slightly unrolled to save about 330 cycles. All of the information in the HUD is updated every single frame instead of only on frames when something changed, which would save about 2500 cycles. With some improvements, there's no reason the game should ever lag outside of uncommon, single-frame events.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: NES games with a lot of character logic going on

Post by tokumaru »

This is a complicated question... Different games have wildly different requirements when it comes to object behavior... Overhead RPGs are generally much lighter on physics and collisions than platformers, for example. And even in the same genre, the specific mechanics of each game can have a huge impact on how long it takes to handle each object (objects that can do more and interact in more complex ways will always be slower to process). Just because one particular NES game manages to have 20 active enemies with no slowdown that doesn't mean you'll be able to do the same in your own game.

How much optimization you're willing to do (if you even have the ROM space for it) also makes a huge difference. If you're using shared functions for object movement, collisions, interactions, etc. (which you most likely are), chances are that not all objects will need all the logic contained in these functions, meaning you'll always be wasting some processing time doing things that are unnecessary, but having several custom subroutines with slight variations to mach each object's needs is just not practical.

That being said, one common trick used to reduce CPU usage is to not run all of an objects logic every frame. If the object's aren't very fast, you can get by with testing collisions every other frame. Range tests for deactivation can be done every 4 or 8 frames. Spread out any tasks that don't need to run every frame and you should be able to save a bit of CPU time. IIRC, Mega Man does this, comparing the number of each object's slot against a timer in order to decide whether to run specific chunks of logic.
Oziphantom wrote: Tue Mar 15, 2022 9:02 ammegaman games can get pretty busy.
And laggy.
User avatar
Fisher
Posts: 1249
Joined: Sat Jul 04, 2015 9:58 am
Location: -29.794229 -55.795374

Re: NES games with a lot of character logic going on

Post by Fisher »

Well, unfortunately, I can only think of shooters like Recca and Crisis Force.
I think some games use the background layer to "move" objects, so they're not really sprites.
User avatar
nesrocks
Posts: 563
Joined: Thu Aug 13, 2015 4:40 pm
Location: Rio de Janeiro - Brazil
Contact:

Re: NES games with a lot of character logic going on

Post by nesrocks »

Gauntlet enemies are background and move in 8 pixel chunks. I imagine it would have an area in RAM that flags occupied tiles when an enemy moves into it. In Gauntlet 1 it's not uncommon for the player character to move to the same spot as the enemy if they both move to it at the same time though.
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
User avatar
Nikku4211
Posts: 569
Joined: Sun Dec 15, 2019 1:28 pm
Location: Florida
Contact:

Re: NES games with a lot of character logic going on

Post by Nikku4211 »

Uh, ChuChu Rocket?

They're not sprites, but there's still a lot of characters and you need to direct them all safely to the goal, so calculations of some kind still need to be made for the characters, I think.
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: NES games with a lot of character logic going on

Post by DRW »

Oziphantom wrote: Tue Mar 15, 2022 9:02 am megaman games can get pretty busy.
Do you have any specific section in mind?


@Fiskbit: Thanks for the detailed "Zelda" analysis. That's pretty interesting.

tokumaru wrote: Tue Mar 15, 2022 11:33 am Just because one particular NES game manages to have 20 active enemies with no slowdown that doesn't mean you'll be able to do the same in your own game.
Sure. But that's why I want to check out some limit-pushing games to see in how far they might apply to my situation.
tokumaru wrote: Tue Mar 15, 2022 11:33 am That being said, one common trick used to reduce CPU usage is to not run all of an objects logic every frame.
That's a pretty helpful tip. I will definitely keep it in mind.

nesrocks wrote: Wed Mar 16, 2022 4:57 am Gauntlet enemies are background and move in 8 pixel chunks.
Not in "Gauntlet II", though. There, they are proper sprites.

Nikku4211 wrote: Wed Mar 16, 2022 10:14 am Uh, ChuChu Rocket?

They're not sprites, but there's still a lot of characters and you need to direct them all safely to the goal, so calculations of some kind still need to be made for the characters, I think.
There are many characters on screen, but I guess the logic is very simple: When you're aligned to 16 pixels, check whether there's a wall in front of you. If yes, change your direction, else walk.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: NES games with a lot of character logic going on

Post by Oziphantom »

DRW wrote: Wed Mar 16, 2022 12:37 pm
Oziphantom wrote: Tue Mar 15, 2022 9:02 am megaman games can get pretty busy.
Do you have any specific section in mind?
Airman in MM2 is pretty intense, https://youtu.be/BRlioqnVZ_I?t=302 the birds that spawn from the eggs, the way the platforms you need to jump on disappear etc
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: NES games with a lot of character logic going on

Post by Pokun »

Teenage Mutant Ninja Turtles often have a lot of enemies and projectiles going on at the same time. Some enemies are flying, but many are affected by gravity as well. It's quite a laggy game though.

The Ninja Gaiden games certainly has more action than the otherwise similar Castlevania games. Especially in later stages where many enemies attack you at the same time. And in the second game you get the shadow clone technique and produces two clones of Hayabusa that follows you at all times. Although they just copy your moves, they both have the same weapons and techniques as you including the windmill-shuriken which is homing in as it tries to return to you. This means there are three of those on-screen, all acting individually, besides all the usual enemies and whatnot. It's not very laggy either, though most of the action happens very quickly and ends just as quickly.

About all of the Kunio-kun games often has many characters and weapons on screen, all who pretty much plays by the same rules of physics regarding gravity and walls.

Gimmick! is also a pretty impressive game technically, although I'm not sure if it has a lot of simultaneous action. The game was made as an attempt to make the ultimate action game. I remember one funny thing in that there is an enemy in the second level or so that you can control using the second controller (showing that enemies and other objects possibly plays by basically the same rules as the player). It also has objects you can throw which are affected by gravity, slopes and stacking.
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: NES games with a lot of character logic going on

Post by DRW »

Oziphantom wrote: Thu Mar 17, 2022 1:35 am Airman in MM2 is pretty intense, https://youtu.be/BRlioqnVZ_I?t=302 the birds that spawn from the eggs, the way the platforms you need to jump on disappear etc
I had a look, but I didn't find much out of the ordinary. The birds are completely independent from the level structure. Their game logic is basically x += 2; --y;. And sprite-based platforms aren't that complicated either, and there are not that many at the same time

I'm looking for games where there's really a lot going on (and where the enemies are not just items that move in a straight line, independent from everything else).

In "T.M.N.T.", I've seen scenes with five enemies at once.
But in "Ninja Gaiden", I haven't seen more than three non-projectile opponents on screen.
In "Gimmick", I didn't find extreme situations either.
It would be good if you could name me specific sections of the game.

I'm simply curious which games put the NES to its limits, and what those limits looked like.

I mean, would, for example, this be possible on the NES, gameplay-wise?
https://www.youtube.com/watch?v=_VFvXg0K-MA
And if no, what would be the next smaller thing that is possible?
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
User avatar
NovaSquirrel
Posts: 483
Joined: Fri Feb 27, 2009 2:35 pm
Location: Fort Wayne, Indiana
Contact:

Re: NES games with a lot of character logic going on

Post by NovaSquirrel »

I think the main factor behind how much action you can have is more strongly based on how much collision each character has to do (and how complicated the collision is) rather than how complicated their movement looks. It's easy to get complicated looking behavior with a simple state machine, after all.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: NES games with a lot of character logic going on

Post by tokumaru »

DRW wrote: Thu Mar 17, 2022 3:38 pmI mean, would, for example, this be possible on the NES, gameplay-wise?
https://www.youtube.com/watch?v=_VFvXg0K-MA
I think this is possible, specially if you design everything with this particular situation in mind. Objects here do not move particularly fast, so you can definitely stagger some of the logic (e.g. only sense the player and make decisions every few frames and not in sync with other enemies, otherwise just do basic motion and level collision). The projectiles are dead slow, so you can definitely stagger their collision tests too, even though enemy projectiles aren't as demanding as player projectiles, since they generally only target 1 specific object (or 2 if the game is 2P). This is also a fixed arena, so you can save some more time by not doing scrolling-related VRAM updates.

The problem is that you'll most likely not gonna be dealing with a controlled environment like this, and in the middle of normal gameplay, with all the game features enabled (scrolling, object activation/deactivation, special block types, solid objects, dynamic gravity, and so on), the chances of slowdown can increase a lot, depending on how many extra features you support at any given time and how complex they are.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: NES games with a lot of character logic going on

Post by Oziphantom »

The large issue is the NES poor sprite capabilities, in the "not doing much megaman" you are already jumping onto invisible platforms, dodging invisible enemies. You are going to hit those limits far faster than the CPU ones in most cases.

But RAM is speed, so if you are willing/able to throw some more RAM onto your cart then that will help a lot, but if you want to keep in 2K its going to hurt you a fair bit.
User avatar
DRW
Posts: 2225
Joined: Sat Sep 07, 2013 2:59 pm

Re: NES games with a lot of character logic going on

Post by DRW »

tokumaru wrote: Thu Mar 17, 2022 5:44 pm The problem is that you'll most likely not gonna be dealing with a controlled environment like this, and in the middle of normal gameplay, with all the game features enabled (scrolling, object activation/deactivation, special block types, solid objects, dynamic gravity, and so on), the chances of slowdown can increase a lot, depending on how many extra features you support at any given time and how complex they are.
Yeah, that's always an issue to consider. That's why I'm looking for the games on the NES where really the most is going on in a single scene (apart from shooters with many bullets because bullets aren't comparable to proper enemies), simply to have a frame of reference.

Oziphantom suggested the Airman stage, but honestly, I don't see in how far this is truly limit-pushing:
Mega Man.png
Mega Man.png (30.37 KiB) Viewed 1165 times
Looks like a normal scene to me as they appear in countless platformers.

But I'm looking for the most extreme cases. Either in side-scrolling or top-down games. And of course they should be action-oriented, with a player character and enemies and optionally, other stuff on the screen. Not games like "Lemmings".

What action games pushed the NES to its limits, not in terms of graphical tricks, but in terms of the stuff that's actually going on, gameplay-wise? Where are the most cluttered action scenes?

Oziphantom wrote: Thu Mar 17, 2022 9:32 pm The large issue is the NES poor sprite capabilities, in the "not doing much megaman" you are already jumping onto invisible platforms, dodging invisible enemies. You are going to hit those limits far faster than the CPU ones in most cases.
The eight sprites per scanline limit is surely something that needs to be considered, true.
Oziphantom wrote: Thu Mar 17, 2022 9:32 pm But RAM is speed, so if you are willing/able to throw some more RAM onto your cart then that will help a lot, but if you want to keep in 2K its going to hurt you a fair bit.
What do you mean? Do you simply mean that buffering values in variables is faster than looking them up in arrays? Or do you mean that accessing RAM would be faster than accessing ROM, so that code runs faster when I copy it to RAM first?
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Post Reply