Resources for 2d game physics [closed]

我的未来我决定 提交于 2019-11-28 02:45:41
mistrmark

Here are some resources I assembled a few years ago. Of note is the Verlet Integration. I am also including links to some open source and commercial physics engines I found at that time. There is a stackoverflow article on this subject here: 2d game physics?

Physics Methods

Books

  • "Game Physics Engine Development", Ian Millington -- I own this book and highly recommend it. The book builds a physics engine in C++ from scratch. The Author starts with basic particle physics and then adds "laws of motion", constraints, rigid-body physics and on and on. He includes well documented source code all the way through.

Physics Engines

David Koelle

Speaking from experience, implementing a 2D physics engine is pretty difficult. I'll detail the several steps I took when creating my engine.

  1. Collision detection. Collision detection can be a difficult problem, even when you're not dealing with 3D worlds or networked simulations. For 2D physics, you definitely want to use the Separating Axis Theorem. Once you've implement SAT, you're half-way done making the dynamics portion of your engine.

  2. Kinematics/Dynamics. Chris Hecker has written an excellent online resource which walked me through collision response step-by-step.

  3. Everything Else. Once you've got the collision detection/response finished, its a matter of implementing everything else you want in the engine. This can include friction, contact forces, joints, along with whatever else you can think of.

Have fun! Creating your own physics simulation is an incredibly rewarding experience.

This is a great tutorial that demonstrates 2D physics concepts using flash and is not specific to flash. http://www.rodedev.com/tutorials/gamephysics/game_physics.swf

Even if you want to learn it all from the bottom up, an open source physics library that is well coded and documented contains far more information than a book. How do I deal with situation x... find in files can be faster than a paper index.

Original response:

What, no mention of Box2D? Its an open source side project of a blizzard employee, has a good community, and well, works great.

In my (brief) experience with Box2D, integrating it with Torque Game Builder, I found the API clean to use, documentation was clear, it supported all the physics objects I expected (joints in particular were a requirement), and the community looked friendly and active (sometime around early 2010).

Judging by forum posters, it also appeared that managers were receptive to source contributions (that did not carry license baggage).

It's island based solver seemed quite fast, as I expected from its reputation, not that I did any major performance testing.

F# has a feature called Units of Measure which does dimensional analysis for you, providing errors if you get it wrong. For example if you say:

let distance : float<meters> = gravity * 3.0<seconds>

That would yield a compile-error, since gravity is < meters/seconds^2 > and not < meters >. Also, since F# is just .NET you can write your math/physics code in a class library and reference that from your C#.

I'd reccomend you check out these blog posts for more information:

This is a great resource for writing your first engine. It's in 3D but it's very easy to convert down to 2D. I know at least one big company that followed this tutorial for their internal engine, and i personally have followed his steps for my own engine. He explains all the basic physics concepts in spring/impulse based physics, and shows you how to write your own intergrater.

The F#.NET Journal has published two articles about this:

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!