Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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  
  timer inconsistencies  (Read 2049 times)
0 Members and 1 Guest are viewing this topic.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 131
Projects: 4
Exp: 3 years



« Posted 2012-08-17 23:12:00 »

So, I use javax.swing.timer quite a bit, and I've noticed that the time inbetween iterations varies quite a bit. When I start up my IDE, the first time I run it everything goes hella fast. Then, after that, it's way too slow.

Any way to regulate this?

Note: the inconsistencies aren't consistent, either. Tongue
Offline Z-Man
« Reply #1 - Posted 2012-08-18 00:11:29 »

Yes. Don't use Timer Tongue it's horridly inaccurate for gamedev.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 131
Projects: 4
Exp: 3 years



« Reply #2 - Posted 2012-08-18 00:20:52 »

ok...
what should I use, then?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Z-Man
« Reply #3 - Posted 2012-08-18 00:22:57 »

Well, what are you using Timer for?
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 131
Projects: 4
Exp: 3 years



« Reply #4 - Posted 2012-08-18 00:42:18 »

Movement of sprites, other stuff.
Offline Z-Man
« Reply #5 - Posted 2012-08-18 00:45:17 »

So, your using it as your gameloop? Read this
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 131
Projects: 4
Exp: 3 years



« Reply #6 - Posted 2012-08-18 00:50:54 »

No, not really, I have a timer called moveTimer in my Enemy class (separate from my gameloop)
I'm too good with class architecture and whatnot, never took any lessons Grin
I'll move it to the gameloop, then
Offline Z-Man
« Reply #7 - Posted 2012-08-18 00:58:08 »

Normally game loops consist of getting input, updating, and rendering. For my games I get input, then I update all the sprites and the user (which usually consists of moving them), and then I render. I don't know how your Enemy (or your game) works so I don't know if that applies to you or not. Timer just isn't very accurate, as you've noticed.
Offline StumpyStrust
« Reply #8 - Posted 2012-08-18 11:08:44 »

wouldn't you want to update first? So then the rendering properly represents where everything is? I know people probably could not tell the difference but I am just wondering if there is some other reason.

Offline Z-Man
« Reply #9 - Posted 2012-08-18 20:55:07 »

Whoops, your right. My mistake x)
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.

BurntPizza (21 views)
2014-09-19 03:14:18

Dwinin (35 views)
2014-09-12 09:08:26

Norakomi (62 views)
2014-09-10 13:57:51

TehJavaDev (87 views)
2014-09-10 06:39:09

Tekkerue (42 views)
2014-09-09 02:24:56

mitcheeb (65 views)
2014-09-08 06:06:29

BurntPizza (47 views)
2014-09-07 01:13:42

Longarmx (35 views)
2014-09-07 01:12:14

Longarmx (40 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

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

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

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

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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!