Removed..

Removed…

[quote]safe to computers
[/quote]
stop it already
apart from boardgames not being graphically intensive, you sleep just like normal
only without frame-limiter you could even really heat up the graphics card.

you’re doing 14 fps board games, and people are creating 60 fps first person shooter, and this isn’t even an issue for them
video cards overheating would be a hardware design problem, waaaaay more low level than you can access

[quote]hundred users to my site
[/quote]
that sounds to hurt server, not each client

[quote]need to be sure that my site is safe to computers people use when running my applets
[/quote]
You can tell us what exactly it is doing.

Solution 1: Build an insanely low-level library in C/C++ to query the driver specific commands to measure GPU load, VRAM load and video engine load and adjust the amount the processor sleeps to reduce the load of the game.
Solution 2: Add a CPU sleep. The graphics card can’t work faster than the CPU. The slowest one of the two decides the rendering speed.
Solution 3: Add a huge warning stating that the game has a chance to kill you by exploding the user’s computer, possibly with (faked) proof to assure the player of the risk he’s taking by running your game.
Solution 4: Force the player to run Prime95 and Furmark before starting the game to ensure they have adequate cooling for their CPU and GPU.

The above solutions are jokes. The actual solution is to do nothing.

Sleeping 800ms per frame? Excuse me, but are you insane? Can you picture any 3D game running at 60 FPS at 200/60 = 3.334ms per frame? Most commercial games do much more post-processing than that, and you want to limit the time for each frame to 1/5th of the already low amount of time you have? You have got to be joking.

How does it make sense to not utilize the GPU or CPU fully? Can you picture a car only being able to drive at 1/5th its rated speed? Can you picture a TV that’s only 1/5th the resolution it says in the specifications? A box of corn flakes containing only 1/5th the amount of corn flakes it says on the box? Get real. Don’t try to solve your user’s heat problems and, as Cas says: Make games.

Do we really need to keep replying to Jari Särö’s delusional ideas about CPU/GPU/sleep usage? We’ve answered the question in many forms already, he’s clearly not listening and it’s just starting to clog up the forum.

I think it’s a problem of perception:

  • When your game is running at exactly 60fps, using 100% CPU and 100% GPU, it looks like the computer has no problem performance wise.
  • When your game is running at exactly 5fps, using 100% CPU and 100% GPU, it looks like the computer has a huge problem performance wise.

While it is just as busy, consuming the same amount of energy, some non-technical person might fear for the hardware in the case it’s running at 5fps. It’s surprising a programmer is so hard to convince…

Removed…

Don’t even bother with dirty rectangles. Imagine if 3D games would use dirty rectangles… they would most likely determine the entire canvas/viewport is dirty. 2D rendering is (often) so much cheaper that it’s simply fast enough. Java2D can be slow, so maybe, if you’re really having such performance problems, you’re simply forced into Slick2D or LWJGL - and the framerate might go up to several hunderd fps.

Clicking on your link, I get an applet running at ~1fps with “sleep: 902ms” :persecutioncomplex: the games are (therefore?) unplayable.

Removed…

Same. Couldn’t click on anything either, maybe that’s a side effect of the terrible framerate.

Seriously, whatever crazy stuff you’re doing with sleep() and yeild(), stop it. Just write a fixed framerate loop (at 30fps if you’re paranoid about cpu time) and be done with it.

And as Riven says, don’t bother with dirty rectangles for something as simple as a board game (or indeed anything).

Also same, they were unplayable. You can probably sleep for just 20ms and still keep someone’s cpu at below 5% usage.

Removed…

Yep the “ilmojein pilotit 1917” game was completely unplayable (partly due to not understanding Finnish :P) but mostly due to 4FPS?!? The planes and clouds were lagging and stuttering like crazy.

Looking at the HTML source, you shouldn’t be disabling OpenGL (-Dsun.java2d.opengl=false) and only using DirectX/Direct3D (-Dsun.java2d.d3d=true) since now the applet will not work on anything other than Windows.

It didn’t start at all on me~
I’m little curious about what code inside it :stuck_out_tongue:

@ReBirth you have to click on the image after clicking on the name.

  1. Remove sleep(OVER_NINE_THOUSAND)
  2. ???
  3. Profit!

Hahahahahahahahahahahahahaha.