Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  FPS Limiter ? [SOLVED]  (Read 1388 times)
0 Members and 1 Guest are viewing this topic.
Offline GNecro1
« Posted 2013-07-31 13:18:12 »

how can i make an FPS Limiter i never used it and i idk how to make it ? please help

EDIT:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
   public void run() {
      long lastTime = System.nanoTime();
      final double amountOfTicks = 60.0;
      double ns = 1000000000 / amountOfTicks;
      double delta = 0;
      int ticks = 0;
      frames = 0;
      long timer = System.currentTimeMillis();

      while (run) {
         long now = System.nanoTime();
         delta += (now - lastTime) / ns;
         lastTime = now;
         if (delta >= 1) {
            tick();
            ticks++;
            delta--;
         }
         render();
         frames++;

         if (System.currentTimeMillis() - timer > 1000) {
            timer += 1000;
            //System.out.println("FPS : " + frames + " Ticks : " + ticks);
            frames = 0;
            ticks = 0;
         }
      }
   }


i was looking for this.

Java freak! Cheesy
Offline Andre Lopes
« Reply #1 - Posted 2013-07-31 14:27:26 »

Are you using java2D/Libgdx/lwjgl?

Offline GNecro1
« Reply #2 - Posted 2013-07-31 14:46:44 »

no

Java freak! Cheesy
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online quew8

JGO Coder


Medals: 31



« Reply #3 - Posted 2013-07-31 14:52:25 »

Then what are you using?
Offline jonjava
« Reply #4 - Posted 2013-07-31 15:06:44 »

An "FPS limiter" is simply rendering the game a specific amount each second, preferably at set intervals. Therefore the term "Frames Per Second". For instance, 30 FPS would mean you'd ideally render each 1/30th of a second.

There's a good article here on JGO about game loops that cover this subject to an extent: http://www.java-gaming.org/index.php?topic=24220.0

Offline GNecro1
« Reply #5 - Posted 2013-08-01 10:34:32 »

thanks Cheesy Cheesy Cheesy

Java freak! Cheesy
Offline jonjava
« Reply #6 - Posted 2013-08-01 11:05:21 »

How about you read the article? ;V

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (6 views)
2014-11-26 18:22:04

toopeicgaming1999 (8 views)
2014-11-26 18:20:36

toopeicgaming1999 (6 views)
2014-11-26 18:20:08

SHC (24 views)
2014-11-25 15:00:59

SHC (24 views)
2014-11-25 14:53:45

Norakomi (24 views)
2014-11-25 14:26:43

Gibbo3771 (22 views)
2014-11-24 22:59:16

trollwarrior1 (36 views)
2014-11-22 15:13:56

xFryIx (74 views)
2014-11-13 15:34:49

digdugdiggy (52 views)
2014-11-13 00:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-10 01:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-03 01:36:02

List of Learning Resources
by Longor1996
2014-08-16 13:40:00

List of Learning Resources
by SilverTiger
2014-08-05 22:33:27

Resources for WIP games
by CogWheelz
2014-08-01 19:20:17

Resources for WIP games
by CogWheelz
2014-08-01 19:19:50

List of Learning Resources
by SilverTiger
2014-07-31 19:29:50

List of Learning Resources
by SilverTiger
2014-07-31 19:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!