Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
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 2827 times)
0 Members and 1 Guest are viewing this topic.
Offline Don Kiddick

Junior Member





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

Hi,

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?

D.
Offline kevglass
« League of Dukes »

JGO Kernel


Medals: 54
Projects: 20


Mentally unstable, best avoided.


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

Phys2D is probably not suitable I'm afraid.

Kev

Offline Orangy Tang

JGO Kernel


Medals: 48
Projects: 11


Monkey for a head


« Reply #2 - Posted 2009-01-05 16: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.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline ewjordan

Junior Member





« Reply #3 - Posted 2009-01-05 16: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 http://www.box2d.org/forum/viewtopic.php?f=8&t=1567&hilit=controllers), 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 http://www.box2d.org/forum/viewtopic.php?f=8&t=1547&st=0&sk=t&sd=a&start=0
Offline Eli Delventhal
« League of Dukes »

JGO Kernel


Medals: 39
Projects: 12


Game Engineer


« Reply #4 - Posted 2009-01-05 19: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 Member


Projects: 1



« Reply #5 - Posted 2009-01-06 18: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.

Cheers
Grzegorz

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (77 views)
2013-05-17 21:29:12

alaslipknot (89 views)
2013-05-16 21:24:48

gouessej (119 views)
2013-05-16 00:53:38

gouessej (113 views)
2013-05-16 00:17:58

theagentd (126 views)
2013-05-15 15:01:13

theagentd (113 views)
2013-05-15 15:00:54

StreetDoggy (156 views)
2013-05-14 15:56:26

kutucuk (178 views)
2013-05-12 17:10:36

kutucuk (178 views)
2013-05-12 15:36:09

UnluckyDevil (186 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.185 seconds with 21 queries.