Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
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  
  Java3D and Threads  (Read 844 times)
0 Members and 1 Guest are viewing this topic.
Offline JmCook

Innocent Bystander




Java games rock!


« Posted 2003-07-22 18:05:56 »

Hello all,

I'm working on a 3D Drag Racing game using a mixture of a 3D canvas and a JPanel.

The game is a simple racing game where the user's car accelerates through 6 gears, with each gear shift giving an increase in speed.  When the tachometer hits the red (time to shift gears) The user must play a quick reflex mini game.  If the user passes, the gear shifts and accelerates the car.  The car will not accelerate until the mini game has been completed.

The Jpanel displays the Tachometer which is animated using threads.  The mini games such as a meter with a quick moving bar that must be timed to hit the center, is also animated using threads.  All of the mini games use Java2D graphics.

Threads also control the movement of the car in the 3D canvas and each thread cycle for the car speed sleeps for 20 and its pretty smooth.  

I'm using threads rather that behaviors for the movement of the car, because if i tried to use a wakeuponelapsedframes behavior the threads controlling the mini games were very inconsistent, and seemed like each time a mini game ran, or tachometer moved, it would lag up and play catch up with the movement of the car in a very jerky manner.

My main problem now consists of jerky movements of the car if the thread sleep time is set too high.  If the car speed thread sleep time is too low, then the whole thing lags up.   If the sleep time is too high then the mini games run at good speed and in Sync with the movement, however the movement is very jerky and the car kind of flickers around back and forth.

Does anyone know why a problem like this would occur?  Too many threads running at once?  If so, what is the best way of doing what I am trying to accomplish?

I thought about making a 3d tachometer and mini games, but i'd rather not since all the code for the mini games has already been written by my partner Smiley

Plus, i'm not sure if making a 3d tachometer would even improve performance.  I'd have to use seperate behaviors to animate the mini games and tachometer.

I'm also having a problem with the 2d graphics being displayed quickly enough when the sleep time is too low.  For instance, when the tachometer hits gear 2 and its time for the first minigame to come up.. then the game will not come up right when it is supposed to and there is some wait time.

Any suggestions?  

Thanks
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.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (43 views)
2014-10-16 15:22:06

Norakomi (33 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (67 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (86 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

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

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
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!