Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 1549 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?  

Pages: [1]
  ignore  |  Print  

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

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

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

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

nelsongames (156 views)
2018-04-24 18:15:36

nelsongames (155 views)
2018-04-24 18:14:32

ivj94 (896 views)
2018-03-24 14:47:39

ivj94 (157 views)
2018-03-24 14:46:31

ivj94 (809 views)
2018-03-24 14:43:53

Solater (173 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!