Kinetix - 2D physics engine

[quote]I like playing ping-pong with beautiful nude blond girls and want to make java game of that too.

[/quote]

[quote]the legs spread full frontal shot of JavaGaming’s Penguin ?

[/quote]
oh… my… GOD! :o
Please stop, you’re giving me nightmares ::slight_smile:

Deftly trying to resurrect this after its been tainted by our resident internet kook, I’m interested in using this in my own project…

How would I go about actually adding it to my own work? You’ve described it as an ‘engine’ so i’m assuming you’ve designed it with reuse and flexibility in mind (and the demo does seem pretty powerful :slight_smile: ).

What about only applying the physics to a subset of my game objects? I’m thinking about mixing custom behaviour and the Kinetix physics, so things like bullets, players etc. can be controlled by simple rules but interact with the rest of the objects in a realistic way…

howdy,

I think that the crazy-radiation levels that impregnated this thread have decayed to background norms, so…

Before i start, i should say that the version i left on the web is now somewhat out of date, having languished due to the lack of apparent interest ( mumblemumblebastardsmumble ). The latest version has some useful improvements:

  • automatic rigidification is now vastly more intelligent, uses less constraints and generates more stable bodies
  • an architectural tweak that allows clouds of unconstrained particles, ideal for use as bullets
  • you can now query constraints in order to assess how much strain they are under, useful for calculating damage to objects

These were all prompted when i stopped living in clean-design-world, and attempted to actually use the bloody thing. I’ll upload the newest version and the “game” i made later on tonight.

[quote] How would I go about actually adding it to my own work?
[/quote]
The two approaches that i can think of are…

  1. subclassing the Kinetix entities so that your game objects are Bodies and your bullets are Particles etc.

This is good because their physical behaviour will just happen naturally, and any additional behaviour can be added in the subclassing.

This is bad because you game objects will have to live and move entirely in the Kinetix environment, so you would have to be careful about how you make your game entities move about. Simply setting their positions would introduce arbitrarily large forces into the simulation.
For example, in the game i made, instead of simply setting the ship’s angle every frame, i had to simulate the action of the ship’s engines by giving the ship a rotational acceleration. This made controlling the ship extremely difficult, so i then had to add the steering arrow and let the game decide which way to accelerate.

  1. Run the simulation seperately from your game, and have some kind of linkage layer between the two that reflects events in one side onto the other. For example, if the game component decides that a rock has been hit by a bullet, the linking layer would then apply an appropriate force to the body representing the rock in the Kinetix simualtion. Conversely, the Kinetix component would then update the game component with the position of the rock in every frame.

This is good because it allows for applying the simulation to a subset of game objects. You could also swap out the Kinetix component for another physics engine (as if you’d want to! ;)) without too much hassle.

This is bad because of the added overhead of the linking layer, and it’s not a particularly tidy solution. You also have to be careful about synchronizing the states of the two components, making sure each entity is properly matched with it’s peer, etc.

Perhaps that’s enough to be going on with for now, what kind of game were you thinking about doing?

I’d be interested in seeing the game you’ve made with it :slight_smile:

Basically I’m working on a 2d game engine, with the emphasis on some heavy customisation via scripting. Ideally I don’t want to spend ages on the collision detection and reaction for solid object, and focus on the reactions when non-solid objects interact (like players hitting door triggers, bullets shattering glass etc.).

Bear in mind i’m after something game-independant (as far as possible). Something like pong could be done totally with the rigid body interactions, but for something like a platform game you need a much more arcade-y feel to the player controls.

Is there some way I can ‘drive’ the simulation from my own app? Like create a mirror of the game level in Kinetix, and tell it to update its positions every game frame? Then i could pull out the data again and use it for actual rendering and any other game events that would be affected by it.The subclassing idea sounds possible but could introduce all sorts of headaches. Can objects not be set via code in an absolute way (as in, ignore physics and just set the position/angle/etc. straight off?)

Cheers :slight_smile:

[quote]Is there some way I can ‘drive’ the simulation from my own app?
[/quote]
Absolutely. Once the simulation has been set up all you need to do is call simulation.runTime( millis ), and kinetix will go off and run the appropriate number of iterations internally to update the the simulation with respect to time.

[quote]create a mirror of the game level in Kinetix, and tell it to update its positions every game frame? Then i could pull out the data again and use it for actual rendering and any other game events that would be affected by it.
[/quote]
Yeah, that’s what i was trying to convey with aproach number 2 above, and it seems the best way forward for your purposes.

The subclassing approach is kind of a masochistic way to make a game, but appropriate for the idea i had.

[quote]Can objects not be set via code in an absolute way
[/quote]
There’s no real problem with this, you just have to be a bit careful about collisions occuring when you do it. Setting the position of bodies explicitly is somewhat analogous to, in the real world, the Hand Of God reaching down and playing catch with a mountain. Sure, the mountain is going to be moved, but innocent bystanders are hoping that the almighty isn’t careless as millions of tonnes of rock and a few startled goats flick past overhead. :slight_smile:

I’ll put the game up when i get home and net access is cheap.

Kinetix was developed as part of my final year project, so i’ll also put up the report i wrote on it, which should gives some more background. It’ll take a few minutes as i regnerate all the image postscripts.

Edit : actually, scrap that. The university has just updated the system and so inevitably what was once easy has become nigh-on impossible. Useful latex compilers and dvi viewers have disappeared for now it seems :-/ So for now, no report.

There you go, the kinetix editor is now up to the latest version and the game is also available from

http://www.homepages.inf.ed.ac.uk/s9902505/