Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
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  
  Basic Physics Engine  (Read 9483 times)
0 Members and 1 Guest are viewing this topic.
Offline Captain-Goatse

Junior Devvie




I suck at teh 2D. XBOX IS BIG LOL!111


« Posted 2002-11-25 12:18:56 »

I'm finally at the point where I'm feel secure enough with Java3D to start creating my physics engine.

(I went to gamedev.net and almost shot myself to head due the fact that every 14-year-old is creating a mmorpg.)

For now, I start with flat grid-landscape where I drop items. My attempt is to implements Newtons 3 first laws of dynamics.

1. Object in uniform motion keeps its velocity if no force affects it. Same with objects with velocity of 0.

2. Acceleration is directly porpotional to the sum of new forces divided by mass.

3. If object excerts force on another object, equal force is excerted back.

I believe these all can be done with the simple collision detection thingies provided by Java3D.

One thing I need to know is though, how do I handle objects moving on rough ground? Should I put all the objects "glide" on top of the surface and just give the illusion that they are gliding/moving on it?

How do I implement multiple forces on one object? Lets say I take my cube up to 20 pixels high and drop it from there, but also give it initial velocity with a bearing of 45 degrees. While the gravity would be certainly moving it downwards, how does I set movement with the vi in 45 degrees. I believe I need to calculate the relative velocity. Isn't that correct?


I have thought about the code in following way:

interface PhysicalConstants
-mass
-distance
-time(I'm not sure about this)
-velocity
-acceleration
-force  


Now this interface would be the core of any object, whether it is geometry or model.

Could someone who has little knowledge in physics to revieve the list as I wrote it at my (soon to be girl)friends party when others were doing drugs and performing pre-marriatal sex. If I'm missing some basic element please tell me.

 
Offline leknor

Junior Devvie




ROCK!!!


« Reply #1 - Posted 2002-11-25 13:20:37 »

Quote
... as I wrote it at my (soon to be girl)friends party when others were doing drugs and performing pre-marriatal sex. If I'm missing some basic element please tell me.

I'll let you form your own opinions on drugs but you're definatly missing out on the pre-marriatal sex.

If you're every at a party again and you're thinking about Java please stop and try this pick up line on the first girl you see:
Quote
Hey baby, wanna import my package?  It's dynamically extensible.

If you're bored go to this  page at Monzy Central and read the Wednesday, February 17, 1999 entry. (Doing a find in page for "Java Versus Sex" will get you there too.)
Offline Herkules

Senior Devvie




Friendly fire isn't friendly!


« Reply #2 - Posted 2002-11-25 14:43:14 »

Newtons laws describe the physics of a point mass. Luckily, points can never collide and cannot spin. That nice for computation. Ah, and they live in continous time!

Real-world objects have a finite volume and an orientation and therefor have inertia. For a sphere with equally distributed mass, this can be a number. Generally it is a tensor. Welcome to the world of tensor algebra.

So add at least two properties to your interface:

- inertia (Matrix3f)
- spin (Vector3f)


The critical point is to calculate the forces!! There are constant ones like
1  
G=new Vector3f(0f,-9.81f,0f)  
and easy-to calculate ones like air-resistance
1  
draw=new Vector3f(0f,0f, v*v)
(all in their resp. coordinate systems, of course).

And there are the complex ones resulting from object interaction. As long as your objects are elastic spheres, that not a very big problem (if you can determing EXACTLY where the spheres collide) e.g. in a billiard game.

But if you have interconnected object (a swinging bridge, a skeleton) - don't do it at home. There are specialists necessary to deal with. People who know how to do the integration.

If you need to be real physical, you have to observe conservation of energy - which turns out to be very hard when doing numerics.....

Basically, there are 3 laws, .... but....


Ok, now lets talk about dissipative forces like friction, elasticity,.....

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Virum

Junior Devvie




Like a leaf in an icy world, memories will fade


« Reply #3 - Posted 2002-11-25 14:48:21 »

Quote

...but you're definatly missing out on the pre-marriatal sex.


Only if you want aids.

It's time to prove to your friends that your worth a damn. Sometimes that means dying; sometimes that means killing a whole lotta people.

Blog
Offline pepe

Junior Devvie




Nothing unreal exists


« Reply #4 - Posted 2002-12-04 07:23:31 »

Quote
Only if you want aids.
Aids have nothing to do with social status. Where do you get that from?

Home page: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Offline Golthar

Junior Devvie




;)


« Reply #5 - Posted 2002-12-04 09:14:44 »

Quote


Only if you want aids.


Negative, you use protection

come visit us: http://www.otf1337.com
Offline Virum

Junior Devvie




Like a leaf in an icy world, memories will fade


« Reply #6 - Posted 2002-12-06 19:08:18 »

Quote


Negative, you use protection


Protection is a joke.  Condoms don't work half the time.

It's time to prove to your friends that your worth a damn. Sometimes that means dying; sometimes that means killing a whole lotta people.

Blog
Offline Virum

Junior Devvie




Like a leaf in an icy world, memories will fade


« Reply #7 - Posted 2002-12-06 19:11:14 »

Quote

Aids have nothing to do with social status. Where do you get that from?


Where did you get social status from?  Read the what I quoted.    Tongue

It's time to prove to your friends that your worth a damn. Sometimes that means dying; sometimes that means killing a whole lotta people.

Blog
Offline leknor

Junior Devvie




ROCK!!!


« Reply #8 - Posted 2002-12-06 19:20:24 »

