Mode 7 rotation and masking sprites for landmarks

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Re: New SNES game in development: Furry RPG (working title)
by on (#149020)
Might I suggest having it to where the scenery on the Mode 7 map is made is facing straight down? I honestly had no clue as to what I was looking at originally.
Re: New SNES game in development: Furry RPG (working title)
by on (#149053)
Espozo wrote:
Might I suggest having it to where the scenery on the Mode 7 map is made is facing straight down? I honestly had no clue as to what I was looking at originally.

It's a style choice, really... Having ALL scenery face a static direction when the map is rotated might be absurd but just keeping major landmarks facing down shouldn't be hard at all to do using sprites at a calculated position. Thing is, I'm not sure if you'd want to do that.

If you do use sprites you'd need to scale them with distance, which should only be a minor pain but might not look very good and I'd think it would glaringly stick out as separate from the map. On rotation it WOULD fix one major problem of perspective - if you spin the camera around that tower for example you can watch it expand and contract in height. But, personally, I think it's probably going to look pretty awful to have such objects rotate themselves relative to the map to stay facing you.

Trying to go full-out on the sprite method seems really, really painful though if it's even possible: Have sprites for each increment of rotation around the object, then versions of that set for each draw distance, and place appropriately. That already sounds like it's threatening to run you out of VRAM room for just one object; though I suppose you probably have lots of free processor time to DMA a new tileset to VRAM as you move toward/away from it.

My memory isn't clear enough to recall how various successful Mode 7 games handled that particular problem. I think some of them just never rotated the map at all?

In any case, good progress!
Re: New SNES game in development: Furry RPG (working title)
by on (#149054)
Khaz wrote:
If you do use sprites you'd need to scale them with distance, which should only be a minor pain

It's certainly doable, seeing as I did it in real time on the NES.

Quote:
My memory isn't clear enough to recall how various successful Mode 7 games handled that particular problem. I think some of them just never rotated the map at all?

F-Zero and Super Mario Kart had separate sprite cels at different sizes and rotations, which got copied into VRAM as needed. Things didn't change smoothly from one size to the next; instead, they suddenly grew larger or smaller, but players didn't care. Still, it wouldn't be hard to go from this to Neo Geo-class scaling that my aforementioned NES demo does.
Re: New SNES game in development: Furry RPG (working title)
by on (#149057)
This is kind of random, but one thing I've always thought of is if people made a mipmap for sprite scaling on something like the Neo Geo, so an object that was scalled down to half its original size would only affect the sprite pixel limit half as much.
Re: New SNES game in development: Furry RPG (working title)
by on (#149058)
The way F-Zero and SMK work is already halfway to mipmaps.
Re: New SNES game in development: Furry RPG (working title)
by on (#149065)
Khaz wrote:
My memory isn't clear enough to recall how various successful Mode 7 games handled that particular problem.

Have a look at FF6's airship scenes ... :wink:
Re: New SNES game in development: Furry RPG (working title)
by on (#149095)
tepples wrote:
The way F-Zero and SMK work is already halfway to mipmaps.

There's zero real time scaling being done though, and the transitions look really jumpy. Would it have been impossible to scale 8 32x32 racers down to 16x16 in one frame? Is shrinking any slower or faster depending on how much you are scaling? It would still help reduce overdraw, unless you somehow have it to where it doesn't put the empty times on screen.
Re: New SNES game in development: Furry RPG (working title)
by on (#149097)
Better question: how much spare memory is in work RAM? Because if there's enough RAM maybe some prescaled graphics could be cached.
Re: New SNES game in development: Furry RPG (working title)
by on (#149098)
Espozo wrote:
Is shrinking any slower or faster depending on how much you are scaling?

It's slower or faster depending on the size of the sprite being scaled. For example, a 32x32 will take four times as long as a 16x16. But the NES can scale a 32x48 in four frames, and if I remember correctly, my demo is limited more by the NES's anemic CPU-to-PPU bandwidth and work RAM capacity than by CPU time. But I agree that even scaling other vehicles at 15 fps would be an improvement in visual smoothness.
Re: New SNES game in development: Furry RPG (working title)
by on (#149100)
Now that I think about it, why didn't they just use software scaling in the first place? they would have saved memory, and it would have looked nicer. I'd have thought that they would still have enough CPU time for game logic, and if they would use mip mapping, they could still save a little extra CPU time, but you would of course need to store the smaller frames, but it would just be a 32x32, a 16x16, and a 8x8 instead of all they have. It's highly unlikely that all players will be the same distance from the camera. I guess I'd try to have as little frames as possible, but if I'd run into slowdown, I'd add just enough frames to avoid slowdown.
Re: New SNES game in development: Furry RPG (working title)
by on (#149105)
Khaz wrote:
My memory isn't clear enough to recall how various successful Mode 7 games handled that particular problem. I think some of them just never rotated the map at all?

Can't think of many games that actually used more than one sprite in mode 7...and the thing with the player's sprite is that it has minimal rotations and no scaling necessary- slightly right, slightly left. (If you want to see how hilarious this can look taken to extremes, here. (Admittedly not mode-7)

FF4: Never rotated the map. (Rotates it on Underworld transition.) No sprites but the player's vehicle.
FF6: Rotated the map. No sprites but the player('s vehicle).
Secret of Mana: Rotated the map. No sprites but the player's vehicle (and another flying thing). If the compass directions were sprites, well, they were just horizon-points anyway, no rotation nor scaling necessary.
Secret of Evermore: Rotated the map. No sprites but the player('s vehicle).
Terranigma: Didn't rotate the map, iirc. No sprites but the player('s vehicle).
Demon's Crest: Rotated the map, but only used a nonplayer sprite on the overworld in a cutscene where it didn't rotate.
7th Saga/Elnard: Rotated map. No sprites but the player('s vehicle)...on the overworld, but used rotation of the ground + mode 7 for battle (which was super-cool, back in the day). Sprites of player/foes did not have rotation nor scaling, though.

Pilotwings...didn't really have other sprites that needed/cared about rotation. Not sure how projectiles/ring/bar particles were scaled.
TMNT 4 basically ignored rotation for everyone, iirc, except when transitioning to side-scrolling for the boss of the Mode-7 stage (Neon Night-riders).


[etc.]

Now, Super Star Wars (and the other two Super Star Wars games) used Mode 7 flight-combat segments...but I'm not terribly familiar with them.
Re: New SNES game in development: Furry RPG (working title)
by on (#149116)
I think Maka Maka has a Mode 7 world map... at least from what little of the game I played.
Re: New SNES game in development: Furry RPG (working title)
by on (#149119)
Wouldn't racing games be the prime example of mode 7 with non-player sprites?
Re: New SNES game in development: Furry RPG (working title)
by on (#149120)
Tepples already mentioned F-zero and its multiplayer clone Super Mario Kart; I'm not familiar with others. (The list at https://en.wikipedia.org/wiki/Mode_7#Use is incomplete.)

...though that does jog my memory: wasn't Hyper Zone a Mode-7 game? Don't believe it allowed map rotation, though.
Re: New SNES game in development: Furry RPG (working title)
by on (#149122)
Hyperzone is a behind-the-player rail shooter, along similar lines to Space Harrier, Tetrastar: The Fighter, Cosmic Epsilon, Eliminator, and the later Star Fox/Starwing. It uses mode 7 for the floor and ceiling, with no rotation. It was developed by HAL, and it shares several level names with HAL's Kirby's Dream Land games.

The racing game Cameltry/On the Ball, a spiritual predecessor of Super Monkey Ball, uses mode 7, but the player and indicators are the only sprites in the playfield. The rest of the sprites are random scenery placed behind the background.
Re: New SNES game in development: Furry RPG (working title)
by on (#149123)
Hyper Zone is a-aaaghhh you beat me to it.

Seems like just designing a flat zoomed-out map like ff6 where you won't have to think about these things would be smart...
Re: New SNES game in development: Furry RPG (working title)
by on (#149125)
If memory serves me right, Yadamon Wonderland Dreams uses mode 7 in its opening (and I believe the ending sequence).
Re: Mode 7 rotation and masking sprites for landmarks
by on (#149133)
Is there really such a shortage of mode 7 games? =|
https://www.youtube.com/watch?feature=p ... qN7ek#t=37
https://www.youtube.com/watch?feature=p ... XjPo#t=229
https://www.youtube.com/watch?feature=p ... A_Irk#t=51

Was gonna link to another Japanese one which is a mix of racing and fighting but I can't remember its name.
Re: Mode 7 rotation and masking sprites for landmarks
by on (#149228)
Hey Tepples, can you post the LUT you used for scaling on the NES?
Re: Mode 7 rotation and masking sprites for landmarks
by on (#149233)
psycopathicteen wrote:
tepples wrote:
[Soft sprite scaling is] certainly doable, seeing as I did it in real time on the NES.

can you post the LUT you used for scaling on the NES?

It's the output of tools/mkscaletable.py in the demo's source code. In case you don't have Python, I've uploaded it here. You can scale each half of a 16x16 with this table, and then you can use the multiplier to shift the right half left several bits depending on the scale factor.

16 to 16, if you're not special casing it: use 8to8 (identity) table, multiply right side by $01
16 to 15: use 8to8 table, multiply right side by $02
16 to 14: use 8to7 table, multiply right side by $02
16 to 13: use 8to7 table, multiply right side by $04
16 to 12: use 8to6 table, multiply right side by $04
16 to 11: use 8to6 table, multiply right side by $08
16 to 10: use 8to5 table, multiply right side by $08
16 to 9: use 8to5 table, multiply right side by $10
16 to 8: use 8to4 table, multiply right side by $10
Re: Mode 7 rotation and masking sprites for landmarks
by on (#149239)
equinox abuses mode 7 on the intro (most emulators seem to put a black circle around it) when it shows the world map

and the world map itself is mode 7 with sprites sitting on it. you can rotate the world map as you walk around on it, and sometimes you need to.