Page 2 of 5

Posted: Thu Jun 08, 2006 10:46 pm
by tepples
tokumaru wrote:I can't think of one single game that changes the palette midframe.
Crystalis?

Posted: Thu Jun 08, 2006 11:09 pm
by tokumaru
tepples wrote:Crystalis?
I didn't know it did. And I don't know how exactly it's done in Crystalis, but I'm sure there are a few games that change the palette from one "section" to the other (something like text boxes or status bars), but I really don't know about actually messing with the palette in the middle of the game/action screen. I can't think of one of those.

Where does Crystalis do it?

Posted: Fri Jun 09, 2006 8:46 am
by Bregalad
Condider midframe palette changine impossible. It actually isn't, but it is always best to consider it to be in a NESdev point. 4 BG palette is enough in 99% of case, regardless of what effects you're doing.
3D world runner does everything with horizontal scrolling.
It uses horizontal mirroring, and already have a pre-rendered sharped ground in the pattern table. You can slope it as you wish, making it possible to do this chessboard effect by changing the horizontal scroll regulary. It is changed every scanline with tricky self-modified code, I think. This is tricky, but not that complicated.
Vertical streaching can be possible if you mess with $2005/$2006 every scanline. Admiting you have a programm or a mapper that does the horizontal streaching for you, and you get mode 7 on the NES. But it is easier to say than to do, and that would consume a lot of CPU time.

Posted: Fri Jun 09, 2006 9:52 am
by Dwedit
Super Off Road and Fantastic Adventures of Dizzy change the palette mid-frame.

Posted: Sun Jun 11, 2006 12:47 pm
by loopy

Posted: Sun Jun 11, 2006 12:53 pm
by tepples
Turn off the screen to update the palette and get a multicolor line of glitch as palette[cur_VRAM_pointer & 0x1F] is rendered on the screen. It generally has to be done in hblank if at all, but the monochrome bit may be able to cover up most of the glitch.

Posted: Sun Jun 11, 2006 1:02 pm
by Bregalad
Well... that'd result of an image with a flickering white scanline or something similar, and that wouldn't look too good.

Posted: Sun Jun 11, 2006 1:10 pm
by loopy

Posted: Mon Jun 12, 2006 12:04 am
by Bregalad
So that's why I say consider it to be impossible in a NESdev viewpoint is better. I tried to do a programm that change just one color during HBlank inside a text box that could be used in RPGs, but the result wasn't brillant (especially that I didn't see it work on the real hardware, but Memblers did). Also, the time of one single scanline is very very short, and I think I just had time to get the next color to write, and effectivly write it during HBlank, then calculate the next scroll line. They were not cycles left, and since a PAL scanline is shorter than a NTSC from the CPU clock (3.2 ration instead of 3), it would be impossible to do in PAL.
In a NESemdev viewpoint, it would be totally different.

Posted: Tue Jun 13, 2006 4:22 pm
by Celius
Well I can see how Cosmic Epsilon makes their stuff by using timed CHR bankswitches, but my question is this: How do they time it? Is there some sort of special equation that describes the rate at which something increases in size?

Posted: Tue Jun 13, 2006 7:16 pm
by tepples
Celius wrote:How do they time it? Is there some sort of special equation that describes the rate at which something increases in size?
Yes, and it's called similar triangles. All the Mode 7 games on the Super NES use the same technique, especially Hyperzone.

Posted: Tue Jun 13, 2006 9:01 pm
by baisoku
tokumaru wrote:I can't think of one single game that changes the palette midframe.
Wizards and Warriors I. In an emulator written under the assumption the palette could not change midframe: here

Posted: Fri Jun 16, 2006 9:55 am
by Celius
I was looking around, and I saw that some people are interested in raycasting on the NES. How the heck are you supposed to do that? During Hblank? Isn't that like less than 1 cycle for each scanline? Since it's for every verticle line on the screen, am I wrong?

Posted: Fri Jun 16, 2006 10:05 am
by Disch
HBlank is about 21 CPU cycles long.

Posted: Fri Jun 16, 2006 2:20 pm
by tokumaru
Raycasting has nothing to do with HBlank... There is no need to change the palette. Except if you wanted to change the color of the sky to the color of the ground by the middle of the screen, but even that isn't really necessary.

Raycasts are computed from side to side, horizontally, So I don't think HBlanks have anything to do with them, as they (HBlanks) can be used for vertical effects. My conception of a NES raycaster computes all the columns at once (while the previous frame stays on for a few NES frames) and when ready everything is drawn at once. There is enought time for the copy because there are many unused scanlines at the bottom of the screen wich are used to "extend" VBlank.

The illusion of more colors is created with dithering (since the "3D" resolution is so low, dithering looks very nice), so I don't think there is a need to change the pallete mid-frame. In fact, I can't see any benefit from it (aside from the sky-to-ground thing), as the walls will be displayed with different heights and that would make any palette change awkward.