Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
21 May, 2013, 10:22:59 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1] 2 3   Go Down
  Print  
Author Topic: ChainFire Pinball Library -  (Read 3365 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 03:20:13
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5642


Topic starter
Total Post Ratings: +589

View Profile
« on: 12 February, 2011, 09:20:55 »
+8

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



* ChainFireScreenie1.gif (76.7 KB, 192x128 - viewed 656 times.)
* AXE.8xp (2.28 KB - downloaded 85 times.)
« Last Edit: 12 February, 2011, 20:36:06 by Builderboy » Logged

leafy
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 21:59:01
Date Registered: 26 December, 2010, 05:27:03
Location: the ninth circle of hell
Posts: 1545


Total Post Ratings: +371

View Profile WWW
« Reply #1 on: 12 February, 2011, 09:32:43 »
0

That looks freaking amazing. Reminds me of that sonic ball physics thing you did a while back.
Logged

In-progress: Blastlabs, TMJO, qb?, VVVVVV?
Finished: Tag, Tap, MFQT, Nyan
Dead: Graviter
Darl181
Vy'o'us pleorsdtu tlh'e gjaemue.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Gender: Male
Last Login: Today at 09:48:43
Date Registered: 10 June, 2010, 00:32:08
Location: {I*9+L₁+1},{I*9+L₁+3}
Posts: 3272


Total Post Ratings: +267

View Profile WWW
« Reply #2 on: 12 February, 2011, 09:32:48 »
0

Wow, this looks awesome Grin
Is this the start of a pinball clone by any chance, or is it just a proof of concept?

EDIT 600 posts w00t
« Last Edit: 12 February, 2011, 09:33:12 by Darl181 » Logged




 
Spoiler for Stuff:



OS 2.43  Boot 1.02  Hardware Rev. B

OS 1.04.32

OS 3.1.0.392  Boot1 3.0.99  Boot2 3.10.16
Spoiler for Misc:
Quote
You'll understand / It's not a shame / To be always / Losing the game / Burma-Shave
"Dynamic userbars!"
Omnimaga radio
Interactive Omnimaga radio
Our World of Text
Draw on websites
Then blow them up
In-browser flight simulator
Haxball: MMO soccer/air hockey game
  Draw with sand.  Yay?
The Game
You just lost the game
Zombo.com
light post color is #dfefff
dark post color is #cae4ff
quote box color is #6699ff
transparent color is...transparent 0.o
Spoiler for Forum search alternative (bookmarklet):
https://www.squarefree.com/bookmarklets/search.html
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("No%20selected%20text;%20enter%20search%20term.").replace(/\s\+/g,"%252B");if(q!=null)location="http://www.google.com/search?q="+q.replace(/\s+/g,"+")+"+site:"+location.hostname;void(0);
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 03:20:13
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5642


Topic starter
Total Post Ratings: +589

View Profile
« Reply #3 on: 12 February, 2011, 09:35:10 »
0

Thanks Cheesy 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 Smiley

And this is just a library I will be releasing to the public for anybody to use for anything they want Smiley 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.
Logged

Darl181
Vy'o'us pleorsdtu tlh'e gjaemue.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Gender: Male
Last Login: Today at 09:48:43
Date Registered: 10 June, 2010, 00:32:08
Location: {I*9+L₁+1},{I*9+L₁+3}
Posts: 3272


Total Post Ratings: +267

View Profile WWW
« Reply #4 on: 12 February, 2011, 09:49:40 »
0

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 Grin
Logged




 
Spoiler for Stuff:



OS 2.43  Boot 1.02  Hardware Rev. B

OS 1.04.32

OS 3.1.0.392  Boot1 3.0.99  Boot2 3.10.16
Spoiler for Misc:
Quote
You'll understand / It's not a shame / To be always / Losing the game / Burma-Shave
"Dynamic userbars!"
Omnimaga radio
Interactive Omnimaga radio
Our World of Text
Draw on websites
Then blow them up
In-browser flight simulator
Haxball: MMO soccer/air hockey game
  Draw with sand.  Yay?
The Game
You just lost the game
Zombo.com
light post color is #dfefff
dark post color is #cae4ff
quote box color is #6699ff
transparent color is...transparent 0.o
Spoiler for Forum search alternative (bookmarklet):
https://www.squarefree.com/bookmarklets/search.html
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("No%20selected%20text;%20enter%20search%20term.").replace(/\s\+/g,"%252B");if(q!=null)location="http://www.google.com/search?q="+q.replace(/\s+/g,"+")+"+site:"+location.hostname;void(0);
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 03:20:13
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5642


Topic starter
Total Post Ratings: +589

View Profile
« Reply #5 on: 12 February, 2011, 09:54:29 »
0

Thats my goal Smiley To make it as easy as possible for people to get advanced physics in their games. ^^
Logged

Hot_Dog
If you can't find a cat, look for its tail.
Support Staff
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: 09 May, 2013, 19:22:43
Date Registered: 28 December, 2009, 18:47:54
Location: Midland, Washington
Posts: 2940


Total Post Ratings: +428

View Profile
« Reply #6 on: 12 February, 2011, 10:33:53 »
0

Builderboy, this is so amazing that I wish you would make your own pinball game Cheesy

No pressure Wink
Logged

There are people who can speak two languages, and they are called bilingual.  There are people who speak three languages and are therefore trilingual.  Then there are people who speak one language, and these people are called Americans.

AngelFish
This is my custom title
Administrator
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Gender: Male
Last Login: 18 May, 2013, 00:41:29
Date Registered: 15 August, 2010, 09:18:54
Posts: 3187


Total Post Ratings: +218

View Profile
« Reply #7 on: 12 February, 2011, 10:43:20 »
0

Thats my goal Smiley To make it as easy as possible for people to get advanced physics in their games. ^^

I'll take a modeling engine, please Tongue
Logged

∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 03:20:13
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5642


Topic starter
Total Post Ratings: +589

View Profile
« Reply #8 on: 12 February, 2011, 10:55:41 »
0

What do you mean?
Logged

z80man
Casio Traitor
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 04 September, 2012, 19:42:33
Date Registered: 26 December, 2010, 10:02:50
Location: City 17
Posts: 966


Total Post Ratings: +83

View Profile
« Reply #9 on: 12 February, 2011, 11:27:08 »
0

Is that like a 2d modeling engine to draw polygons on the screen?
Logged


List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)
AngelFish
This is my custom title
Administrator
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Gender: Male
Last Login: 18 May, 2013, 00:41:29
Date Registered: 15 August, 2010, 09:18:54
Posts: 3187


