gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfxgfx
 
Members, please note that our guidelines are located here.
 
gfx gfx
gfx
484586 Posts in 28410 Topics by 2463 Members - Latest Member: austinrobert August 10, 2020, 05:02:23 PM
*
gfx* Home | Help | Calendar | Login | Register | gfx
gfx
The Gaming Universe  |  The Archives  |  Archived Projects  |  Open Zelda  |  OZ Help (Moderator: red_team316)  |  What lowers your FPS?
gfx
gfxgfx
 

Author Topic: What lowers your FPS?  (Read 1261 times)

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
What lowers your FPS?
« on: March 09, 2010, 10:35:08 PM »
I'm just curious for what affects your FPS.
I always had a low FPS, and for some areas/quests it lowers further.
What actually lowers it?

If possible I like to find some ways to increase the FPS so things are not so jumpy at times.
When I charge a sword during a snow storm my player jumps a bit for example.

edit:
Test1 - I had a black 8x8 sprite drawn (80FPS). I used a timer to increase it's size. When it covered the entire screen it changed to (60FPS).

Test2 - Drew a large sprite with QKey. (60 FPS), otherwise (80 FPS).
Test3 - Same as Test2 but drew the image more off screen and got a (70 FPS)
« Last Edit: March 09, 2010, 11:30:08 PM by KingOfHumans »

Offline Khatuni

  • Executive
  • ***
  • Posts: 1,007
    • View Profile
What lowers your FPS?
« Reply #1 on: March 10, 2010, 08:28:53 AM »
I think you should test this on a blank quest. That is, with no scripts at all and only the sprite that you want to test. If there's no sprite or entity anywhere and all the screens are empty, I'm sure your fps is higher than 80.

In my experience, the total amount of sprites drawn on the screen is the heaviest factor. Then comes the size of the sprites.
I tested it in a screen with only a screenfilling background. Fps was about 1625.
Then one sprite of 300x240 - 1045 fps.
Then instead of the large sprite, I drew a 8x8 sprite and enlarged it to 240x240 - 1100 fps.
Then instead of the one sprite, I drew 15 x 15 8x8 sprites (total area of only 120x120) - 580 fps.

Then created 100 entities (about 50 lines running all the times) in the screen, but showing no sprites. Still 1625 fps. Then 200 entities, still 1625. With 300 it dropped to 1100 fps. With 500 it was 635 fps and with 1000 it was 285. I'm sure the fps will drop quicker if the entity script is long.

Then continued with the 500 entities and constantly ran 1000 entity searches for them (all entities within the search range). Fps was 490. With 3000 entity searches it was still 360 fps.

So try to avoid sprites overlapping each other as much as possible, cause you'll waste fps for (the part of) the sprite not shown. Also try to make sprites as large as possible. For fills, if they cover an area with holes, just spread out 1 fill and put the holes on top, instead of spreading multiple fills around the hole.

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
Re: What lowers your FPS?
« Reply #2 on: March 10, 2010, 01:49:12 PM »
Took your advice.

Test1 - Had player only and only used a fill to show the FPS (about 24x16). Had a FPS of 300 O.o
Test2 - Had player and a green fill and it went down to 115 average. :(
Test3 - Used two fills, no overlapping and had a 115 max average. In Test2 it reached 124, while in this test it didn't pass 115.
Test4 - Two fills overlapped and it was 75 average. :(
Test5 - Used 6 fills, no overlap and had 116 max average.

edit: Well one reason my mountain area was a bit laggy because I used a snow fill over a brown fill. Makes only a 8 FPS difference but it's a start. I'll probably have to go light on the snow as well. Not just for FPS purposes, but for visual purposes.
« Last Edit: March 10, 2010, 02:00:37 PM by KingOfHumans »

Offline Khatuni

  • Executive
  • ***
  • Posts: 1,007
    • View Profile
What lowers your FPS?
« Reply #3 on: March 10, 2010, 02:58:10 PM »
Test4 - Two fills overlapped and it was 75 average. :(
Test5 - Used 6 fills, no overlap and had 116 max average.

So that would mean that 2 overlapping sprites cause the fps rate to lower more than just drawing them next to each other. Unless your 2 fills in test4 were much larger than the 6 fills in test5 all together. I understand the snow has to overlap the rest of the screen. But say the snow tiles are 16x16. Then filling the whole screen with them would make 300 sprites. If you made 32x32 tiles, you'd need 75 sprites and maybe the fps would be a lot higher. I think it's worth a try.

Anyway, what is the fps difference between snow animation and without snow animation?
Maybe you should decompose the whole screen and try to fix things that lower fps. What is your fps in a totally empty screen (with only Link's image)?

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
Re: What lowers your FPS?
« Reply #4 on: March 10, 2010, 03:05:25 PM »
Quote
Test1 - Had player only and only used a fill to show the FPS (about 24x16). Had a FPS of 300 O.o
This. I only used a fill so I can see the FPS. Without anything it just goes blurry so I can't read it.

Offline Khatuni

  • Executive
  • ***
  • Posts: 1,007
    • View Profile
What lowers your FPS?
« Reply #5 on: March 10, 2010, 03:23:44 PM »
Ok, but your player script is 4000+ lines, right? And did you remove all scripts, sounds and sprite sheets from the quest?

If it's still 300 with that, you will probably not be able to play my quest right, cause it includes timers of 250*GetTimeDelta().

Offline KingOfHumans

  • Messiah
  • ******
  • Posts: 17,866
    • View Profile
Re: What lowers your FPS?
« Reply #6 on: March 10, 2010, 03:37:57 PM »
Not sure about sounds, but nothing plays at the time.
All scripts were disabled.

Using an image that covers an entire screen may be too much, plus it looked kind of ugly.

Offline Khatuni

  • Executive
  • ***
  • Posts: 1,007
    • View Profile
What lowers your FPS?
« Reply #7 on: March 20, 2010, 09:43:51 PM »
Today I discovered that sprites that are drawn through a script (PutSprite/DrawImage), but are not visible on the screen, lower the fps just as much as when they are drawn on the screen. So if there's an active entity running all the time, make sure it doesn't draw any sprites outside the camera's range.

It may sound very logical, but I discovered that my level player and map cruiser sprites were shown (off the screen) even though those entities were inactive. With a few fixes I managed to raise the fps during boss battles.

I was thinking about a simple function for all enemies in Zelda quests, that'll automatically disable the PutSprite in its script when the enemy is near, but not visible.

Offline Khatuni

  • Executive
  • ***
  • Posts: 1,007
    • View Profile
What lowers your FPS?
« Reply #8 on: July 25, 2010, 07:58:47 AM »
I know you're not having fps problems anymore, but I just wanted to add this:

The total amount of entities in the game also matters for fps. You probably won't notice this if the amount is less than 400, but with the DeleteEntity bug, I'm sometimes forced to delete hundreds of entities later in the game (and still a few of them remain). So I'm talking about entities that don't function (return; is placed somewhere at the top) and are all more than 10000 pixels away from the camera.

Remember the Boxman demo? There are a few hundreds of those boxes in all levels together, so I decided to remove the boxes in the screen editor, create those entities at the start of a level and remove them when returning to the map. Maybe if you ever have a low fps in AI, you can try the same idea for your enemies, etc.

The Gaming Universe  |  The Archives  |  Archived Projects  |  Open Zelda  |  OZ Help (Moderator: red_team316)  |  What lowers your FPS?
 

gfxgfx
gfx
SMF 2.0.17 | SMF © 2019, Simple Machines Page created in 0.179 seconds with 21 queries.
Helios Multi © Bloc
gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!
anything