It is currently Thu Oct 19, 2017 2:18 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Thu Feb 17, 2005 11:46 pm 
Offline

Joined: Mon Sep 27, 2004 11:51 pm
Posts: 101
tokumaru wrote:
Hey, I found a game that draws non-transparent trash in the BG in order to get a sprite 0 hit for the status bar at the bottom of the screen. It's "The Guardian Legend". Just look at the left, right above the status bar and you'll see a dancing blue rectangle in outer space! =D

The scheme used by Guardian Legend is more complicated than that. That game uses DMC IRQs as a timer so that it knows when to update the status bar whenever 64 sprites are to be displayed on the screen without wasting the primary object.

_________________
http://hydesprojects.cjb.net/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 18, 2005 6:56 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10057
Location: Rio de Janeiro - Brazil
Quote:
The scheme used by Guardian Legend is more complicated than that. That game uses DMC IRQs as a timer so that it knows when to update the status bar whenever 64 sprites are to be displayed on the screen without wasting the primary object.


Really? Well, I didn't look at the game's source or anything, I just noticed that no matter the level there is a strange square in the bottom right. I figured out it was to get a sprite 0 hit at that point.
You mean It uses DMC IRQs *ONLY* when the 64 sprites are being used? I know the game uses a lot of sprites and all, but... going through the trouble of using DMC IRQs to save 1 sprite? That's crazy... The game already flickers like hell (depending mostly on the kind of weapon you shoot), what difference does 1 little sprite make?!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 18, 2005 9:40 am 
Offline

Joined: Mon Sep 27, 2004 11:51 pm
Posts: 101
That's a very good question. I really don't know why they would do something like that. Perhaps doing so enhanced their OAM cycling routine or something. It may have also been that the sprite could have been placed elsewhere on the screen so that you would get two different timers: a primary object collision somewhere followed by an IRQ. I'd have to look more carefully into the source.

_________________
http://hydesprojects.cjb.net/


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 20, 2005 10:10 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7230
Location: Chexbres, VD, Switzerland
Quote:
Hey Bregalad,
I understand what you're saying, but I actually need some tiles in the BG to be 100% transparent. I think I'll do it like you said, but will also sacrifice 1 color of one of the palettes, making it the same as the transparent color, so I can use it instead. This way a hit will always happen, right?

It wouldn't that be a "sacrifice", Final Fantasy does something similar : In a dungeon or castle you can't see "indoor" when you're "outdoor", and the "outdoor" areas will be darker when you're "indoor". This is only a palette change (use a emulator that can show the pallet to see this). The indoor stuff is hidden because all the palette are using the same color. When you're indoor, the ground is black, but this is not the "transparent" black color, but another black, so this is also a "sacrifice", but it actually isn't scince this render a very cool effect with this indoor and outdoor stuff.

Quote:
The only bad effect of this is, if another sprite is at the same place than sprite 0, it'll be hidden behind regardeless of it's priority flag (some emus emulates this wrong).

This is indeed bad in this case. But missing such a small portion of a sprite is a small price to pay for the effects you can do using this trick. It can be very usefull if you actually want a sprite to go fully behind an object in the background wich is surrounded by non-color 0 pixels (like walking behind pillars, or behind houses in an RPG).[/quote]
Yeah, this is a very interresting stuff about NES graphics, but almost no games uses this exept Catlevania 1 and 3 (typycally, you can test an emulator by just begin a new Castlevania 1 game, if the hero pass "behind" the castle's door the emulator is okay, else it isn't).
Ï think this stuff were badly doccumented for the programmers otherwise it would be used a lot.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject: (none)
PostPosted: Tue Apr 05, 2005 2:54 pm 
Maybe this is because I'm almost totally new to NES programming, but. I have a few questions myself...

1. Is it not possible to change the sprite-zero/eight-sprites-per-scanline flags manually? (high probability of being a stupid question)

2. Why wasn't something so useful as scanline counting made an internal feature of the system? (...if anyone has any suggestion or opinion)

3. Can you actually alter rendering during the horizontal blank? As in, actually change the data displayed past a certain X position, and then change it back later? (simply, having a thick bar going down the entire center of the screen, or, combine with V-blank, and have a horizontal and vertically bound area in the screen?)