People, walk away from this thread. Nothing more of benefit to anyone will come from it.
Offline markuskidd

Junior Devvie


Medals: 1



« Reply #9 - Posted 2002-12-07 00:40:47 »

http://www.java-gaming.org/cgi-bin/JGOForums/YaBB.cgi?board=suggestions;action=display;num=1035576631
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline MGodehardt

Junior Devvie




why does the chicken cross the road?


« Reply #10 - Posted 2002-12-08 06:27:00 »

Quote


(I went to gamedev.net and almost shot myself to head due the fact that every 14-year-old is creating a mmorpg.)



interesting so this 14 yearold guys do run a server farm 2? creating a stable mmorpg is hard.

First earn some money, buy some big servers ( 4 or 5 Sun Enterprise will do ) get a T1 line and write server and write client.

If u can earn money after spending $200.000 dollars or more u are lucky otherwise ...

i have seen so many so called mmorpg,forget it, crap, written by so called professionals.

maybe in 10 or 15 years that 14 year old boy has the skills and the experience to create a small mmorpg, but now all these projects will fail !

maximum players online seen in those mmorpg are not more than 100.

we have 4000 chatters simultaneus online in our system right now and we earn money. we earn a lot of money and we have 10 years experience in online business
Offline Captain-Goatse

Junior Devvie




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #11 - Posted 2002-12-08 14:12:01 »

Thanks for hijacking my thread. You could have opened up somewhere else... ^^
Offline flim

Junior Newbie




Java games rock!


« Reply #12 - Posted 2002-12-13 23:53:41 »

an open source physics engine, is it possible port to Java?

http://ode@q12.org/ode/ode.html
Offline dake^cdx

Innocent Bystander




Java games rock!


« Reply #13 - Posted 2002-12-29 18:46:11 »

first you have to find the result of all forces on your object (if they apply on the same point), just sum up all your forces vectors and use this to find the acceleration. (F=ma, you divide your force vector by mass and you find acceleration, but it's a vector).

Now you need to integrate this over time. For this step, you need an accurate timer and the difference of time between your current frame and the last one (delta_time). Multiply your acceleration vector by this delta_time and add this new vector to your object velocity. Now take this freshly updated velocity vector and multiply it by delta_time. Add this vector to your object position and you get the updated object position. This is the Euler integrator which is not THAT accurate but still good for simple stuff.

I wrote an article in french about (basic) particles physics :

http://www.programmationworld.com/site/Cours.asp?Action=cours&Numero=278

There's some code in the middle of the article that performs this integration, you should be able to understand it, it's C. For advanced motion, you'll have to read some docs about torque and momentum. (Chris Hecker series are a good start : http://www.d6.com/users/checker/dynamics.htm)
Offline aliasx

Junior Newbie




gaming junkie


« Reply #14 - Posted 2003-01-22 22:17:04 »

Quote
an open source physics engine, is it possible port to Java?

http://ode@q12.org/ode/ode.html



have a look at http://odeforjava.sourceforge.net/
Offline Herkules

Senior Devvie




Friendly fire isn't friendly!


« Reply #15 - Posted 2003-01-23 10:47:25 »

Quote


Hey, was really excited when you posted it....

But it's only a ODE-JNI-wrapper for Java? Not so good.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline aliasx

Junior Newbie




gaming junkie


« Reply #16 - Posted 2003-01-23 23:30:10 »

Yeah, it's only a wrapper for ODE rather than a port, but it's the only option at the moment. I'd be happy to help if there's sufficient interest in porting the entire thing to java.
Offline scparker62

Junior Newbie




Java games rock!


« Reply #17 - Posted 2003-04-14 15:39:53 »

I've been looking at the ODE source code and have decided to make a Java port of the code.  

I'd be interested to know if 1) anyone would be interesting in helping out with the port and 2) interested in using the code once finished.

Here's my email address:
stevecparker@comcast.net

Offline Herkules

Senior Devvie




Friendly fire isn't friendly!


« Reply #18 - Posted 2003-04-14 15:58:15 »

I'd love to use it - best if it's nicely integrated with Java3D, so that I don't have to transfer bounds/geometry from here to there....

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Ruru

Junior Newbie




Love the world, but use protection....


« Reply #19 - Posted 2003-07-06 23:02:46 »

Actually they just finished unintegrating it from Java3D so that it is framework independant.  Smiley

Since the future of 3D in Java is unsure, probably the best way to go....

--
More than likely I have offended you with the above post. Don't feel bad, we are often upset by things we are too damned stupid to understand.
Offline Ruru

Junior Newbie




Love the world, but use protection....


« Reply #20 - Posted 2003-07-07 00:52:59 »

BTW anyone tried building the project on a windows system? I managed to build the ODE C code fine after having to edit source code to make it work with VS.net, but the javaforode stuff is not compiling.

I can get the .java files to compile into the bin directory, but the "make jni" stuff is failing - obviously since it was written for linux/unix.

Anyone have any ideas?

PS: Make is suppose to make compiling easier?? My god what a horrendous mess of a a setup. Its almost as if the designers WANTED it to be a mess...

--
More than likely I have offended you with the above post. Don't feel bad, we are often upset by things we are too damned stupid to understand.
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.

trollwarrior1 (33 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (65 views)
2014-11-07 19:57:14

TehJavaDev (69 views)
2014-11-03 22:04:50

BurntPizza (68 views)
2014-11-03 18:54:52

moogie (82 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
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!