• 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.

Archived

This topic is now archived and is closed to further replies.

cxi

Collision Detection

8 posts in this topic

AnyOne know of good OPENGL code for COllision Detection i can get? I can not seem to get mine to work, and i woudl love to see some good examples. please email me dan@pjcc.com thanks The Code is a Living breathing entity, and will move in accordance with you, therefore, be one with the Tao of the Code..
0

Share this post


Link to post
Share on other sites
Well, I dont quite have openGL code, but this site has some good explanations on different types of collision detection, the pros and cons of each, what to avoid, etc. It does have some pseudo code, which shouldnt be that hard to convert. Good luck!

http://www.gamedev.net/reference/docs/refarticlelistuser.asp?catid=45

(BTW, the first few links are mainly 2d related, but the last one is 3d)

-Fuzz
0

Share this post


Link to post
Share on other sites
quote:
Original post by cxi

AnyOne know of good OPENGL code for COllision Detection i can get? I can not seem to get mine to work, and i woudl love to see some good examples. please email me dan@pjcc.com


thanks

It strikes me that the easiest way to detect collision along a path (Ie where I am now to where I am after I bang
along this here path a few notches, would be essentially
to go through ones list of polygons, and see if the line between the two points intersects, a b-tree or somethin''
might be usefull to break down the poly''s to be tested.

I''d figure that''d be the easiest.
The Code is a Living breathing entity, and will move in accordance with you, therefore, be one with the Tao of the Code..


0

Share this post


Link to post
Share on other sites
Hi cxi!

Collision detection does not depend on what 3d - interface (OpenGL, D3D, ...) you''re using so you don''t need OpenGL - specific code.

Visit our site: www.rarebyte.de.st

GA
0

Share this post


Link to post
Share on other sites
cool thanks guys.
>>would be essentially
>>to go through ones list of polygons, and see if the line >>between the two points intersects, a b-tree or somethin''
>>might be usefull to break down the poly''s to be tested.

that would work well < and i have thought about that idea as well> for just simple camera movement, but would it work for things coming in from behind < like a bullet> or things falling form the ceiling, and the other characters in the game? i want to make sure that none of the polygons within a certain sector < the viewing frustrum probably> are not going through each other.

Here is my idea: I build a viewing frustrum about 50 units in radius around the character, do a check to see which objects are in that radius < and stuff that list into an array> then do a check to see if their path of motion < where the next frame would put them> is heading my way. Then i need to check for a collision. That would work for the camera collisioncomingfrom 360 degrees around me. but not from above, and it would be tough to implement that for all objects within the frustrum from pounding on each other.

or am i simply making it too complicated????
0

Share this post


Link to post
Share on other sites
Hi cxi,

You''re heading in the general direction, but not quite right. There are heaps of articles aroung on collision detection (although, I must admit some are pretty full-on), but to get you started I''ll quickly explain the bounding sphere techique.

Nominate a central point inside each of your objects, and figure out what size radius a sphere would need to have to (only just) completely enclose the object. This is your bounding sphere. Now, when your objects move (but before drawing the a frame, so you can change stuff like object positions etc after collision if you need to), test the distance between the centre of each object. If it is less than the sum of the radii of their respective bounding spheres, they have ''collided'' (as you may have guessed, this method is not very accurate, but it is fast, and is good as a first level of collision detection).

You can refine this in many ways. One is to not bother testing collision between static objects (as they will never collide), and make sure you don''t test for collision between two object twice (ie test all objects against one object for collision, then iterate to the next object and test for collision with the previous object... you already did that ).

This method is a good first layer. You can then refine your detection by testing for collision with a heirarchy of bounding boxes if a ''collision'' is detected using the bounding sphere (to detect if there actually was a collision).

Hope this was helpful in some small way... I''d hate to think I was wasting my time, being at work and all

-------------
squirrels are a remarkable source of protein...
0

Share this post


Link to post
Share on other sites
Great!

No you havent wasted your time. I have been trying to figure out how to create a bounding sphere in opengl. I have also been attempting to use the RAPID collision detection library. but due to the severe lack of documentation on the class its extremely difficult to implement.

anyone have any info on that? Anyone have any info on making a bounding box or bounding sphere in opengl? < i am assuming of course, that this is an actual shape drawn by the system, but with a transparent color, or am i wrong? god i hate being so new to this! haha

thanks for all your help.

p.s. i am at work as well, suppsoed to be coding a e-commerce system in ASP, but would rather play at the moment


CXI

The Code is a Living breathing entity, and will move in accordance with you, therefore, be one with the Tao of the Code..
0

Share this post


Link to post
Share on other sites
Hi again cxi,

Glad I could be of some use to someone for a change

With the bounding sphere, you don''t actually draw it, its just a conceptual thing that surrounds the object. It is simply an imaginary sphere with a radius from the centre of the object to the vertex furthest from that centre. You are just using it to define a distance (i any direction) from the object centre that, if another object''s sphere comes closer than this distance, a collision may have occurred (as the object resides somewhere within this imaginary sphere).

Am I making sense? Sorry if I''ve confused you... the main point I''m trying to make is that you don''t need to draw bounding spheres/boxes/etc, they are simply (approximate)mathematical definitions of the space that your object takes up.

Let me know if you want me to clarify anything (just don''t expect too much, as I''ve only just started in this type of thing recently too)

Well, back to punching out crappy database accessing code with VB... the joy just never stops

-------------
squirrels are a remarkable source of protein...
0

Share this post


Link to post
Share on other sites
Thanks Bad Monkey,


One other algorhythm i liked was to create a bounding box, and grab a plane that is not intersecting. then test to make sure all of the vertices for the right object are not on the other side of the plane from the bounding box. although i dont have any code for that check. i am new to the more advanced geometry.

thanks again guys!


The Code is a Living breathing entity, and will move in accordance with you, therefore, be one with the Tao of the Code..
0

Share this post


Link to post
Share on other sites