Omnimaga
Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: Builderboy on February 12, 2011, 02:20:55 am
-
So with the recent influx of physics related games, as well as a recent increase in the interest of ball physics, I have become a bit more interested in it myself, and so I spent all of Bio the other day and a considerable amount of time out of class writing this pinball physics engine for pixel based collision. It uses the onscreen pixels only for collision, although it could easily be changed to a backbuffer or alternative buffer. This is developed for pinball games in mind, and has several changeable variables which can change the way the ball behaves:
Collision Elasticity: from 0% to 100% How much energy the ball retains after a collision with a wall or object
Rolling Angle Threshold: from 0 to 90 degrees, this value changes how small of an angle the ball has to hit the wall to switch to rolling physics. If this number is very small, the ball will bound around a lot, if this number is very large, the ball will tend to 'stick' to walls.
These values are currently hardcoded into the code, but in the future I hope to release a flexible engine with a large number of changeable parameters. As for the engine itself, this is how it works:
The balls position is first backed up, and then incremented by the velocity. If the ball collides with anything, we enter the collision test segment. The ball checks the pixels around it to determine the surface normal vector of the wall it collided with. It then normalizes that vector and uses it to move the ball backwards out of the wall. If the vector is not accurate enough to get the ball out of the wall, the balls backed up position value is used instead. We then find the dot product of the balls velocity and the surface normal vector, resulting in a value from -M to M, where M is the magnitude of the velocity of the ball. If this value is greater than the Rolling angle threshold, perform the vector transformations to subtract the perpendicular vector component from the velocity of the ball. If the value is less than the Rolling angle threshold, the perpendicular vector is negated, and then multiplied by the Collision Elasticity value.
Thats a lot of technical mumbo jumbo, lets just get to the screenshots, enjoy! The screenshot it running with a collision elasticity of 0.5 and a rolling angle threshold of 22.5 degrees
-
That looks freaking amazing. Reminds me of that sonic ball physics thing you did a while back.
-
Wow, this looks awesome ;D
Is this the start of a pinball clone by any chance, or is it just a proof of concept?
EDIT 600 posts :w00t:
-
Thanks :D My hope was to get it looking as good as the sonic physics engine ^^ That uses a much more stable algorithm than this one, and so it was a lot easier to get good physics, plus it was tile based. For this, it was a lot more difficult, so my hope was to get it as good looking as sonic :)
And this is just a library I will be releasing to the public for anybody to use for anything they want :) This is in the same branch as Zedd, its a physics library made to make it easier for people to write games with high physics elements in them.
-
And at this rate, it looks like something's going to crop up soon...
If Tio weren't keeping me busy, I would try it in a blink ;D
-
Thats my goal :) To make it as easy as possible for people to get advanced physics in their games. ^^
-
Builderboy, this is so amazing that I wish you would make your own pinball game :D
No pressure ;)
-
Thats my goal :) To make it as easy as possible for people to get advanced physics in their games. ^^
I'll take a modeling engine, please :P
-
What do you mean?
-
Is that like a 2d modeling engine to draw polygons on the screen?
-
Well, I was hoping for something like a 3D physics engine...
j/k
-
Cool stuff as always Builderboy! =)
-
Looks great! It's really fun to play with. ;D
-
I can't seem to find a download for this. Is there one yet?
-
As always the physics look awesome.
Don't think there is a download yet graphmastur
-
There is a download now :) Be warned that there are still some small bugs that you might encounter. Nothing engine crippling, but it will present some oddities.
-
Oooh, I do see some oddities. Other than that, it's pretty interesting. does it support of the screen were to scroll?
-
O.O
/me wonders if Builderboy is planning to port Acelgoyobis or Sonic to Axe...
-
O.O
/me wonders if Builderboy is planning to port Acelgoyobis or Sonic to Axe...
Noting all the things he's been doing with physics, I wouldn't doubt it.
-
O.O
/me wonders if Builderboy is planning to port Acelgoyobis or Sonic to Axe...
Noting all the things he's been doing with physics, I wouldn't doubt it.
Nah, it's neither of these two...
(The hints stop there... maybe)
-
And now for color physics... :P
-
And now for color physics... :P
Oh, so you will give us screenies soon, right....
-
...on the TI-84+
-
...on the TI-84+
oh. No, on the prizm. Like. now...
-
I need the screen address first. Once I have that, then I can start writing and testing physics routines.
-
Nah, it's neither of these two...
(The hints stop there... maybe)
Why whatever could you mean ztrumpet, its almost as if you are implying you know something... ;)
-
:O
/me pokes Builderboy for working again on some games
-
This looks awesome Deep Thought! Pure epic! It looks so real (the physics)!
-
Deep Thought?
-
Deep Thought?
Builderboy* Yeah, sorry, we were talking on IRC at the time.
-
Hahah gotcha, thanks :D
-
So I wonder if anyone could make Sonic with this? Also would Nspire Lua be fast enough for this?
-
someone probably could, but i don't know how well it would work with screen scrolling. that would probably slow things down considerably. there's not really any reason for calc sonic to have physics this advanced (eg, all the sticking to walls stuff). it could just determine by your speed upon entering a loop/half loop or something whether or not you are going fast enough to make it around.
-
This is not the engine you would want to use, that one would be this:
http://ourl.ca/7764
Which is a lot less computationally intensive than chainFire, and it replicates the physics of sonic using the specific algorithms and method that the original sonic used! And adding scrolling wouldn't harm the physics calculations in the slightest, it would just add the computational time of doing the actual scrolling.
-
Ah ok thanks for the info. I guess at such small resolution not as much precision is needed indeed. Now for a Sonic project, someone would have to make the tiles and sprites, though. :P