Results 1 to 10 of 10
  1. #1
    ewbte is offline Member
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Question How to limit FPS in Java game?

    Hello! So the problem is that game uses more resources than it really need. I want to limit rendering to 30 FPS.
    The game uses LWJGL and has a special file named extra.txt, where could be added additional options like "-server" "-XX", "-Dorg.", etc. I can enable VSync and FPS will be limited to 60, but it's still too much.

    Is there any command to limit FPS or limit cpu usage?

    Thanks!
    Last edited by ewbte; 08-15-2012 at 01:42 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: How to limit FPS in Java game?

    Quote Originally Posted by ewbte View Post
    Hello! So the problem is that game ...
    What game? Something you programmed, or something you found?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    ewbte is offline Member
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Default Re: How to limit FPS in Java game?

    Quote Originally Posted by DarrylBurke View Post
    What game? Something you programmed, or something you found?

    db
    Found, Spiral Knights.
    Unfortunately I didn't get any answer from developers..
    Last edited by ewbte; 08-15-2012 at 01:51 PM.

  4. #4
    kammce's Avatar
    kammce is offline Senior Member
    Join Date
    Dec 2010
    Location
    California
    Posts
    194
    Rep Power
    4

    Default Re: How to limit FPS in Java game?

    Hmmmm, yeah, sorry, this is not a place for people to ask questions on video games they have found. Even though it runs on java, you did not program it, and unless you are making a private server and you are attempting to reprogram the source of the game, this is not the place for video game help. This is a place where Java programmers come to discuss their PROGRAMMING problems, questions, theories etc.

    I would suggest checking out some forums that Spiral Knights has and asking your question there. I have played the game as well. Maybe someone has the answer, or maybe the answer does not exist. The problem might be merely in the programming of the game or the hardware you are using to run it.
    My API:
    Java Code:
    cat > a.out || cat > main.class

  5. #5
    ewbte is offline Member
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Default Re: How to limit FPS in Java game?

    Oh.. excuse me so. I already asked on game's forum, and nobody knows.
    I thought guys who know a lot about java will help.

    I just wonder maybe there could be casual java command like "-Xms1g -Xmx4g" (changes memory that game can use) but for limit FPS.
    Last edited by ewbte; 08-15-2012 at 04:57 PM.

  6. #6
    kammce's Avatar
    kammce is offline Senior Member
    Join Date
    Dec 2010
    Location
    California
    Posts
    194
    Rep Power
    4

    Default Re: How to limit FPS in Java game?

    Well, the problem here is that when you create a game, you have total control over the FPS. One could place a file that hold what that value is in a file, but for this particular game, I am not sure. Usually the graphical settings would help or some options, but this would be particular to the game. And yes, something like "-Xms1g -Xmx4g" would have been some thing that I would have suggested but you have already tried that.

    I might be wrong here, but I do not believe that LWJGL is naturally found in the Java JRE. So, that "extras.txt" file it uses is dependent on that game. On a programming stand point, I cannot help much.
    My API:
    Java Code:
    cat > a.out || cat > main.class

  7. #7
    ewbte is offline Member
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Default Re: How to limit FPS in Java game?

    As I said in first post the following commands works in this extra.txt: all -xx:, -xms, -xmx, -server, -Dorg.lwjgl.opengl.Window.undecorated=true, and all from here Java HotSpot VM Options
    but I haven't found a command to limit FPS or CPU usage there.. so I'm asking here.

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: How to limit FPS in Java game?

    No, there isn't. And as it is now established that the question is off topic, I'm moving the thread to the Forum Lobby.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: How to limit FPS in Java game?

    -Dorg.lwjgl.opengl.Window.undecorated=true
    That one isn't in that list of java options.
    Yes, the -D is, an option, but it is merely a way of sending a property into the application.
    In this case, a property that LWJGL uses.
    It's not a JVM property.

    As kammce says, this is going to be something under the control of the game...possibly LWJGL, but since you seem to have looked up what you can do with that and not foind anything, I would say it's a game-specific thing.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    ewbte is offline Member
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Default Re: How to limit FPS in Java game?

    Thanks a lot to everyone! I will suggest feature to manually set FPS limit to developers.

    Best regards.

Similar Threads

  1. java.lang.OutOfMemoryError: GC overhead limit exceeded
    By apraj397 in forum Advanced Java
    Replies: 1
    Last Post: 05-30-2012, 12:17 PM
  2. date limit Java calendar GUI
    By cuti in forum New To Java
    Replies: 4
    Last Post: 01-20-2012, 11:13 PM
  3. How to limit threads in a Java QuickSort algorithm.
    By roise_r in forum Threads and Synchronization
    Replies: 6
    Last Post: 06-02-2011, 07:53 PM
  4. How to limit characters textbox in java
    By rjagan in forum New To Java
    Replies: 11
    Last Post: 03-28-2011, 10:09 PM
  5. setting memory limit for java?
    By MuslimCoder in forum New To Java
    Replies: 1
    Last Post: 08-26-2010, 06:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •