Sign in to follow this  
venture

2D Physics Engine for Mining Game

Recommended Posts

venture    100
Just curious about something. This would be for a project I would be starting in, at the bare minimum, 1.5 years(after I've experimented with programming and am sufficiently comfortable with it. So, no, I'm not planning on jumping into a complex project initially :wink:)



I was wondering if there was a 2D physics engine available that would be able to handle a mining game.

Essentially, 2D, "Minecraft-esque" but not based around blocks. Using a pickaxe, drill or other tool would dislodge and fragment earth, stone etc. which could then be placed by the player. Dropping a handful of dirt would cause it to fall and spread like, well, dirt.

Players would also have to reinforce their tunnels to prevent a collapse, and would have to process stone chunks into, for example, brick before they would be able to build.

Ideally, it would also be able to handle things like rock slides, pressurized oil underground and other such things.


Does a physics engine exist that will be able to do this? If one does not, I will either have to seriously re-think or scrap this project, as creating my own engine would be a monumental undertaking of which I will likely never be ready for.

Share this post


Link to post
Share on other sites
Gamer Gamester    140
What programming language are you considering? See if there's a version of Box2D for it. Box2D is a great physics engine that is free, open-source, and pretty easy to figure out if you understand basic physics concepts.

Share this post


Link to post
Share on other sites
venture    100
C++, if that matters.


I've done a bit of research, and was currently planning on going with Farseer, which appears to be based on Box 2D. I was just wondering if:
A. It has the capabilities I need(from what you are saying, it appears it does)
and
B. If there were any other engines I have missed.

Share this post


Link to post
Share on other sites
BeerNutts    4401
Chipmunk physics is a great 2D physics library. It out performs Box2D. Box2D has been out longer, so it's more well known, but I'd check out [url="http://code.google.com/p/chipmunk-physics/"]Chipmunk Physics[/url]

Share this post


Link to post
Share on other sites
laztrezort    1058
I don't know anything about Chipmunk, but Box2D (and similar) libraries typically model rigid bodies. What you seem to be talking about are fluid dynamics, which AFAIK much more complex and processor hungry. The large worlds of Minecraft and Terraria depend on simplifying things by basing everything on cells (blocks), greatly simplifying physics, and even then need to be optimized. [url="http://www.gamasutra.com/view/feature/6367/an_intro_to_cellular_automation.php"]Here[/url] is an article about the use of cellular automata in these types of games, if you are interested.

Share this post


Link to post
Share on other sites
venture    100
[quote name='laztrezort' timestamp='1314074624' post='4852647']
I don't know anything about Chipmunk, but Box2D (and similar) libraries typically model rigid bodies. What you seem to be talking about are fluid dynamics, which AFAIK much more complex and processor hungry. The large worlds of Minecraft and Terraria depend on simplifying things by basing everything on cells (blocks), greatly simplifying physics, and even then need to be optimized. [url="http://www.gamasutra.com/view/feature/6367/an_intro_to_cellular_automation.php"]Here[/url] is an article about the use of cellular automata in these types of games, if you are interested.
[/quote]

Chipmunk is based on Box2D to my knowledge. Thank you for that article- reading it currently.

I still have a lot to grasp and figure out about this whole process but: to your knowledge, can what I desire be handled? And if not, could I replicate it, perhaps by scaling down the size of cells, or by other means?

Share this post


Link to post
Share on other sites
BeerNutts    4401
[quote name='Venture' timestamp='1314083923' post='4852679']
[quote name='laztrezort' timestamp='1314074624' post='4852647']
I don't know anything about Chipmunk, but Box2D (and similar) libraries typically model rigid bodies. What you seem to be talking about are fluid dynamics, which AFAIK much more complex and processor hungry. The large worlds of Minecraft and Terraria depend on simplifying things by basing everything on cells (blocks), greatly simplifying physics, and even then need to be optimized. [url="http://www.gamasutra.com/view/feature/6367/an_intro_to_cellular_automation.php"]Here[/url] is an article about the use of cellular automata in these types of games, if you are interested.
[/quote]

Chipmunk is based on Box2D to my knowledge. Thank you for that article- reading it currently.

