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

Collision Detection help for the self taught idiot...

6 posts in this topic

Hi all,

I'm writing a basic Gravity Force 2 clone where players fly a ship around a level, fighting gravity and themselves.

I'm self taught and am learning what I need when I need it. So now I'm needing to learn basic collision detection.

Currently you can fly the ship around the map but you can go past the edges. The map is made up of large blocks (half the size of the players ship) and the player can (eventually) destroy them if they hit it hard enough and shoot them. But of course this doesn't work at the moment hence why the player can just fly for an eternity...

But how do I perform collision detection? Now since I am a total beginner please assume that I know very little of the mathematics behind this, as I said I'm teaching myself as I go. Unfortunately I'm one of those people that learns best by getting stuck in, making mistakes and then climbing out of them again.

So how do I perform basic collision detection (on basic geometric shapes) and what should I study up to understand these concepts?

Thanks for the help everyone!

Mike
0

Share this post


Link to post
Share on other sites
A really easy quick way (That is not the optimal way of doing it) is to do collision detection is to keep a RECT of your ship as well as its previous location, also have RECT's for all of thing things you want to check collision with.

Every frame before rendering check if your RECT's intersect and if they do return the ship to its previous location you have stored before the render of that frame.

Now if you have a bunch of objects to colide with this approach may not be that best but its a great start if you are just learning.

Edit: I just noticed you tagged 3d, this advise was for 2d. Hopefully someone with more experience with 3d collision detection can weigh in for you :( Edited by yewbie
0

Share this post


Link to post
Share on other sites
http://www.realtimerendering.com/intersections.html

The following site has a great list of the different kinds or intersections tests needed for
collision detection, and where to find more information. If you really want to get your hands
dirty, use the chart and implement all the different tests.
1

Share this post


Link to post
Share on other sites
I am self taught as well. Here is an example of how I do collision detection. It might not be the best of ways, but it does work.

if(objectA >= rightBoundary)
{
objectA -= 1;
}

if(objectA <= leftBoundary)
{
objectA += 1;
}

The distance away from the boundary or other object really depends on how far your objects moves. i.e. float, int, etc. and how much of a bounce effect you want it to have. If you have it move away considerably, it will look like you object bounced off of the boundary.
0

Share this post


Link to post
Share on other sites
[quote name='Glass_Knife' timestamp='1354722405' post='5007422']
[url="http://www.realtimerendering.com/intersections.html"]http://www.realtimer...ersections.html[/url]

The following site has a great list of the different kinds or intersections tests needed for
collision detection, and where to find more information. If you really want to get your hands
dirty, use the chart and implement all the different tests.
[/quote]Thanks, that's a fantastic collection of sources.

I have just had the pleasure to use one of the mentioned books, Christer Ericson's "Real Time Collision Detection", to implement some basic collision stuff. Very solid book, recommended.
0

Share this post


Link to post
Share on other sites
[url="http://www.gamefromscratch.com/page/Game-Development-Math-Recipes.aspx"]This link[/url] (GDNet user from Serapth) has some tutorials, including collision detection via bounding box, you should look at.

In general, you basically want to keep the position and dimension of your ship as well as the velocity, and check if the boundary of your ship has intersected the boundary of any of the collidible objects in your game every game loop.

If you have thousands of objects to check against, you might want to look into performing some broadphase collision 1st as discussed [url="http://www.gamedev.net/topic/635212-how-do-you-check-collision-against-1000x1000-objects/"]here[/url]. I would look at spatial hashing myself in this case, but do what you feel is right.
1

Share this post


Link to post
Share on other sites
[quote name='Stroppy Katamari' timestamp='1354725727' post='5007433']
I have just had the pleasure to use one of the mentioned books, Christer Ericson's "Real Time Collision Detection", to implement some basic collision stuff. Very solid book, recommended.
[/quote]

Recently I did a lot of work studying different intersection test methods. Between the internet, Khan Academy, Real-Time Rendering, and the book you mention above, "Real-Time Collision Detection" it covered everything.
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