(The Unofficial) PopCap Framework Developer Board
September 23, 2017, 12:33:34 AM CEST *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home   Forum   Help Calendar Contact Login Register  
Pages: [1] 2 3   Go Down
  Print  
Author Topic: ODE physics in the popcap framework!  (Read 18739 times)
0 Members and 2 Guests are viewing this topic.
vortex
Guest
« on: July 16, 2006, 06:25:04 AM CEST »

Hello everyone Smiley. I just wanted to share a small demo of what I have been working on lately.

It is a 2d physics demo using the popcap framework version 1.2. The new transform functions are great!

Ode Test

The controls are:

Left click to create a box
Right click to create a circle
Middle click to make objects converge to a point

If there is enough intrest in this, I will eventually share my source code, with a tutorial on how I did it Cheesy.

Enjoy, and let me know if there are any problems.
Logged
JPoag
Guest
« Reply #1 on: July 17, 2006, 03:16:08 PM CEST »

Very Interested. Not About the RAR's though:

Zip Mirror
Logged
dracolytch
Guest
« Reply #2 on: July 17, 2006, 03:32:40 PM CEST »

Awesome stuff. Please do.
Logged
Jamie
Guest
« Reply #3 on: July 17, 2006, 06:37:51 PM CEST »

Quote from: vortex
If there is enough intrest in this, I will eventually share my source code, with a tutorial on how I did it Cheesy.

Enjoy, and let me know if there are any problems.


I'd love to see the source... Physics-based games are really one of my unrelenting addictions these days.

Anyone who hasn't tried Armadillo Run, really owes it to themselves to try it (non-SexyApp game, hopefully PopCap won't mind).

The game is a mix between "Bridge Builder" (material types, stress/forces) and "The Incredible Machine" (Balls/Armadillos, Rockets, etc) and is able to combine both playstyles to great effect (i.e. it's tremendously fun, and often funny to watch your solutions go horribly wrong or miraculously right in the game's physics modelling).
Logged
Architekt
Guest
« Reply #4 on: July 17, 2006, 07:54:45 PM CEST »

Wether a game is made in our framework or not doesn't matter. There's no rule against talking about or linking to games that weren't made with our code.
Logged
JPoag
Guest
« Reply #5 on: July 17, 2006, 10:26:53 PM CEST »

I've been looking at the ODE.org site.  It looks like the API was written using Abstract Data Types (ADTs) much like the Windows API.  It looks to be relatively simple to convert the ADTs to C++ classes (much like MFC converts the WinAPI to classes).

I haven't found any sample projects yet to show the steps involved, but from what I've seen, ODE works in 3D and you have to constrain the API to 2d (another advantage that classes would offer).

In any event, I am VERY interested in seeing any code for your demo.
Logged
vortex
Guest
« Reply #6 on: July 18, 2006, 01:16:31 AM CEST »

Thanks everyone Smiley. I will share the code eventually. The only reason that I don't share the code now, is that I plan to improve it greatly Wink.

Physics is something I have always been intrested in Smiley.

If anyone is intrested in attempting this themselves in the meantime, here is the code to the part that tripped me up the most:

Code:

void PhysicsObj::GetEuler(const dReal * matrix,dReal &kz)
{
const dReal epsilon=0.0000001;
if(matrix[2] < 1-epsilon && matrix[2] > -1+epsilon)
{
dReal c=cos(-asin(matrix[2]));
kz= atan2(matrix[1]/c,matrix[0]/c);
}
else
{      
kz=0;  
}    
}


It converts the rotation matrix to a Z angle.

Here is also the code I use to draw it:

Code:

void Board::Draw(Graphics* g)
{
g->SetColor(Color(0,0,0));
g->FillRect(0,0,mWidth,mHeight);
if(mApp->FunBox!=NULL&&mApp->ToungeBall!=NULL)
{
PhysicsObj *mObj;
for(int i=0;imWorld->mObjects->size();i++)
{
mObj=mApp->mWorld->GetPhysObj(i);
//dReal xrot,yrot,zrot;
//get_euler(dBodyGetRotation(mObj->mBody.id()),xrot,yrot,zrot);
double mAng=(double)mObj->GetZAngle();
Transform t;
t.Scale(mObj->GetWidth()/64.0,mObj->GetHeight()/64.0);
t.RotateRad(mAng);
t.Translate(mObj->GetX(),mObj->GetY());
if(mObj->GetType()==0)
{
g->DrawImageTransform(mApp->FunBox,t,0,0);
}
else if(mObj->GetType()==1)
{
g->DrawImageTransform(mApp->ToungeBall,t,0,0);
}
else
{
}

}
}
}


I know the code could be better, but it is a work in progress Smiley.
Logged
monkeymook
Guest
« Reply #7 on: July 19, 2006, 06:21:08 AM CEST »

thats a cool demo, cant wait to see the source and tutorial  Smiley
Logged
immortal3k
Guest
« Reply #8 on: July 19, 2006, 02:33:21 PM CEST »

Hi.

Can't run demo, missing msvcr80.dll
Because IÂ’m using VC6.0.
Can you share this file.

Thanks ahead.
Logged
JPoag
Guest
« Reply #9 on: July 19, 2006, 02:45:02 PM CEST »

@immortal3k:
 I threw that DLL in the zip file I posted above. (Just now)
Logged
immortal3k
Guest
« Reply #10 on: July 19, 2006, 02:51:27 PM CEST »

Great stuff!

Waiting for source Smiley

Respect, looking good.
Logged
vortex
Guest
« Reply #11 on: July 19, 2006, 07:14:33 PM CEST »

Yeah, sorry about that. A while back I rebuilt it to not need that DLL at all. Here it is:

MyODE_Alpha3.rar
Logged
mindscout
Guest
« Reply #12 on: August 06, 2006, 01:18:20 AM CEST »

Shocked)  
Excelent!!
I'd like to see some code of that demo... great work!
Logged
vortex
Guest
« Reply #13 on: August 06, 2006, 06:38:12 AM CEST »

Thanks Smiley. I am on vacation right now, but when I get back, I plan to do a bit more work to it and then release an alpha version of the source code for everyone Wink.
Logged
immortal3k
Guest
« Reply #14 on: August 07, 2006, 09:47:25 AM CEST »

That will be cool!
Logged
Pages: [1] 2 3   Go Up
  Print  
 
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
SimplePortal 2.3.3 © 2008-2010, SimplePortal