How come every Famicom beat-em-up (Double Dragon, Mighty Final Fight) can only have 2 enemies on screen...EXCEPT Spartan X? If Spartan X (an early FC game) can do it, why can't other games?
Tiles per scanline restriction. (It's what causes the flickering of the droppong spiked weights on chains in Megaman 2). Spartan X uses narrower character sprites. Mighty Final Fight uses exceptionally wide ones.
Other beat em ups that were 2-players also had to take into consideration the 2nd player.
Couldn't they have just alternated which tile tile was displayed each frame? It would make the sprite look translucent, so they could use it for dying enemies. That way you could have 3 enemies on screen, 2 that are alive one that's dying, waiting to be despawned.
Tangent: Is it wrong to use terms like "respawn" when talking about Famicom games? I was talking to my friend about Contra, and how sometimes you can respawn on ledges that you died trying to jump onto and he said "I thought this was a run and gun, I didn't know the famicom had FPSes!"
Maybe you should read nesdev wiki PPU, CPU and figure out, what is cycles per frame limit.
The NES/Famicom was a fairly limited piece of hardware, as noted above. In addition to sprite-flickering, there's also the potential for slowdown if too much stuff happens on screen at the same time. And since most beat 'em ups wanted to have better graphics and detail than the primitive Spartan X/Kung Fu, the way to achieve that while also keeping the game running smoothly on the platform was to reduce the number of enemies on-screen at any one time.
Interestingly, the Sega Master System port of Double Dragon allows for three enemies on screen at a time (and even different types of thugs simultaneously). Since the SMS port also allows for two-player co-op, that means that there are up to five large sprites on the screen at a time, as opposed to only three in the NES port. Now, the SMS was actually a more powerful console than the NES, but their Double Dragon port is still plagued with some sprite-flickering.
Quote from: maxellnormalbias on December 29, 2014, 10:53:55 pm
Couldn't they have just alternated which tile tile was displayed each frame? It would make the sprite look translucent, so they could use it for dying enemies. That way you could have 3 enemies on screen, 2 that are alive one that's dying, waiting to be despawned.
Even if you would manage to do that, in that case wouldn't you need to have two flashing enemies on screen or they would all still flicker if they are aligned horizontally on the screen? So you would need to implement extra code that checks that two of the enemies are dying and only spawn a new enemy if that is the case. Still that would only make two active enemies on screen (since two are basically dead anyway).
Quote
Tangent: Is it wrong to use terms like "respawn" when talking about Famicom games? I was talking to my friend about Contra, and how sometimes you can respawn on ledges that you died trying to jump onto and he said "I thought this was a run and gun, I didn't know the famicom had FPSes!"
It's a modern term used especially in the western PC gaming culture, but it's not limited to FPSes (used in MMORPGs as well for example) so I don't think it's wrong.
as I remember both Batman returns and TMNT II-III could easily have 3 enemies
I just skimmed through the longplay of Batman Returns and didn't notice more than 2 on screen at a time. Manhahattan Project definitely goes higher, but the sprite flicker in that game took a heavy toll because of it.
Spartan X, the game that brought it up in the first place, only has three full-sized enemies onscreen at a time, there's no 2nd player, and at the normal rate of play and quick enemy deaths, the number of onscreen enemies stays much lower. Moreover, their AI is extremely simple, especially considering the 2D plane as opposed to having the vertical depth of a beat em up, which probably has something to do with it.
As M-Tee said it's not about how many enemies, but how many sprites (8x8 or 8x16 pixels) that can share a scanline (even one scanline in common is enough for them to all flicker). Every enemy is built up by several sprites, so it depends on how wide they are.
There are tricks you can do, like turning a sprite into background so it won't count as a sprite anymore.
Edit: This demo (https://dl.dropboxusercontent.com/u/22954866/ninja4.nes) is a good way to understand the 8 sprites rule. Press start to spawn apples, after spawning just four apples at the same height as the ninja, all apples and the ninja will start to flicker. Try jumping (so the ninja is at a different height), and the flickering will stop. Also notice that only half the apples flicker at a time. So every apple is built up by two 8x8 sprites (the ninja seems to be just one sprite wide though). So 4 apples = 8 sprites (which is max).
The demo comes from this thread:
http://forums.nesdev.com/viewtopic.php?f=22&t=12168
There are two locations in TMNT 3 that spawns more than three foot soldiers on screen:
Scene 4: Manhattan (http://youtu.be/9ckb9lo76vo?t=3m58s)
Scene 5: Sewers (http://youtu.be/EDzqPxwMsdg?t=5m)
I don't know what relevance this has to the topic; I just find it kinda funny is all. ;D I wonder if this was on purpose or not. ::)
Yeah they definitely look flickery...I guess it's more that the dev of DD and MFF specifically were going for a graphically good game, so wanted to eliminate most if not all flicker.
Yep. Like I said, TMNT 3 does have more than two enemies on screen at a time, and the flicker toll is quite high.
(http://files.mteegfx.com/TMNT3Scanlines.png)
In this example, there is a scanline with 13 sprites on it, resulting in 5/13 not loading, which is why large portions of the foot soldiers are not visible.
To make it very clear to the OP:
"Sprite" has two meanings when referring to NES graphics. The first is the technical meaning, which is a single sprite tile, either an 8x8 or an 8x16 px rectangle (ex. the top-front quadrant of Mario's head). The second is the colloquial term which refers to a full character (ex. Mario). The latter is with which most people are familiar, but for understanding this, one must refer to the former, the technical term.
So, sprite refers to a single sprite tile. Each frame of animation for a character is composed of multiple tiles arranged near each other, like a jigsaw puzzle with only rectangular pieces.
A scanline is a single horizontal row of pixels on the screen.
The NES can produce two layers of graphics, a background layer and a sprite layer.
There is a hardware restriction that that only allows a maximum of 8 sprites (sprite tiles) to be displayed on a single scanline (horizontal row of pixels).
If more are intended to display, the excess tiles will flicker (lower priority sprites will load in an alternating manner between frames).
TMNT 3 uses 8x16 sprite tiles. This is why the areas missing from the foot soldiers are tall and narrow. If even a single row of pixels within a tile is on the scanline in question, the entire tile may flicker.
Again, this is only in regards to a horizontal row of pixels, which is why only character width, not height is relevant.
In the screenshot above, each of the four foot soldiers is 2 tiles wide, the top row of Raph is 3 tiles wide, and Raph's sai is 2 tiles wide (even though it overlaps Raph's hands, it is irrelevant. The total number of tiles on the scanline which is flickering is therefore 13, 5 greater than 8, which is why there are 5 tiles missing in the screenshot.
If the game loads the same number of enemies during co-op, it could be much worse. Almost certainly, though, enemy AI was coded in a way to minimize this.
Another restriction is that only 64 sprites (technical) may be loaded anywhere on the screen at a time. If using 8x16 tiles, such as TMNT 3, then more sprites (colloquial) can be shown. Many beat 'em ups did not use 8x16 because it wastes a large amount of space within the CHR bank for things like punching or bullets. (a 6 pixel tall arm would waist 10 rows of transparent pixels instead of 2).
To make this point more clear, the standing frame for the foot soldier occupies a space of 16x48 pixels. With 8x16 tiles, it must load three rows of two sprite tiles, or six tiles altogether. To do the same thing with 8x8 tiles, would require six rows of two tiles, or twelve altogether.
A good example of how to do it without flicker:
(http://i57.tinypic.com/k3mx5x.jpg)
Challenger draws text on screen using sprite tiles instead of background tiles so not more than 8 of them can be on the same horizontal row. To work around this problem they raised every letter (sprite) one pixel so that not more than 8 letters share a scanline. The letter "R" in "RESCUE" doesn't share any scanlines with the letter "I" in "PRINCESS".
Definitely. There are tons of workarounds. Specifically in beat-em ups, having the additional "depth" (height), it allows for enemies to higher enemies not to interfere with lower ones. In fact, in TMNT3, there's a scene where foot soldiers somersault out of the ocean (http://"http://youtu.be/QYJfkduIqwg?t=6m44s") that does exactly what the captions in Challenger does, staggers them.
Challenger, by the way, is probably in my top 5 Famicom exclusives. I often think that more of the mapperless games that came out early in the Famicom's life cycle should have been released in the US on multicarts like Donkey Kong Classics.
Woah, this thread blew up! I was expecting it to be like "Hey have you noticed this?" "Yeah, it's a tile-per-scanline limit." "Cool beans."
Anyways, the tile thing I knew about (I messed around with Tile Layer Pro a long time ago) but I did NOT know that you could use tiles of different sizes, that's really cool! Hmm...I wonder if the Super Famicom does it that-NO! DON'T ANSWER THAT QUESTION!
Next time you play Famicom you might think "hey why was that enemy cut in half when I walked up to this point? Aha there already 8 other objects in this vicinity".
Super Famicom is so complicated and doesn't have as a good homebrew scene as Famicom has. It seems you can have several sizes of sprites and two of them at the screen at the same time.
Game Boy is the same as Famicom (either 8x8 or 8x16) but it can handle up to 10 sprites on the same scanline without flickering!