I still have a lot to grasp and figure out about this whole process but: to your knowledge, can what I desire be handled? And if not, could I replicate it, perhaps by scaling down the size of cells, or by other means?
[/quote]

No, it's not based on Box2D, he used some idea for his original implementation from box2d, but it's since been improved upon. The author made his own 2d physics implementation, and his latest release, v6.0.1 is really fast.

As far as what you want to do, it depends on the scale of "particles" you plan on using. If you can assign each piece of "earth" that becomes dislodged as separate body/shape, then you'll be OK. Otherwise, I'm not sure how you'd accmoplish what you want.

Share this post


Link to post
Share on other sites
laztrezort    1058
[quote name='Venture' timestamp='1314083923' post='4852679']
[quote name='laztrezort' timestamp='1314074624' post='4852647']
I don't know anything about Chipmunk, but Box2D (and similar) libraries typically model rigid bodies. What you seem to be talking about are fluid dynamics, which AFAIK much more complex and processor hungry. The large worlds of Minecraft and Terraria depend on simplifying things by basing everything on cells (blocks), greatly simplifying physics, and even then need to be optimized. [url="http://www.gamasutra.com/view/feature/6367/an_intro_to_cellular_automation.php"]Here[/url] is an article about the use of cellular automata in these types of games, if you are interested.
[/quote]

Chipmunk is based on Box2D to my knowledge. Thank you for that article- reading it currently.

I still have a lot to grasp and figure out about this whole process but: to your knowledge, can what I desire be handled? And if not, could I replicate it, perhaps by scaling down the size of cells, or by other means?
[/quote]

As Beernutts suggested, you can use small(ish) bodies to represents fragments of earth and rock to simulate falling chunks, rockslides, etc. However, pressurized fluids may be a whole different matter. Also, at some point, all physics simulations no matter how fast will be limited by the number of active bodies. These libraries are typically highly optimized, however, such as putting bodies to "sleep" if they are not in motion, and using broad phase collision to limit collision checks. In the end it will depend on how large of a world you are trying to represent, and how small the bodies will be. My advice would be to experiment with a particular library, and see what can and cannot be accomplished with it. You may have to mix methods, such as rigid bodies, cellular automata and "just plain faking it" to get what you are looking for.

Share this post


Link to post
Share on other sites
venture    100
[quote name='laztrezort' timestamp='1314111376' post='4852795']
[quote name='Venture' timestamp='1314083923' post='4852679']
[quote name='laztrezort' timestamp='1314074624' post='4852647']
I don't know anything about Chipmunk, but Box2D (and similar) libraries typically model rigid bodies. What you seem to be talking about are fluid dynamics, which AFAIK much more complex and processor hungry. The large worlds of Minecraft and Terraria depend on simplifying things by basing everything on cells (blocks), greatly simplifying physics, and even then need to be optimized. [url="http://www.gamasutra.com/view/feature/6367/an_intro_to_cellular_automation.php"]Here[/url] is an article about the use of cellular automata in these types of games, if you are interested.
[/quote]

Chipmunk is based on Box2D to my knowledge. Thank you for that article- reading it currently.

I still have a lot to grasp and figure out about this whole process but: to your knowledge, can what I desire be handled? And if not, could I replicate it, perhaps by scaling down the size of cells, or by other means?
[/quote]

As Beernutts suggested, you can use small(ish) bodies to represents fragments of earth and rock to simulate falling chunks, rockslides, etc. However, pressurized fluids may be a whole different matter. Also, at some point, all physics simulations no matter how fast will be limited by the number of active bodies. These libraries are typically highly optimized, however, such as putting bodies to "sleep" if they are not in motion, and using broad phase collision to limit collision checks. In the end it will depend on how large of a world you are trying to represent, and how small the bodies will be. My advice would be to experiment with a particular library, and see what can and cannot be accomplished with it. You may have to mix methods, such as rigid bodies, cellular automata and "just plain faking it" to get what you are looking for.
[/quote]

Alright. Some more research is probably required on my part. No real worry, as I have plenty of time.

But would the overall consensus be Chipmunk? Farseer?

Which is the overall more powerful?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this