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  
  Physics library for top-down racer  (Read 5788 times)
0 Members and 1 Guest are viewing this topic.
Offline Don Kiddick

Junior Devvie

« Posted 2009-01-05 11:04:29 »


I'm thinking of writing a top-down racer in the style of micro-machines. I was thinking of using a physics library to help handle things like drag, & collisions and the like. Is this a good plan?

If so what library? Is Phys2d suitable? I know it is 2D like my game however all the demos seem to assume down the screen is down (as opposed to in my case, into the screen).
Any other libraries worth considering?

Offline kevglass

« JGO Spiffy Duke »

Medals: 319
Projects: 25
Exp: 22 years

Coder, Trainee Pixel Artist, Game Reviewer

« Reply #1 - Posted 2009-01-05 14:37:19 »

Phys2D is probably not suitable I'm afraid.


Offline Orangy Tang

JGO Kernel

Medals: 57
Projects: 11

Monkey for a head

« Reply #2 - Posted 2009-01-05 15:03:18 »

If you want cartoon-y physics rather than realistic ones then I tend to find that doing things manually produces much better results than just throwing a physics engine at it. You can fine tune the different aspects (like grip, torque, acceleration) independently for best gameplay much easier. Micro machines physics shouldn't be too tricky - fundamentally I think it's just simulating each car as a point, plus some variable friction based on the direction of the car.

To save yourself some work you might want to try using just the collision detection code from a physics library, it looks like you could just use the net.phys2d.raw.collide.* stuff directly but I haven't tried it myself.

[ - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ewjordan

Junior Devvie

« Reply #3 - Posted 2009-01-05 15:14:56 »

I don't know of any 2d physics libraries with decent top down support, esp. in Java - Box2d (and once I port the changes, JBox2d) has this planned for a future release, but it's not going to be in for a while.

BorisTheBrave has a controllers framework with a tensor damping controller (see, which might be useful for some top down stuff, but I haven't ported it to Java yet, and I'm not sure that it would do everything you need.  I still haven't played with it myself.

I agree with Orangy Tang, though - for a racing game, you probably want to really micromanage the car behavior.  You may be able to do this within a physics engine by applying forces and torques, or you may want to write your own mini-engine for it, but you probably don't want to just rely on the default behavior that someone put into an engine, because tuning that stuff for the desired feel is absolutely critical for your game.

Edit: someone put up a Flash demo of something like this using Box2d, see
Offline Eli Delventhal

JGO Kernel

Medals: 42
Projects: 11
Exp: 10 years

Game Engineer

« Reply #4 - Posted 2009-01-05 18:21:47 »

Couldn't you just fake it with Phys2D? Have it drawn top-down but factor the physics as if it's going left to right.

i.e. The more left you are on the track, the higher your Y in Phys2D. The more right you are on the track, the lower your Y. The further up the track you are, the higher your X, and the further back you are, the lower your X. Then just turn off gravity for everything and it should probably work all right.

See my work:
OTC Software
Offline gholdys

Junior Devvie

Projects: 1

« Reply #5 - Posted 2009-01-06 17:04:08 »

I would agree with Orangy Tang and ewjordan - making a custom mini-engine seems to be the best solution at this time. You can use Marco Monster's tutorial as a base. This is what I used, when I was writing a car physics engine quite recently. The tutorial can be a little difficult to find. It has disappeared from its original server. I do have a copy however, so I can e-mail it to you, if you want.


Pages: [1]
  ignore  |  Print  

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

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

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

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

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

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

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

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

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

Solater (159 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!