Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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 3280 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.
Online kevglass

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


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

Phys2D is probably not suitable I'm afraid.

Kev

Offline Orangy Tang

JGO Kernel


Medals: 56
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!
Legends of Yore - The Casual Retro Roguelike
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

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


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.

 

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

The first screenshot will be displayed as a thumbnail.

Dwinin (6 views)
2014-07-29 10:59:34

E.R. Fleming (20 views)
2014-07-29 03:07:13

E.R. Fleming (8 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!