I think I may have read that some memory mappers may do something like number #3 (essentially horizontal split-screen). Just wondering if it was possible otherwise...


Top
  
 
 Post subject: Re: (none)
PostPosted: Wed Apr 06, 2005 12:10 am 
Offline

Joined: Mon Sep 27, 2004 11:51 pm
Posts: 101
Omni wrote:
1. Is it not possible to change the sprite-zero/eight-sprites-per-scanline flags manually? (high probability of being a stupid question)

Nope.
Quote:
2. Why wasn't something so useful as scanline counting made an internal feature of the system? (...if anyone has any suggestion or opinion)

Who knows. Perhaps the engineers just thought it would be best (cheapest) if game companies came up their own mapper designs, thus placing almost no restrictions on how they should implement scanline counters.
Quote:
3. Can you actually alter rendering during the horizontal blank? As in, actually change the data displayed past a certain X position, and then change it back later? (simply, having a thick bar going down the entire center of the screen, or, combine with V-blank, and have a horizontal and vertically bound area in the screen?)

I think I may have read that some memory mappers may do something like number #3 (essentially horizontal split-screen). Just wondering if it was possible otherwise...

I am not understanding what you are trying to say here.

_________________
http://hydesprojects.cjb.net/


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 1:38 pm 
In regards to #3. Think about Simon's Quest or Adventure of Link, where they just have a box somewhere in the middle of the screen to display text in.

I understand that has to be done using the pattern/name tables, since obviously that would be a lot of 8x8 sprites otherwise. But, how do they display that box? Those games don't scroll by the tile, so they can't just be rewriting part of the background. I figured they were using some combination of scanline interrupts (to start and end the textbox vertically) and then maybe some kind of horizontal interrupt (to start and end the textbox horizontally). This way the textbox can appear appear and be surrounded by the rest of the background on all sides.

Does that make any sense?

Also, is there any game that used single-screen mirroring?


Top
  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 3:44 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3470
Location: Indianapolis
They could do something like that, but it's not easy to get the timing down. I know at least Marble Madness does something like that for it's text display. And Pirates! splits the screen in half, with text on one side and graphics on the other (when you enter a town).

A lot of games by Rare use single-screen mode.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 7:40 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19099
Location: NE Indiana, USA (NTSC)
The Adventure of Link does just rewrite the background to display its text boxes. Either you don't notice a less-than-8-pixel deviation in the horizontal position of the box, or the game just gently scrolls to an even multiple of 8 pixels when a text box pops up.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 10:43 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10057
Location: Rio de Janeiro - Brazil
Hyde wrote:
The scheme used by Guardian Legend is more complicated than that. That game uses DMC IRQs as a timer so that it knows when to update the status bar whenever 64 sprites are to be displayed on the screen without wasting the primary object.

Sorry for bringing such an old topic back but... So Guardian Legend does not use that method for detecting a scanline, but I found a game that does: Big Nose Freaks Out.

You can clearly see a square at the right bottom right corner of the screen, right before the screen is turned off. Now, I don't know how valid this technique can be... I mean, the screen is disabled early so that the programmer has more time to write stuff to VRAM. But by using sprite 0 hit for that the programmer looses time waiting for the hit.

I know they are different types of "time", but still... if you can't process much during rendering you won't have much to draw in VBlank. Well, the game must have it's reasons. The ammount of screen it cuts is enough to avoid color glitches (without complicated handling of the attribute bytes) when scrolling vertically, at least.

Again, sorry to bring such an old topic back up.


Top
 Profile  
 
 Post subject: Re: scanline "detecting"
PostPosted: Tue Jan 31, 2006 7:30 am 
how long is Vblank on cycles????
when i wait for vblank, i take it on cycle 1??

how long is hblank cycles????
how can i wait for a hblank??

do exists any nes game that use nearly all vblank time
brutally just in order to run for 100% the limit of vblank and game see good with no glitches??....


Top
  
 
 Post subject:
PostPosted: Tue Jan 31, 2006 7:49 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
VBlank takes 20 scanlines, or from scanline 0 up to 19.
Scanline 20 is a pre-rendered one.
Scanlines 21-260 are the visible field and... 261 the PPU does nothing.

