Sprite Noob Question

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
Anes
Posts: 604
Joined: Tue Dec 21, 2004 8:35 pm
Location: Argentina
Contact:

Sprite Noob Question

Post by Anes » Wed Apr 15, 2015 4:45 pm

Im rewriting my sprites engine since i was using the old "brad taylor" method as we know is outdated.
I find a problem when sprites have X=255 or 0xFF. When a sprite has this coordinate value is it visible?, since im getting errors.

Thanks in advance.
ANes

lidnariq
Posts: 9382
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Sprite Noob Question

Post by lidnariq » Wed Apr 15, 2015 5:14 pm

Sprite 0 hits don't trigger on sprites with X=255, even if there are visible pixels. Otherwise I think it's normal?

User avatar
Anes
Posts: 604
Joined: Tue Dec 21, 2004 8:35 pm
Location: Argentina
Contact:

Re: Sprite Noob Question

Post by Anes » Wed Apr 15, 2015 5:28 pm

I know it doesn't trigger when its 255, but my question is if X is set intentionally at 255, is the the sprite pixel shown??
ANes

User avatar
Anes
Posts: 604
Joined: Tue Dec 21, 2004 8:35 pm
Location: Argentina
Contact:

Re: Sprite Noob Question

Post by Anes » Wed Apr 15, 2015 6:43 pm

mean this:
I have 8 output units wich this unit is a C struct:

Code: Select all

typedef struct
{
	unsigned char Y, TileIndex, Attr, PT0, PT1, pre_spr_zero, spr_zero;
	int X;
} SPRBUFFER, * PSPRBUFFER;
"X" is copied from "sprite temp" memory in sprite fetches phase.

When rendering each ppu cc i decrese this "X", when X == 0 the unit is "active" and check if the sprite is not transparent.

What i got is this:


Image
ANes

mkwong98
Posts: 226
Joined: Mon May 30, 2011 9:01 pm

Re: Sprite Noob Question

Post by mkwong98 » Wed Apr 15, 2015 7:03 pm

The game should not set 255 to the left sprite when Mario moves to the left edge of the screen so I think it is a bug with the CPU, not PPU.

Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Sprite Noob Question

Post by Sik » Wed Apr 15, 2015 8:30 pm

Maybe it just assumes that Mario can never be off-screen horizontally? Especially since it'd be impossible to see on a TV anyway (due to overscan).

User avatar
Anes
Posts: 604
Joined: Tue Dec 21, 2004 8:35 pm
Location: Argentina
Contact:

Re: Sprite Noob Question

Post by Anes » Wed Apr 15, 2015 8:37 pm

I solved it!! it was an sprite logic problem anyway I tested it in a real NES and it doesn't produce that effect.
ANes

User avatar
Zepper
Formerly Fx3
Posts: 3192
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Sprite Noob Question

Post by Zepper » Thu Apr 16, 2015 5:46 am

Now I'm curious. :oops: :oops: :oops:

Is this a bug? Isn't Mario sprite supposed to wrap?
Attachments
Super Mario Bros. (JU) (PRG1) 000.bmp

mkwong98
Posts: 226
Joined: Mon May 30, 2011 9:01 pm

Re: Sprite Noob Question

Post by mkwong98 » Thu Apr 16, 2015 7:13 am

Zepper wrote:Now I'm curious. :oops: :oops: :oops:

Is this a bug? Isn't Mario sprite supposed to wrap?
You are right, somehow that glitch didn't cross my mind when I saw the first picture.

User avatar
Zepper
Formerly Fx3
Posts: 3192
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Sprite Noob Question

Post by Zepper » Thu Apr 16, 2015 8:23 am

Anes wrote:I solved it!! it was an sprite logic problem anyway I tested it in a real NES and it doesn't produce that effect.
What was your fix?? I'd like to know in details to fix my emu too.

nostromo
Posts: 9
Joined: Tue Aug 12, 2014 11:25 pm
Location: Sonora, Mexico

Re: Sprite Noob Question

Post by nostromo » Thu Apr 16, 2015 11:28 am

I've tested it in my Sony Triniton using service menu and it happends on real hardware(sorry by the image).
Attachments
IMG0231A.jpg

User avatar
tokumaru
Posts: 11692
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Sprite Noob Question

Post by tokumaru » Thu Apr 16, 2015 12:13 pm

IIRC, SMB calculates sprite positions in a strange way, it doesn't surprise me that this bug is actually in the game.

tepples
Posts: 21973
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Sprite Noob Question

Post by tepples » Thu Apr 16, 2015 1:07 pm

Is this along the glitches that ShaneM fixed?

User avatar
Anes
Posts: 604
Joined: Tue Dec 21, 2004 8:35 pm
Location: Argentina
Contact:

Re: Sprite Noob Question

Post by Anes » Thu Apr 16, 2015 3:28 pm

Yeah it happens in real hardware.

I have a real NES and a PAL Dendy. The thing that i couldn't test it in the real NES yestarday becouse my current transformer was broken and i tought that Dendy was the same, but not.

I have just bought one for the NES and IT DO HAPPEN.
ANes

User avatar
Zepper
Formerly Fx3
Posts: 3192
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Sprite Noob Question

Post by Zepper » Thu Apr 16, 2015 3:57 pm

This sprite wrapping occurs in Nintendulator, but not on puNES. If Anes "has fixed it", it just took ppu_cycle MINUS sprite_xpos > 0 (should be >= 0).

So, that's it. No panic - it's not an emulator glitch.

Post Reply