Comments for xnaFan's Blog http://xnafan.net XNA tutorials, code and games Fri, 10 Aug 2018 04:55:21 +0000 hourly 1 https://wordpress.org/?v=4.2.22 Comment on Simple platformer game in XNA tutorial – part four “Simple collision detection” by Steven Vaerten http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-four-simple-collision-detection/comment-page-1/#comment-398038 Fri, 10 Aug 2018 04:55:21 +0000 http://xnafan.net/?p=977#comment-398038 See: "2D Collision Detection for Game Programmers: Focus on Circle Collisions" on Amazon.com for a detailed answer to this question.

This question is not easily answered. There are 3 types of collision algorithms that may be written: Static, Semi-Dynamic, and Dynamic. Most of the discussions here were for Static collisions. Static collisions are when the algorithm assumes that the two objects are static, or not moving, even it they are actually moving. Semi-Dynamic collision algorithms account for object A moving, but assumes object B is static. Dynamic collision algorithms take into account that both objects are moving.

Static collision algorithms return only if a collision has occurred. The programmer only has the location of the objects to use for collision response. This is limiting, but sufficient for many games. Games like "Space Invaders" may be written using the algorithm. It is important to note that the static algorithms can have issues with small fast moving objects. Care must be taken to insure these objects cannot skip over each other in a single frame.

Semi-Dynamic collision algorithms return if a collision has occurred, The mathematical intersection point, the intersection time, the collision point (Where the two objects touch), and the collision normal. These algorithms take more time to execute, but return more information to allow for a wide variety of collision responses. This is the recommended algorithm I would use for most games. Games like "Break Out" may be written using this algorithm.

Dynamic collision algorithms return if a collision has occurred, the mathematical intersection point, the point where object A is at collision, the point where object B is at collision, the collision point, the collision normal for object A, and the collision normal for object B. This algorithm is the slowest to execute, but gives all the collision response details possible. This algorithm would be suitable to a "Break Out" like game that has multiple ball and if the balls collide they bounce off each other. Typically "Break Out" like game do not have the balls interacting with each other, therefore, the balls can occupy the same location with no response. This is not realistic, but how it is usually done.

The process for building the algorithms is fairly simple, but filled with a lot of repeating detail that make it cumbersome. The algorithms can be broken down into the following steps:

1) Identify the 2 objects to test for a collision
2) Create the collision area.
3) Test if the control point collides with any of the objects that make up the collision area. Divide and conquer decisions should be used to maximize efficiency.

The collision area is a composite of the 2 objects colliding. To create the collision object take object A and transcribe object A around object B. In the case of a circle colliding with an AABB, the collision area will have 4 circles at its corners, and 4 segments connecting the circles at their outer tangent points.

There is insufficient space in this blog give the algorithms in detail, but in the book "2D Collision Detection Algorithms for Game Programmers: Focus on Circle Collisions" will explain all 3 collision types for circles colliding with Points, Lines, Horizontal Lines, Vertical Lines, Rays, Segments, Circles, Ellipses, Axis Aligned Bounding Boxes (AABB), Object Oriented Bounding Boxes (OOBB), Capsules, and Polygons. I highly recommend this book.

You may also be interested in my other books also, they may be found at Amazon.com:

1) "2D Collision Detection for Game Programmers: Focus on Point Collisions"
2) "2D Collision Detection for Game Programmers: Focus on Circle Collisions"
3) "2D Collision Detection for Game Programmers: Focus on Ellipse Collisions"

In print soon:
4) "2D Collision Detection for Game Programmers: Focus on Axis Aligned Bounding Box (AABB) Collisions"
5) "2D Collision Detection for Game Programmers: Focus on Object Oriented Bounding Box (OOBB) Collisions"
6) "2D Collision Detection for Game Programmers: Focus on Capsule Collisions"
7) "2D Collision Detection for Game Programmers: Focus on Polygon Collisions"
8) "2D Collision Detection for Game Programmers: Focus on Collision Response"

Good luck with your game.

]]>
Comment on Maze creation in C# by admin http://xnafan.net/2012/03/maze-creation-in-c/comment-page-1/#comment-387899 Mon, 31 Jul 2017 19:17:49 +0000 http://xnafan.net/?p=356#comment-387899 Great to hear you found it useful :-)
Cheers!

]]>
Comment on Maze creation in C# by Julia http://xnafan.net/2012/03/maze-creation-in-c/comment-page-1/#comment-387850 Sun, 30 Jul 2017 07:02:40 +0000 http://xnafan.net/?p=356#comment-387850 That's more than great!

Thank you very much! Hope the information will be useful for your portal readers!
I'm very excited because Iā€™m doing c# online course now and Iā€™d tried your tutorial as well and I managed to do it)
Have a good day!

]]>
Comment on Free XBox buttons and controller graphics for your game… by Brad http://xnafan.net/2012/06/free-xbox-buttons-and-controller-graphics-for-your-game/comment-page-1/#comment-380920 Sat, 18 Feb 2017 21:00:30 +0000 http://xnafan.net/?p=451#comment-380920 Thank you!

]]>
Comment on Maze creation in C# by admin http://xnafan.net/2012/03/maze-creation-in-c/comment-page-1/#comment-380436 Sun, 05 Feb 2017 10:58:48 +0000 http://xnafan.net/?p=356#comment-380436 šŸ‘šŸ˜Š]]> Very glad to hear it was of use to you šŸ‘šŸ‘šŸ˜Š

]]>
Comment on Maze creation in C# by ohiovr http://xnafan.net/2012/03/maze-creation-in-c/comment-page-1/#comment-380425 Sun, 05 Feb 2017 00:25:38 +0000 http://xnafan.net/?p=356#comment-380425 Thanks for this example. I'm teaching my nephew how to program with unity and this will really help. I converted it to run in unity obviously but it was such an easy conversion and does precisely what I want. Excellent work

]]>
Comment on Simple platformer game in XNA tutorial – part three “Movement” by Mcbeen http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-three/comment-page-1/#comment-380349 Thu, 02 Feb 2017 13:42:04 +0000 http://xnafan.net/?p=946#comment-380349 Great tutorial helping me a lot but parts of the example code are wrong. It says
Movement *= Movement
thoughout the steps but it changes to
Movement -= Movement
at the clean up which is the correct version

]]>
Comment on Spritesheets galore! by Sprite http://xnafan.net/2009/12/spritesheets-galore/comment-page-1/#comment-338906 Sat, 01 Aug 2015 14:46:30 +0000 http://xnafan.net/?p=68#comment-338906 Here are some more royalty-free spritesheets (6 animated characters with different actions):

http://sprite.slicker.me

]]>
Comment on Simple platformer game in XNA tutorial – part three “Movement” by Fish http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-three/comment-page-1/#comment-320966 Fri, 08 May 2015 15:53:10 +0000 http://xnafan.net/?p=946#comment-320966 Love how the Jumper just goes up and never comes down like "I'm too good for this partial-game, BYE!!!"

]]>
Comment on Simple drag and drop with snap-to-tiles in XNA by admin http://xnafan.net/2012/07/simple-drag-and-drop-with-snap-to-tiles-in-xna/comment-page-1/#comment-306800 Thu, 12 Mar 2015 07:22:33 +0000 http://xnafan.net/?p=466#comment-306800 Hi Ludo :)

If you read the article to its end, you'll see that the code to make the chess board is under the heading: "Another noteworthy codesample".
If that doesn't make sense, just ask again :).

Kind regards - Jakob

]]>