-2
\$\begingroup\$

I am developing a Pirate ship fighting game.

enter image description here

It's a great concept: Ships firing cannonballs, sinking each other, having to work as a team to complete the mission... But.. I've tested it with about 20 people (with ~5 online at once) and the issue is simple: It is not enough fun.

The problem is that collision detection is horrible. With the ships, I detect if a CannonBall is in one of the coordinates that the ship is in with a delayed task. The Ship-To-Ship collision has been impossible for me to implement. I've attempted to add some sort of collision "box", but I cannot make it follow the Ship's rotation.

This means that I cannot have ships hitting each other. It means that I cannot add people to the game. It means that CannonBalls look horribly unrealistic (They just explode inside the ship!). It also means that I cannot add any sort of obstacles into the game (e.g. floating debris). All of these degrade the gameplay horribly.

My plan with the game is to have crew members who have to fight and take over a ship, and then give you the ability to plunder it. Also to add critical damage, e.g. damaging other peoples' cannons, setting them on fire, damaging the sails, etc.

In short, I can do NOTHING without a better collision detection system! My current system can Roughly get if something is colliding with the ship, but it is just NOT GOOD ENOUGH!

JBox2D is out of the equasion (I've tried using that), and JBullet also does not work well enough for my needs. Besides, I do not want a collision ENGINE! I just want to be able to know when a person is colliding with something and be able to get if that something is in front, to the left/right, or behind the entity.

What is worth trying? Is there any techniques that I have been missing in getting accurate collision detection in my game? Should I be looking at collision engines (even though the ones I have tried do not suit my needs)?

Also, I'm not sure if it is relevant, but it will be the server doing the collision detection.

\$\endgroup\$

closed as too broad by Kromster, Josh Feb 5 '15 at 20:25

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ I've attempted to add some sort of collision "box", but I cannot make it follow the Ship's rotation. Why? Was it an AABB or an OBB ? you should have no problem with OBB. \$\endgroup\$ – concept3d Feb 3 '15 at 14:56
  • \$\begingroup\$ @concept3d Can people stop spouting letters that I don't understand :(? I just tried putting a box around the ship and seeing if something collided with. It's easy to do except I couldn't get the math right to make it rotate with the ship. I don't want 2D collision anyway, 3D would be much better. \$\endgroup\$ – joehot200 Feb 3 '15 at 15:19
  • \$\begingroup\$ @KaareZ Hi! Well, I've got to ask for help somewhere. I might PM ThinkOfDeath about it, since he is so great with OpenGl. However, I'm doubting he'll have the answer. Though I must admit that ThinkMap had great collision (Though I will just point out that he can just use a box collision system, which is something unavailable to me), then I think he has more experience in the graphics rather than collision part of making a game (I could be wrong!). \$\endgroup\$ – joehot200 Feb 3 '15 at 15:34
  • \$\begingroup\$ @user2722083 Have you tried using the ships model to do the collision detection, or do you just use a simple box? Making a less detailed version of the model is a great way of doing it, while keeping performance. \$\endgroup\$ – KaareZ Feb 3 '15 at 15:38
  • \$\begingroup\$ I currently use a coordinates based system, which uses all the coordinates of the model. It's a pretty crappy system. Can you point me in the right direction for "using the model to do the collision detection"? \$\endgroup\$ – joehot200 Feb 3 '15 at 15:40
1
\$\begingroup\$

Have you tried Quadtrees combined with SAT?

You can do all your collision detection in 2d, and once you detect that a cannonball is within the bounds of a ships 2d bounding box you can check if it's height is low enough compared to the ships.

\$\endgroup\$
  • \$\begingroup\$ I actually don't know what Quadtrees or SAT are. Also, I will need a 3D system at some point anyway to get people walking on the ship, arrows hitting the right crew members, and cannonballs able to critically damage certain models. Could you explain more about what you mean with "Quadtrees combined with SAT"? \$\endgroup\$ – joehot200 Feb 3 '15 at 14:37
  • \$\begingroup\$ Quadtree: en.wikipedia.org/wiki/Quadtree SAT: en.wikipedia.org/wiki/Hyperplane_separation_theorem \$\endgroup\$ – Wolfgang Skyler Feb 3 '15 at 14:41
  • \$\begingroup\$ You could also search around for (OBB) (Oriented bounding box, a slightly more complex AABB), fallowing it's theory, it should rotate with the ship. \$\endgroup\$ – Wolfgang Skyler Feb 3 '15 at 14:45
  • \$\begingroup\$ @WolfgangSkyler 2D is simply not good enough. Must I use 2D? is there nothing to do with 3D? \$\endgroup\$ – joehot200 Feb 3 '15 at 15:17
  • 3
    \$\begingroup\$ @joehot200 I don't think you have the right attitude for this site. "I actually don't know what Quadtrees or SAT are." -- then look it up! Same with OBB and AABB. The industry standard is to fit an AABB to all objects, and put all the AABBs into an octree. Check to see which AABBs are colliding. If they're colliding, then you can do a mesh-to-mesh collision check if you want. This is probably more than you need though. You can probably just get away with oriented bounding boxes. \$\endgroup\$ – mklingen Feb 3 '15 at 17:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.