VBlank is 20*262 PPU cycles long, minus 1 on odd frames if background is enabled. To convert it into CPU cycles, just divide by 3.

AFAIK, the PPU starts at scanline 21. I didn't understand about "wait for VBlank in 1 cycle"... o.O

HBlank starts at PPU cycle 256 up to 341 (per line).

_________________
Zepper
RockNES developer


Top
 Profile  
 
PostPosted: Tue Jan 31, 2006 8:04 am 
Fx3 wrote:
VBlank takes 20 scanlines, or from scanline 0 up to 19.



I was thinking that vblank take all screen in order to refresh.. then what about definition: vblank is when gun of light point the lower right of TV. and it's going to upper left of TV in order to repositionate cursor???


Top
  
 
 Post subject: Re: scanline "detecting"
PostPosted: Tue Jan 31, 2006 8:26 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10057
Location: Rio de Janeiro - Brazil
I'll try to cover the rest.

lord_Chile wrote:
how long is hblank cycles????
how can i wait for a hblank??


HBlank is about 85 PPU cycles long, wich is about 28 CPU cycles. There is no way to "wait" for it as there is with VBlank. You can run timed code based on previous events (like a sprite 0 hit or a mapper IRQ) so you can hopefully execute something during HBlank, but that's about it. Don't bother with it, there is so little time in HBlank that you'll hardly be able to do something usefull with it.

Quote:
do exists any nes game that use nearly all vblank time
brutally just in order to run for 100% the limit of vblank and game see good with no glitches??....

Using all the VBlank time is a common thing for scrollers, that need to redraw large parts of the screen every frame. The glitches we may get from scrolling are caused by the low resolution of the attributes and has nothing to do with VBlank. But your game will be very glitchy if if you write to the PPU past VBlank time, so, be sure you don't.

Quote:
I was thinking that vblank take all screen in order to refresh.. then what about definition: vblank is when gun of light point the lower right of TV. and it's going to upper left of TV in order to repositionate cursor???

That's exactly what VBlank is: the time the light beam that draws the picture to the TV takes to move from the bottom right corner to the top left corner, to start drawing the next frame. Jus as HBlank is the time it takes to move from the right end of the scanline back to the beginning of the next, to the left.

I don't know why VBlank is accounted as regular scanlines... I think the 20 scanlines figure just means that VBlank takes the same ammount of time as 20 rendered scanlines would. I can't be sure on that, though.

EDIT:

Quote:
what, vblank is 20 lines not 240 of TV??

The 20 VBlank scanlines are one thing and the 240 rendered scanlines are another thing. They both exist, one before the other. First there are the 20 VBlank scanlines and then there are the 240 scanlines of actual picture. You can't draw to the PPU during the 240 rendered scanlines, only during the 20 VBlank ones. That's why you have to *wait* for the start of these 20 scanlines, so you can use all avaliable time for drawing, and be sure you're done before the 20 scanlines are.


Top
 Profile  
 
 Post subject: Re: scanline "detecting"
PostPosted: Tue Jan 31, 2006 8:43 am 
Offline

Joined: Mon Jan 02, 2006 6:30 pm
Posts: 53
tokumaru wrote:
I'll try to cover the rest.

lord_Chile wrote:
how long is hblank cycles????
how can i wait for a hblank??


HBlank is about 85 PPU cycles long, wich is about 28 CPU cycles. There is no way to "wait" for it as there is with VBlank. You can run timed code based on previous events (like a sprite 0 hit or a mapper IRQ) so you can hopefully execute something during HBlank, but that's about it. Don't bother with it, there is so little time in HBlank that you'll hardly be able to do something usefull with it.


If I may: 28 cycles is more than enough time to write to a palette register or two, which is great for doing color cycling effects like copper bars. The timing would be tough to get right for a full-on game project, but it looks pretty nifty in demos. Also, I'd reckon that almost no emulator is likely to get the timing right so you'd have to run it on real hardware to get it right.

Its a shame that the NES dosen't have an hblank interrupt. Sometimes, I miss VGA programming.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group