FPS Display isn't very accurate

● ARCHIVED · READ-ONLY
Started by Victor Sant 4 posts View original ↗
  1. I'm working on a anti event lag system, and i can't simply trust the VX Ace FPS display (F2 in test mode), it sometimes display a FPS of 20-40 while no noticeable lag on the screen, and sometimes displays 50+ FPS with a noticeable lag.

    Also, when i uncheck "Reduce Screen Flickering" option (F1 menu in game), the FPS display goes up although no real difference is noticed on screen.

    Someone have a idea of how to have a more accurate FPS display?
  2. Use Fraps.
  3. If you want I have a script to display fps on screen :



    Code:
    module Graphics
    
      @fps, @fps_tmp = 0, []
    
      class << self
    
        attr_reader :fps
    
        alias fps_update update unless method_defined?(:fps_update)
        def update
    	  t = Time.now
    	  fps_update
    	  @fps_tmp[frame_count % frame_rate] = Time.now != t
    	  @fps = 0
    	  frame_rate.times {|i| @fps += 1 if @fps_tmp[i]}
    	  fps_sprite.src_rect.y = @fps * 16
        end
    
        def fps_sprite
    	  if !@fps_sprite or @fps_sprite.disposed?
    	    @fps_sprite = Sprite.new
    	    @fps_sprite.z = 0x7FFFFFFF
    	    @fps_sprite.bitmap = Bitmap.new(24, 16*120)
    	    @fps_sprite.bitmap.font.name = "Arial"
    	    @fps_sprite.bitmap.font.size = 16
    	    @fps_sprite.bitmap.font.color.set(255, 255, 255)
    	    @fps_sprite.bitmap.fill_rect(@fps_sprite.bitmap.rect, Color.new(0, 0, 0))
    	    120.times {|i| @fps_sprite.bitmap.draw_text(0, i*16, 24, 16, "% 3d"%i, 1)}
    	    @fps_sprite.src_rect.height = 16
    	  end
    	  return @fps_sprite
        end
    
      end
    end
  4. @Zeus81

    I will test it.