Click here to Skip to main content
16,021,294 members
Home / Discussions / Game Development
   

Game Development

 
QuestionText drawing in embedded system Pin
A_Fa8-Nov-11 4:11
A_Fa8-Nov-11 4:11 
Questionyour publication in magazine ! Pin
SoftwareWarsaw7-Nov-11 3:05
SoftwareWarsaw7-Nov-11 3:05 
RantRe: your publication in magazine ! PinPopular
Smithers-Jones8-Nov-11 4:34
Smithers-Jones8-Nov-11 4:34 
QuestionMultiplayer Poker Pin
Hanzaplast5-Nov-11 2:13
Hanzaplast5-Nov-11 2:13 
AnswerRe: Multiplayer Poker Pin
AspDotNetDev5-Nov-11 10:48
protectorAspDotNetDev5-Nov-11 10:48 
AnswerRe: Multiplayer Poker Pin
Alisaunder6-Jan-12 2:54
Alisaunder6-Jan-12 2:54 
Question'Self-aware' classes? Pin
Purge1t30-Oct-11 18:54
Purge1t30-Oct-11 18:54 
AnswerRe: 'Self-aware' classes? Pin
CDP180231-Oct-11 9:21
CDP180231-Oct-11 9:21 
Of course you could write a method in your baseclass for each object which takes the list of objects and performs a collision test on each one. Then you would just have to go through your objects and call the method. But if you think about it, this is just a refactored version of what you had before. You would gain nothing.


What you need is something out of the old algorithm and data structure box. The problem begins with using simple lists. If you have n objects in the list, you will have to do n^2 collision tests. When the number of objects gets larger, this very quickly becomes very slow. If you have only 10 objects, you must do 100 collision tests. For 100 objects it would already be 10000 collision tests and for 1000 objets it would be a million.

You need a way to reduce the number of tests. For example, you can have a sorted or an unsorted list. It's obvious that things are easier to find in a sorted list than in an unsorted one. By being sorted, a list can offer additional information which makes searching or testing the objects easier. But graphical objects usually are not lined up, so a sorted list will be of little help. They are distributed over a plane (2D) or in a volume (3D). Now, what could be the right data structures which can hold additional information on how the objects are aligned to each other?

The answer: Trees. For 2D graphics usually quadtrees are used. The objects must be sorted into the tree according to their positions. Then you can easily find objects which are close enough to each other and you must only test those for collisions. But, as always, there is one catch: When an object is moved, it must be taken out of the tree and inserted again according to its new position. Unfortunately you will have to deal with this as well.

So here you have it: Search for quadtrees (2D graphics) or octrees (3D graphics) and you will probably find a million pages discussing this stuff. And you will see that those trees are not only good for collision detection. Good luck!
And from the clouds a mighty voice spoke:
"Smile and be happy, for it could come worse!"

And I smiled and was happy
And it came worse.



GeneralRe: 'Self-aware' classes? Pin
Purge1t31-Oct-11 14:26
Purge1t31-Oct-11 14:26 
GeneralRe: 'Self-aware' classes? Pin
CDP180231-Oct-11 15:39
CDP180231-Oct-11 15:39 
AnswerRe: 'Self-aware' classes? Pin
_Maxxx_31-Oct-11 18:33
professional_Maxxx_31-Oct-11 18:33 
Questionmodel, shade, looksRealistic OpenGL Pin
appollosputnik25-Oct-11 3:34
appollosputnik25-Oct-11 3:34 
AnswerRe: model, shade, looksRealistic OpenGL Pin
CDP180225-Oct-11 5:10
CDP180225-Oct-11 5:10 
QuestionHow to set pixelz using XNA and C# Pin
CDP180213-Oct-11 21:57
CDP180213-Oct-11 21:57 
AnswerRe: How to set pixelz using XNA and C# Pin
rj4524-Oct-11 11:54
rj4524-Oct-11 11:54 
GeneralRe: How to set pixelz using XNA and C# Pin
CDP180225-Oct-11 2:02
CDP180225-Oct-11 2:02 
Questioni need your help Pin
gif202014-Sep-11 1:39
gif202014-Sep-11 1:39 
AnswerRe: i need your help Pin
Pete O'Hanlon14-Sep-11 2:13
mvePete O'Hanlon14-Sep-11 2:13 
GeneralRe: i need your help Pin
gif202014-Sep-11 6:10
gif202014-Sep-11 6:10 
GeneralRe: i need your help Pin
Pete O'Hanlon14-Sep-11 6:47
mvePete O'Hanlon14-Sep-11 6:47 
GeneralRe: i need your help Pin
gif202014-Sep-11 8:33
gif202014-Sep-11 8:33 
AnswerRe: i need your help Pin
Mahdi Nejadsahebi25-Sep-11 1:01
Mahdi Nejadsahebi25-Sep-11 1:01 
AnswerRe: i need your help Pin
Paul Conrad25-Oct-11 6:01
professionalPaul Conrad25-Oct-11 6:01 
AnswerRe: i need your help Pin
Peter Hawke28-Dec-11 13:03
Peter Hawke28-Dec-11 13:03 
QuestionMy first released game Pin
Thomas.D Williams21-Jul-11 5:18
Thomas.D Williams21-Jul-11 5:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.