You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#1
Calculating and/or Limiting FPS & Non-Transparent Objects
Posted on: 2008/8/1 7:03
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
What is the technique for calculating FPS? I've read most of the VB dev documentation and don't remember seeing this topic before, so I thought I'd just ask outright, rather than trying to figure it out myself. I'd assume that it has something to do with checking the screen buffers, and counting how many CPU cycles had passed since the last change, but I'm absolutely clueless as to how to do that, and then convert that to seconds. I would also guess that limiting FPS would be a matter of waiting a certain number of cycles before the next buffer refresh, but I'm also clueless about this.

Also, how do you make an object or BGMap with an opaque black fill? Does it involve careful pallete manipulation? I can't see how you could have an opaque black, and still use 4 colors, but the commercial games do it, so there has to be a way...

Any help is greatly appreciated!
Top

#2
Re: Calculating and/or Limiting FPS & Non-Transparent Objects
Posted on: 2008/8/2 22:22
Nintendoid!
Joined 2007/8/8
Great Britain
201 Posts
CoderContributorHOTY09 EntryLong Time User (12 Years) App Coder
To display a non-transparent black, set one of the palette entries in your palette to 00b.
Top

#3
Re: Calculating and/or Limiting FPS & Non-Transparent Objects
Posted on: 2008/8/3 7:35
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
But using that method, don't you end up with 2 blacks? (1 transparent and 1 nontransparent?) I thought about doing that, but then you can only use 3 colors (counting the extra black as a color.)
Top

#4
Re: Calculating and/or Limiting FPS & Non-Transparent Objects
Posted on: 2008/8/3 7:36
PVB Elite
Joined 2003/7/26
USA
1465 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) App Coder20+ Game RatingsPVBCC 2013 Entry
http://www.vr32.de/modules/dokuwiki/d ... palettes_and_transparency
Top

#5
Re: Calculating and/or Limiting FPS & Non-Transparent Objects
Posted on: 2008/8/3 13:58
VUE(xpert)
Joined 2003/9/3
Sweden
442 Posts
PVBCC EntryHighscore Top10 3rdCoderContributorHOTY09 2ndLong Time User (15 Years) DonatorApp CoderPVBCC 2010 1st20+ Game RatingsPVBCC 2013 2nd
Quote:
But using that method, don't you end up with 2 blacks? (1 transparent and 1 nontransparent?) I thought about doing that, but then you can only use 3 colors (counting the extra black as a color.)


That is correct. You can never have more than 3 colors in an obj, since the 4th one is always transparent no matter what you set it to. This is just how it works and there's no way around it.

If you've seen a game that seems to make use of all 4 colors in a 'single' sprite, a technique it may use is to have a second obj right behind it at all times, that uses a different palette and a different char to make up a 'mask' behind the 'real' sprite. It's a method that works, but you effectivly waste half of all available objs/chars
Top

#6
Re: Calculating and/or Limiting FPS & Non-Transparent Objects
Posted on: 2008/8/4 6:06
PVB Elite
Joined 2003/7/25
USA
1507 Posts
PVBCC 1stCoderContributor#3 PosterHOTY09 EntryLong Time User (15 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
One way you could do it is to keep track of where you want to be opaque black, then after the frame is rendered by the VPU, go into the framebuffers and set those pixels to be black. Not exactly a nice way to do it, but wouldn't take too much effort or processing time if you always knew that one small chunk needed to be solid black (like filling in the black of your main character).

DogP
Top

#7
Re: Calculating and/or Limiting FPS & Non-Transparent Objects
Posted on: 2008/8/5 0:37
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
Thanks! Makes sense... I'd just never thought of a palette as 3 colors, plus a transparency. I guess I'll just stick with 3 colors, since 4 seems like a lot of work.

Also, forget the FPS question, since I realize now that it was a stupid question (it depends on the how often the game updates the frame buffer, not how often the VB draws the frame buffer, am I right?)
Top

#8
Re: Calculating and/or Limiting FPS & Non-Transparent Objects
Posted on: 2008/8/8 7:41
PVB Elite
Joined 2003/7/26
USA
1465 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) App Coder20+ Game RatingsPVBCC 2013 Entry
Actually, it's not a stupid question at all. The frame-rate of a system like the VB is quite a complicated subject.

First, there's the basic rate at which the scanner displays the contents of the frame buffers. On the VB, this is about 50Hz (give or take).

Then, there is the rate at which the VIP can fill the frame buffers with pixels based on the contents of the Worlds, et al. This, of course, depends on the complexity of the scene and how many special effects (e.g. Affine, H-Bias, etc.) are used. There's actually a processor interrupt assigned to the situation wherein the VIP takes more than 20ms to draw a frame. I can't provide any more detail about that, though, since I have never written an ISR in my life

Then, there is the ability of the software to create and/or change the scene description itself. This will vary by the nature of the program and of the programmer, among other things.

These are each quite complicated topics to cover in a single forum post, and that's without putting them together... Eventually, I hope the Wiki will cover them all thoroughly, though.

Wish I could help more...
Top

#9
Re: Calculating and/or Limiting FPS & Non-Transparent Objects
Posted on: 2008/8/9 2:52
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
Actually, the way I was thinking of calculating FPS (after reading some more technical docs) was to manually turn writing to the buffers on and off whenever you completed a frame, and use the hardware timer to find the time between buffer writes, and calculate the FPS from that. Of course, I have no idea if this can be done, because I don't know if the VB timer has a high enough resolution, and I haven't tried manually controlling buffer writes... (does toggling the XPEN bit effectively freeze the buffer state until you're ready for another screen redraw?) I was thinking of trying manual buffer writes anyway, because I keep doing weird things to char memory when I try to write too much information to object memory, and end up doing it while the VB is writing to the frame buffers. Has anyone else tried manually controlling FB writes?
Top

#10
Re: Calculating and/or Limiting FPS & Non-Transparent Objects
Posted on: 2008/8/9 7:09
PVB Elite
Joined 2003/7/26
USA
1465 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) App Coder20+ Game RatingsPVBCC 2013 Entry
Quote:

Fwirt wrote:

(does toggling the XPEN bit effectively freeze the buffer state until you're ready for another screen redraw?)


Yes

Quote:

I was thinking of trying manual buffer writes anyway, because I keep doing weird things to char memory when I try to write too much information to object memory, and end up doing it while the VB is writing to the frame buffers. Has anyone else tried manually controlling FB writes?


Well, XPSTTS bits 2 and 3 not only tell you when you shouldn't write to VIP memory, but also tell you which framebuffer is being written to. Just check if (VIP_REGS[XPSTTS] & 0x0C) == 0 before writing. But only if the XP is turned on, obviously...

hth
Edited by RunnerPack on 2008/8/9 7:43
Top

 Top   Previous Topic   Next Topic


Register To Post