Java-Gaming.org
 Featured games (81) games approved by the League of Dukes Games in Showcase (497) Games in Android Showcase (114) games submitted by our members Games in WIP (563) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
Pages: [1]
 ignore  |  Print
 Basic Physics Engine  (Read 9224 times) 0 Members and 1 Guest are viewing this topic.
Captain-Goatse

Junior Member

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
-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.

leknor

Junior Member

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.)
Herkules

Senior Member

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.

- 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
Virum

Junior Member

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
pepe

Junior Member

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?

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

Junior Member

;)

 « 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
Virum

Junior Member

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
Virum

Junior Member

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.

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
leknor

Junior Member

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.
markuskidd

Junior Member

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
MGodehardt

Junior Member

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
Captain-Goatse

Junior Member

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... ^^
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
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)
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/
Herkules

Senior Member

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
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.
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.

stevecparker@comcast.net

Herkules

Senior Member

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
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.

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.
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.
 BurntPizza (7 views) 2014-09-21 02:42:18 BurntPizza (8 views) 2014-09-21 01:30:30 BurntPizza (11 views) 2014-09-21 00:34:41 moogie (11 views) 2014-09-21 00:26:15 UprightPath (23 views) 2014-09-20 20:14:06 BurntPizza (27 views) 2014-09-19 03:14:18 Dwinin (40 views) 2014-09-12 09:08:26 Norakomi (70 views) 2014-09-10 13:57:51 TehJavaDev (96 views) 2014-09-10 06:39:09 Tekkerue (49 views) 2014-09-09 02:24:56
 BurntPizza 37x Riven 18x Rayvolution 18x ags1 16x princec 16x basil_ 16x KevinWorkman 15x LiquidNitrogen 12x nsigma 11x theagentd 11x deathpat 11x kevglass 11x HeroesGraveDev 8x TehJavaDev 6x PandaMoniumHUN 6x Gibbo3771 6x
 List of Learning Resources2014-08-16 10:40:00List of Learning Resources2014-08-05 19:33:27Resources for WIP games2014-08-01 16:20:17Resources for WIP games2014-08-01 16:19:50List of Learning Resources2014-07-31 16:29:50List of Learning Resources2014-07-31 16:26:06List of Learning Resources2014-07-31 11:54:12HotSpot Optionsby dleskov2014-07-08 01:59:08
 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