Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / FREE 2D Physics Engine Plugin!

Author
Message
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 27th Oct 2007 19:53 Edited at: 27th Oct 2007 19:53
I played around a bit and this is something I made. It really isn't much, but I can't do much more until the help is done. Do you have any idea how much longer it will take? Thanks

I based it off the falling box demo, if that's ok with you.



Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 27th Oct 2007 20:42
@UFO
Nice demo Gives me an idea for another...

@H4ck1d
How are the help files going?
Upload what you have so far anyway

UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 27th Oct 2007 23:05 Edited at: 28th Oct 2007 00:57
I made another demo.

You can make the boxes and circles whatever size you want, and you can change the density also.

The demo displays the instructions if you are confused.



Edit: Commented and cleaned it up a bit
Edit2: Added previews
Edit3: Press middle mouse button when in drag mode to clone last made shape

I can't want to do more serious stuff

Your signature has been erased by a bad joke
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 28th Oct 2007 00:01 Edited at: 28th Oct 2007 00:02
Really awesome plugin!!!

Here is a "Water" demo



Try to play with it and see if you can get some intresting results

[center]
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Oct 2007 00:33
@Roxas
Wow! Even I didn't know Box2D could do that!

UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 28th Oct 2007 00:56
uhm. I don't think the plugin is ever going to be strong enough to do water like that >.<. It also quits on me after a few seconds.

I edited the demo again.

Your signature has been erased by a bad joke
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Oct 2007 10:56
@UFO
The demo works fine for me...
Also, some time in the future, Box2D will get particles, so then we CAN do water effects like this!
I like your new demo as well

UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 28th Oct 2007 21:19 Edited at: 28th Oct 2007 23:27
Will/does the plugin have any explosion functions? Like, being able to specify the x,y, and power of an explosion, and it will effect any object with density?

Also, how to you set an object's velocity? Like making something jump. I looked in the keywords file, and found a velocity command, but can't get it to work.

Thanks!

Quote: "Also, some time in the future, Box2D will get particles, so then we CAN do water effects like this!"

That would be great!

Your signature has been erased by a bad joke
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Oct 2007 01:25
@UFO
b2SetBodyLinearVelocity BodyID,x,y
b2SetBodyAngularVelocity BodyID,w

BTW, I added your two demos and Roxas's demos to the examples thread

UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 29th Oct 2007 01:49 Edited at: 29th Oct 2007 01:50
Quote: "@UFO
b2SetBodyLinearVelocity BodyID,x,y
b2SetBodyAngularVelocity BodyID,w"


That's what I tried. I had this code:

If shiftkey() = 1 then b2setbodylinearvelocity characterbody,0,-5

Should that make the object jump? It didn't work for me. It probably wasn't any other reason because I checked. But if it should work, I will try to look deeper for the problem once I am sure the command should actually work.

Or even better, can you make a simple demo with velocity stuff? That would be great!

Thanks

Quote: "BTW, I added your two demos and Roxas's demos to the examples thread"


I already saw :-P I'm glad you liked them

Your signature has been erased by a bad joke
aluseus GOD
17
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 31st Oct 2007 04:08
When are polygons going to be able to have infinite lines? And I just realized something. Even if making concave shapes is very easy to do with Box2D, most shapes are at least a little concave and it would help if you included support for it.

This isn't a sig. It's me disguised a sig. Can you get me out?
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 31st Oct 2007 11:01
@aluseus GOD
Both meshes and convex decomposition (Decomposing a concave shape into multiple convex ones) are on the todo list, along with CCD, particles and ropes, but as the actual engine is not being developed by me, I can't speed up the process. Basically, they get added to the engine when they get added to the engine. I can only speed up how long after that they get added to the plugin (Which has been within a day or so usually!)

Grandma
18
Years of Service
User Offline
Joined: 26th Dec 2005
Location: Norway, Guiding the New World Order
Posted: 1st Nov 2007 20:23
Great work, diggsey. I'll be keeping an eye on this physics engine. I want to make a craptacular 2D game one day, and this plugin might just be what i need.