Total Post Ratings: +218

View Profile
« Reply #10 on: 12 February, 2011, 11:33:51 »
0

Well, I was hoping for something like a 3D physics engine...

j/k
Logged

∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ
Art_of_camelot
The matrix has you.. ಠ_ಠ
Support Staff
LV12 Extreme Poster (Next: 5000)
*
Online Online

Last Login: Today at 10:22:55
Date Registered: 30 August, 2008, 04:55:55
Location: Dr. Light's Laboratory
Posts: 4388


Total Post Ratings: +149

View Profile WWW
« Reply #11 on: 12 February, 2011, 14:55:54 »
0

Cool stuff as always Builderboy! =)
Logged

Projects:
TBA! Coming to an 83+ near you!

NerdTests.com says I'm a Cool Nerd King.  Click here to take the Nerd Test, get nerdy images and jokes, and write on the nerd forum!


ztrumpet
The Rarely Active One
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 23 April, 2013, 16:09:52
Date Registered: 08 November, 2009, 21:10:12
Location: Michigan
Posts: 5687


Total Post Ratings: +360

View Profile
« Reply #12 on: 12 February, 2011, 16:27:38 »
0

Looks great!  It's really fun to play with. Grin
Logged

graphmastur
King Graphmastur
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 02 February, 2013, 08:34:45
Date Registered: 03 June, 2010, 21:15:55
Posts: 2262


Total Post Ratings: +60

View Profile
« Reply #13 on: 12 February, 2011, 19:49:38 »
0

I can't seem to find a download for this.  Is there one yet?
Logged

Madskillz
LV6 Super Member (Next: 500)
******
Offline Offline

Last Login: Today at 03:44:11
Date Registered: 10 September, 2008, 19:17:24
Posts: 494

Total Post Ratings: +32

View Profile
« Reply #14 on: 12 February, 2011, 19:51:07 »
0

As always the physics look awesome.

Don't think there is a download yet graphmastur
Logged
Pages: [1] 2 3   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.35 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.