Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
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  
  Slick2D StateBasedGame taking 20% cpu?  (Read 4619 times)
0 Members and 1 Guest are viewing this topic.
Offline GhostID

Senior Newbie

« Posted 2013-10-14 13:15:27 »

I've been using Slick2D for over a year now and decided to dive into StateBasedGame. Oddly enough, even after setting the maximum update interval and framerate, it still takes up 20% of my GPU.

Image of the issue:
Here's all the code:

Seriously I don't see what's wrong. It can't be my PC as my CPU is an Intel i7 3770 and my GPU is a GTX 660. I also have 8gb of ram so it can't be memory issues...
To make things short, is there anything I can do about it? Is it an error in slick2d's end of the code or am I doing something wrong? Any help is strongly appreciated.
Thank you for your time,
Offline GhostID

Senior Newbie

« Reply #1 - Posted 2013-10-14 14:34:52 »

Turns out it's vsync causing the trouble. It never used to do that (or at least I don't remember that happening). What do you suggest... Leave it or keep it?
Offline Riven

« JGO Overlord »

Medals: 1371
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #2 - Posted 2013-10-14 14:42:00 »

Some drivers implement vsync with a busy loop.

Use this class I wrote, which is used as the implementation of LWJGL's Display.sync(freq)

while(...) {
   // render

   // throttle framerate

It trades a tiny bit of accuracy for the lowest possible CPU consumption.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Pages: [1]
  ignore  |  Print  

Riven (847 views)
2019-09-04 15:33:17

hadezbladez (5795 views)
2018-11-16 13:46:03

hadezbladez (2603 views)
2018-11-16 13:41:33

hadezbladez (6211 views)
2018-11-16 13:35:35

hadezbladez (1499 views)
2018-11-16 13:32:03

EgonOlsen (4734 views)
2018-06-10 19:43:48

EgonOlsen (5793 views)
2018-06-10 19:43:44

EgonOlsen (3276 views)
2018-06-10 19:43:20

DesertCoockie (4175 views)
2018-05-13 18:23:11

nelsongames (5501 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08 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‑
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!