This message was brought to you by Grandma industries.

Making yesterdays games, today!
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 1st Nov 2007 23:19
You got featured in the newsletter!

To those who haven't seen the demos thread:

Quote: "Gah, sorry, finally got a chance to post! I'm involved in a musical and atm we're about a week away from production, so it's taking up nearly all of my free time, while homework's been kind enough to take up the rest. So there's a slight problem - I can't find my flash drive that the help files are on again. Luckily, I think that it should be fairly easy to locate if I look, so I intend to take a look around my house tonight as I've got a little bit of free time. Sorry! I'll post back by tomorrow and let you all know what's going on."


-H4ck1d

I hate it when that happens I like to put the cap of my jump drive on my backpack, so when I go to get it, I see the cap and remember to get the drive. It works great

I hope you can get your jump drive back!

Your signature has been erased by a bad joke
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 2nd Nov 2007 01:28 Edited at: 2nd Nov 2007 05:23
This is very cool. I spent literally half an hour watching those boxes fall off on the first demo.


"Fire is always at the top of the food chain, and it has a big appetite."
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 2nd Nov 2007 11:24
Thanks everyone!

@Grandma

Can't wait for that craptacular game

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 2nd Nov 2007 14:36 Edited at: 2nd Nov 2007 14:38
Hehee.. I hope the guy makes the box3d plugin so you can wrap that too

And i can add it to Flare Engine!

Edit:

I found this http://www.bulletphysics.com/Bullet/
Can you wrapper it if you have time? That looks nice 3d physics plugin that i can add to Flare Engine

[center]

Click for details!
Alien Menace
AGK Developer
19
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Earth (just visiting)
Posted: 10th Nov 2007 20:58


A quick little ragdoll demo. Hope you like it.

Dr Schnitzengruber
17
Years of Service
User Offline
Joined: 19th Jul 2007
Location: C:/Projects/failed/ schnitzengruber
Posted: 11th Nov 2007 05:12
point point

the answer to life the universe and everything = 42
Alien Menace
AGK Developer
19
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Earth (just visiting)
Posted: 11th Nov 2007 06:41
Hi,

I can't seem to figure out how to add density, restitution, and friction to a shape. Erin's documentation says "Specifying mass values directly can often lead to poorly tuned simulations. Therefore, the mass density per unit area is specified in the shape definition." but I can't seem to find anywhere to specify it. I was thinking commands like b2ShapeDensity, b2ShapeFriction would be handy. If I am thinking about this wrong or missing something then please let me know.


Keep up the good work, I have more demos ready and will post some later.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 11th Nov 2007 10:28
@Alien Menace
Great demo!

Currently those values are chosen when you first create the shape, and are multiplied by the area to give the mass.

@Dr Schnitzengruber
Already commented It's a really good idea for a game!

Alien Menace
AGK Developer
19
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Earth (just visiting)
Posted: 11th Nov 2007 18:03 Edited at: 12th Nov 2007 03:25
Diggsey,

Please bear with me, I can be a little dense sometimes.

How do you specify these properties (density,restitution,friction) when using:
b2CreatePolygonShape(x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8)

