• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
xyuri

Simple ODE Example / Tutorial

13 posts in this topic

After accepting the fact that creating a physics engine for a game is a slightly complicated task for a n00b I took a peek at the ODE stuff. Problem being that it does not come with an example on how to set up a basic collision / gravity scenario :-( And there do not appear to be any tutorials available on the web (Yes, I have looked) Are there any sources that anyone knows of which could get me started on the very basics of ODE? Thanks in advance for any help :-)
0

Share this post


Link to post
Share on other sites
Hey! I was in the same boat last week.

If you download the ODE source (not the bin releases), and extract it, you'll find all kinds of demo code in the
ode 0.5\ode-0.5\ode\test\ directory.

I found them to be quite useful.

Hope this helps!
0

Share this post


Link to post
Share on other sites
I was wondering where the source for those Demo's were ;-) Although when I run them I get an erro because cannot find "cygwin1.dll" ...

I'll check out the sources.

Thanks a lot dude :-)
0

Share this post


Link to post
Share on other sites
Does anyone know how to unzip a .tar.gz in windows? I have winace, winzip, winrar, and PowerArchiver installed and none will open the zipped file with the sources from ode.org :-(
0

Share this post


Link to post
Share on other sites
Ya, I use WinRAR for pretty much everything but .7z archives. It opens up .tar.gz just fine for me here.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Spudder
winrar always does the job for me regarding .tar/.tar.gz archives.


Same here. On that note xyuri, make sure that the file type is registered to WinRar so you can easily double-click and open it. Once you do that there is another archive that contains all the files.
0

Share this post


Link to post
Share on other sites
I downloaded a different source from the ODE site which seems to work much better...

I have found some examples which are a little confusing to me, but I'll go through them tonight and see what I can make of it.

One thing is for sure, I'm writing a tutorial for n00b's when I get through this all ;-)

Thanks guys.
0

Share this post


Link to post
Share on other sites
jakem3s90, I just cant seem to make any sense of what they have written in those examples ... There is bound to be a much easier way about it ... all I want to do is have a box that falls! Would you maybe be able to provide me with one please?

Thanks,
Michael D
0

Share this post


Link to post
Share on other sites
Which compiler / IDE are you using? Also, which graphics API are you using?

I might be able to send you a some code to help you get started!
0

Share this post


Link to post
Share on other sites
This should be all you need, but I'm writing most of it from memory, so some of it could be wrong... What you *should* do is look at ODE's Latest User Guide, since it explains how to create objects and so forth, and you can get the basics of the collision detection functions from the source code provided in the source release.


//thinks you should always keep track of:
dWorldID worldID = 0;
dSpaceID spaceID = 0;
dJointGroupID contactGroup = 0;
//these things handle your box:
dBodyID bodyID = 0;
dGeomID geomID = 0;


//INIT:
worldID = dWorldCreate();
dWorldSetGravity(worldID,0.0f,-9.8f,0.0f);
spaceID = dHashSpaceCreate(0);
contactGroup = dJointGroupCreate(0);

dMass mass;
bodyID = dBodyCreate(worldID);
dMassSetBox(&mass,1.0f,0.5f,0.5f,0.5f);
dBodySetMass(bodyID,&mass);
dBodySetPosition(bodyID,0.0f,0.0f,0.0f);
geomID = dCreateBox(spaceID,0.5f,0.5f,0.5f);
dGeomSetBody(geomID,bodyID);


//DEINIT:
dGeomDestroy(geomID);
dBodyDestroy(bodyID);
dWorldDestroy(worldID);
dSpaceDestroy(spaceID);
dCloseODE();//final clean-up


//COLLISION DETECTION:
dSpaceCollide(spaceID,0,&callbackFunc);
//changeInTime is the seconds passed since the last update:
dWorldQuickStep(worldID,changeInTime);
dJointGroupEmpty(contactGroup);


//COLLISION DETECTION FUNCTION:
#define MAX_CONTACTS 16
void callbackFunc(void* data,dGeomID o1, dGeomID o2){
dBodyID b1 = dGeomGetBody(o1);
dBodyID b2 = dGeomGetBody(o2);

dContact contacts[MAX_CONTACTS];
int i,numc;
if (numc = dCollide(o1,o2,MAX_CONTACTS,&contacts[0].geom,sizeof(dContact))){
for (i = 0;i < numc;i++){
contacts[i].surface.mode = dContactSlip1 | dContactSlip2 | dContactSoftERP | dContactSoftCFM | dContactApprox1;
contacts[i].surface.mu = dInfinity;
contacts[i].surface.slip1 = 0.1;
contacts[i].surface.slip2 = 0.1;
contacts[i].surface.soft_erp = 0.5;
contacts[i].surface.soft_cfm = 0.0;

dJointID c = dJointCreateContact(worldID,contactGroup,&contacts[i]);
dJointAttach(c,b1,b2);
}
}
}


0

Share this post


Link to post
Share on other sites
Quote:
Original post by jakem3s90
Which compiler / IDE are you using? Also, which graphics API are you using?

I might be able to send you a some code to help you get started!


I'm using C with Dev-C++ and OpenGL :-) ALl open source stuff, but on windows ;-)
I would appreciate it soo much if you would write me up an example! :-) Thank you very much dude.

Gorax, I've read through most of the user manual but I dont quite get how I should structure everything, like, you can create a virtual object but how is the easiest way to read all those objects (and their coords) to draw them to the screen etc...

One useful thing I got from the manual though is this list which shows the sequence that your code should run in :-)

Quote:
/*
* A typical simulation will proceed like this:
* 1. Create a dynamics world.
* 2. Create bodies in the dynamics world.
* 3. Set the state (position etc) of all bodies.
* 4. Create joints in the dynamics world.
* 5. Attach the joints to the bodies.
* 6. Set the parameters of all joints.
* 7. Create a collision world and collision geometry objects, as necessary.
* 8. Create a joint group to hold the contact joints.
* 9. Loop:
* (a) Apply forces to the bodies as necessary.
* (b) Adjust the joint parameters as necessary.
* (c) Call collision detection.
* (d) Create a contact joint for every collision point, and put it in the contact joint group.
* (e) Take a simulation step.
* (f) Remove all joints in the contact joint group.
* 10. Destroy the dynamics and collision worlds.
*/

I put it in the header of my header as a reference for me :-)
0

Share this post


Link to post
Share on other sites
The examples are pretty complete in getting you up to speed on the various aspects. I recall printing out the docs as I used ODE initially for a program that (genetically) generated articulate motion for models. I should probably put some of it up somewhere as I had to write a custom loader to account for (ODE) physical aspects of the models.
0

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  
Followers 0