• 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

Gravity , Collisions in openGL

3 posts in this topic

Hi there buds

Ive got a littile problem ... and feel confessed

Imagine a Solid Cube , free fallin on a sphere .

how can i descibe that ? how we can set openGL to simulate a gravity ? note that gravity is a ACCELERATED move
(sure we can use translatef and define a function to increas the amount of translation periodically )

the main problem is Collision !

the cube falls and i want it to be realstic . some little bounces and a realstic angular reactions . how is this possible ?

you can point me to this book as refrence :
OpenGL programming guid 7th edition , the official guide to lerning opengl 30 and 3.1 , dave shreiner , the khronos opengl ARB working group .

and the platfotm im workin :
Win 7
Visual C++ Express edition 2010

and at last ... thanx
it will be really appreciated fellas

Share this post

Link to post
Share on other sites
In OpenGL? It is simply not possible. Just like it is not possible in any graphics API, unless integrated in a middleware. I don't understand why people working on this keep on insisting on the concept of "set API_OF_CHOICE_HERE to simulate gravity".
First thing: get the idea out of your head. GL has nothing to do with that, does not care, and will never care.

Now, how do we solve the problem?
I strongly suggest the use of a collision/dynamics library ("physics"). I am personally completely sold on [url="http://bulletphysics.org/wordpress/"]Bullet[/url].

Share this post

Link to post
Share on other sites
collision is a geometry problem, that is complex to solve. especially complex when solved in a "sweep" manner. (google "sweeping volumes") there is a log of academic research on this. Most physics library does not compute collision but intersection rather. So if you have a huge movement during one time step, some collisions could be missed. that's life.
so you've got a question "do A intersects B" ? you can imagine how to answer it. also you know that the answer is yes or no (boolean).
what to do with that answer ? -> "collision response". again, another field of research that is complicated by itself. sliding, bouncing, gripping etc..
you will need a good understanding of rigid bodies physics, inertia matrices and so on.
also, there is the simulation in itself, the motions (newton, euler), the integration over time, again, a whole filed in itself, there are many numerical integrators out there (eurler, verlet, runge kutta...).
there there are all the articles from Eric Cato (maker of Box2D), the gaffers on games by Glenn Fiedler about fixed time step game loops, which is related to physic simulation because the two are imbricated.

All in all, your question is very ligitimate, I asked it to myself once as well also. Tried implementing something with sphere vs triangle sweeped collision and sliding response in variable timesteps up to 4 iterations by graphic frame, but it was unstable, and had flaws where you would randomly fall through the ground etc...
doing it with a box is even more difficult.

the best answer to that problem, is really, use a library like ODE or Bullet. Read the documentation, you'll see how complicated a problem it is. Especially that thos elibraries are able to handle multiple objects intercollision with linear-time approximated mathematical solvers, which is, once again, a whole field of numerical science that is difficult to master if you don't have a degree in it...

Share this post

Link to post
Share on other sites
Based on your question and how you expressed it, your level of knowledge/experience may not be enough to solve this thing yet.
Simulation and gravity are abstract things that doesn't exist in programming on the level you want to program (openGL is not so high level IMHO and especially it's not made for anything else than simple graphics). Simply telling a system to "simulate gravity" exists on engine (using physics libraries) level or scripting.

So at first, in my opinion, you should get experience with things like [url="http://www.koonsolo.com/news/dewitters-gameloop/"]game loops and timing[/url], [url="http://en.wikipedia.org/wiki/Finite-state_machine"]game states[/url], [url="http://en.wikipedia.org/wiki/Game_programming#Game_structure"]continuously running loop vs event based loop[/url].

I think moving directly to physics simulation even with an engine would be a too big step without the said concepts.

Unless you use a complete package, where you just graphically throw things together, like ODE (if I recall correctly). But if you want to program it, either with using a physics library or without it is very hard if you don't have some experience with these concepts (correct me if I'm wrong, maybe there are libraries that does everything) Edited by szecs

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