World of Goo Programming (Physics Engine Question)

15 replies [Last post]
Joined: 01/29/2011

Hello,

I am beginner in game programming.
For writing another game like world of goo, i start with SDL.
But i don't know how can use geometry and physics in game.
Do you know a book or engine to start geometry and physics in games?

Joined: 09/01/2009

ODE (Open Dynamics Engine) is what 2DBoy used in World of Goo, as far as I know (At least, ode.dll is there in the World of Goo folder).
Or, if you have a physics book handy and a bit of time on your hands, you can make your own engine. It's fun! Smile
Good luck!

Joined: 01/29/2011

Thank you for fast answering!!

Joined: 08/06/2010

For the most basic stuff, just write some code like

function everyFrame(){
     this.x += this.vX;
     this.y += this.vY;
     this.vY -= g;
     this.vX *= friction;
}

Then by changing vX and vY you can move the character around, and jump, and fall.

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 09/01/2009

I actually am toying around with some physics at the moment myself, and found that physics code such as gravitation is easier with vector velocity (velocity and direction) rather than separate X and Y velocities, but it depends on how you're going to use it. (If you want objects realistically glancing off each other, vectors are easier too)

Joined: 08/06/2010

I like using all 3 and converting them each frame. Best of both worlds.

Also you need the direction to rotate the sprites/images/whatever.

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 09/01/2009

Ah, yeah, like the rotational velocity? Haven't gotten that far yet myself, but I'll get there.

Joined: 12/23/2010

vahidb wrote:
Hello,

I am beginner in game programming.
For writing another game like world of goo, i start with SDL.
But i don't know how can use geometry and physics in game.
Do you know a book or engine to start geometry and physics in games?


Since you mentioned SDL, I'm assuming you're programming in C++? From what I know, the APE physics engine is a good bet. Although it's originally for ActionScript 3.0, there is a C++ SDL port, so you might want to look at that. Unfortunately it doesn't look like it's being developed anymore, but still...

http://www.cove.org/ape/ (the SDL port is on the right)

Joined: 08/06/2010

If it's C++, ODE would work well.

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 12/23/2010

That's cool. So what, anyone can just use the same physics engine as WoG for free? Just from that DLL?

Joined: 08/06/2010

Download from the web site.

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 09/01/2009

My guess is that you'd need to link in a couple libs too, but yes. Should be fairly straightforward. Most of the open source libraries that I've used from one time to another have been very easy to use.

Joined: 01/29/2011

puggsoy wrote:
vahidb wrote:
Hello,

I am beginner in game programming.
For writing another game like world of goo, i start with SDL.
But i don't know how can use geometry and physics in game.
Do you know a book or engine to start geometry and physics in games?


Since you mentioned SDL, I'm assuming you're programming in C++? From what I know, the APE physics engine is a good bet. Although it's originally for ActionScript 3.0, there is a C++ SDL port, so you might want to look at that. Unfortunately it doesn't look like it's being developed anymore, but still...

http://www.cove.org/ape/ (the SDL port is on the right)

Yes, i am programming in c++. Smile
I think ODE is enough for 2D game in c++.
Thanks

Joined: 12/23/2010

Yup, probably is. When (if) I get back into C++, I'll probably have a go at ODE. It seems more... reliable than APE. I mean, 2DBoy used it!

Only, I'm wondering, is it compatible with SDL?

Joined: 09/01/2009

Why wouldn't it be? I mean, SDL is a _graphics_ library while ODE is a _physics_ library. If they don't work with each other, there must be something terribly wrong with how you're trying to put them together. Besides this, 2DBoy used them together, so they must be compatible. The only reason that I could think of two libraries not working together is if they're conflicting (like OpenGL and DirectX) or if their copyrights don't fit together (but even then, a good lawyer might be able to make them work together).

Joined: 12/23/2010

Well that's cool then. It's just I didn't know that 2DBoy used SDL for WoG. It's just that from what I know of physics libraries and programming (my best experience being with AS2) is that if the physics library isn't made for a graphics library, it's gonna be pretty hard to get them to cooperate.

But now that's all cleared up Big smile