I thought you may be able to specify these when adding the shape to the template but x,y,and rotation seem to be the only additional paramters:
b2AddShapeToBodyTemplate(TemplateID,ShapeID,x,y,angle

My problem is knowing how to set these properties using a convex polygon shape.

Anyhow, here is another demo:





Cheers.
Alien Menace
AGK Developer
19
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Earth (just visiting)
Posted: 11th Nov 2007 23:26
The ropebridge demo image isn't showing up for some reason, so here's another try...

aluseus GOD
17
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 20th Nov 2007 02:54
hey diggs. I have a request. A big one, but you dont have to, i just want to know if you would.
Would you make it so that you can create a vector shape from a sprite and add that as an object in the 2d plugin?

alus.portbb.com go there. Quote: A book. I hate books. book is stupid. I know that I need codes but I dont know the codes -zenicanin14 the stupidest user in the world
culmor30
17
Years of Service
User Offline
Joined: 16th Jun 2007
Location: In my head.
Posted: 21st Nov 2007 04:28
This is composed of pure awesome. Thank you very much.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 21st Nov 2007 18:03 Edited at: 21st Nov 2007 18:04
@Alien Menace
Great demo

@Aluseus GOD
There isn't really much point, because it would be very inefficient, and it is easier to use the shape editor I made

@culmor30
Thanks

aluseus GOD
17
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 22nd Nov 2007 16:07
k

alus.portbb.com go there.
Quote: A book. I hate books. book is stupid. I know that I need codes but I dont know the codes -zenicanin14 the stupidest user in the world
Da_Donik
17
Years of Service
User Offline
Joined: 9th Dec 2006
Location: Southern Germany
Posted: 22nd Nov 2007 20:12
Very nice plugin diggsey!

But...
is it just me, or has anyone else problems with polygon shapes.
To me it seems like they are static. They just hang around in the
air, while "normal" bodys (created with the box and circle commands) are affected by the gravity.

Collision with those polygonal shapes is fine...but having no gravity on those...

Greets
Donik
Alien Menace
AGK Developer
19
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Earth (just visiting)
Posted: 23rd Nov 2007 08:24
Quote: "Collision with those polygonal shapes is fine...but having no gravity on those..."


I'm not sure how to define the physics properties (restitution, mass, friction) of polygon shape so it would logically default to 0,0,0 thereby making it a static object... I think. Maybe Diggsey can help us out with some example code of how to do this.
Dr SAndras
17
Years of Service
User Offline
Joined: 4th Oct 2007
Location:
Posted: 24th Nov 2007 18:04
Sorry, may I ask you to create another compile of ShapeEditor?
If I try it to run, I will get an error message: Shape Editor can't run without MSVCP71.dll...

(See in the picture(Sorry, but I use Hungarian Windows))

Thank you for help!

Attachments

Login to view attachments
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 1st Dec 2007 18:01
Dr. SAndras - http://www.google.com/search?q=MSVCP71.dll&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

And I don't think he released the shape editor yet. If he did, where is it?

Alien Menace
AGK Developer
19
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Earth (just visiting)
Posted: 2nd Dec 2007 08:42
Quote: "And I don't think he released the shape editor yet. If he did, where is it?"


It should be in a directory called "Shape Editor", the filename is ShapeEditor.exe.
Dark Developer
18
Years of Service
User Offline
Joined: 31st Aug 2006
Location: Mindspace
Posted: 18th Dec 2007 11:05
Can we create a ragdoll based game with this plugin?
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 18th Dec 2007 13:03
@Dark Developer
Yes

@Everybody
Erin Catto has got CCD working, but I am waiting for the official release before I add it to the plugin

TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 18th Dec 2007 15:28
Yay!!!

Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 20th Dec 2007 11:53 Edited at: 20th Dec 2007 19:53
Hey, I made a little game using this, which I may expand on later.

Instructions for the game:

Try to levitate the Monkey Ball by spawning particles underneath it. Your score increases slowly by default and it doubles every time you get to a door. Your score is divided by 50 if you fall..

The game gets a little harder each time you get to a door, but not very much harder as I just made this tonight.

Controls:
Spawn Particles ~ Click

Code is included in download.

If people like this, I am thinking about turning it into a 2d scroller, in which you'd levitate the ball and try to reach powerups and such. I may even do so if people don't like it :p

A Screenshot:


Awesome work Diggsey!



[EDIT]: Oops, I took out a picture from the media folder that
is still being loaded even though I don't use it. Just add any picture to the media folder called "Background.png", and the error will stop.

This is a random sentence about squirrels.

Attachments

Login to view attachments
Profit
18
Years of Service
User Offline
Joined: 19th Feb 2006
Location: United States
Posted: 30th Dec 2007 20:01 Edited at: 30th Dec 2007 20:06
When I tried to play your game, it showed the following error:
"Runtime Error 1507 - Display using 32 bit is not supported by available hardware at line 0"
I attempted to compile the project myself, but had no luck. (It was related to arrays. Yes, I have the plugin.)
Are you using the latest version of DBP?

common people are walking in line.
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 30th Dec 2007 21:28
I think that means he set the games screen resolution to a higher value than you hardware supports.

Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 1st Jan 2008 05:16
Oops, my bad! I'm away on vacation at the moment and can't get to my code, but I'll re-upload it when I get back with code to fix the resolution.
Sorry ><

This is a random sentence about squirrels.
lava man
17
Years of Service
User Offline
Joined: 19th Jan 2007
Location: west allis wisconsin
Posted: 1st Jan 2008 19:23
wow this is awsome the wheels are turning in my head i just was wondering when was the help file with the command list going to be out

Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 4th Jan 2008 08:10 Edited at: 4th Jan 2008 20:56
Here is the new version, with different resolution support, and I fixed the media bug!

http://www.mediafire.com/?2gnnzxx3tjy

This is a random sentence about squirrels.
DB PROgrammer
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location: Nowhere But Everywhere
Posted: 12th Jan 2008 10:11
I would really like a "b2bodyexist" command BTW great plugin!

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 12th Jan 2008 10:31
I am thinking of adding this to my Flare Engine's scripting system so i could make some nice 2d mini games And other nice stuff


Click For Details!
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 12th Jan 2008 17:06
Diggsey is there a bug with the pulley joint? It appears that when the units are set to 0.1meters, all the values are still taken in in meters so i had to divide them all by 10.

This code works (although the pulleys are different from i expected) only when the values in pulley joint are in meters, even though the units are set to 0.1meters. If i set the units to meters and multiple all the values by 10 it also works.

Maybe it is just me being stupid...

Let me know if there is a pulley joint example.



Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Jan 2008 17:35
@Xlaydos
No, you are right. The units are a bit dodgy at the moment Things like force and momentum don't take them into account properly. This will be fixed in the next update, but for now, it's not too hard to work around it

NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 15th Jan 2008 19:51
Sorry to make a big bump, but I think I've found a bug. I'm not sure whether it's in Box2D or your brilliant wrapper.
Make a box, and use b2EnableBodyPosition to disable the positioning. It will turn, but if you drop objects on it, they collide with the model as if it is still not rotated.


By putting a signpost in the middle of nowhere, you're making it somewhere.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 15th Jan 2008 22:32
I see what you mean, although for me, it is the other way around. Anyway, it's probably because the way I did it was a bit of a hack, whereas V2.0 will have the proper functionality built in

NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 17th Jan 2008 21:19 Edited at: 17th Jan 2008 23:53
I can't seem to find a command to check if a body exists or has exited the world space. Another thing I just found (not that you can really fix it) is that if you time the game to the TIMER command, dragging the window around causes absolute mayhem in the physics engine, especially if you have your system set to not think about programs whilst dragging them.

Rapid texture streaming, Pixel shaders gleamin',
Cooling fans a screaming, And power bills a reaming.
darkSMASH: http://forum.thegamecreators.com/?m=forum_view&t=121881&b=8
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 17th Jan 2008 23:53
You can't check if a body exists, because the ID you get is a pointer You should nullify your pointers when you delete a body, so you will know that it doesn't exist if the pointer is zero. I will add a command to check if it has exited the world space though

NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 17th Jan 2008 23:54
Ok. Thanks.

Rapid texture streaming, Pixel shaders gleamin',
Cooling fans a screaming, And power bills a reaming.
darkSMASH: http://forum.thegamecreators.com/?m=forum_view&t=121881&b=8

Login to post a reply

Server time is: 2024-11-24 07:56:37
Your offset time is: 2024-11-24 07:56:37