How to setup realistic collisions and physics for a Carrom (similar to pool/billiards) game?

I am new to UE4, I have seen some tutorials and I am trying to make a Carrom game in UE4. For those who don’t know about Carrom, it is similar to pool game. It is a square surface with 4 holes(pockets) at each corner. Instead of spherical balls like in pool game, it has cylindrical pieces called carrom coins. The objective is to hit these coins using another, slightly larger cylindrical object called a Striker, and put them in the pockets. Here’s an image of a Carrom board.

Signature_Carrom_Board_big.jpg

I have modeled Carrom board, but I am stuck at setting up collisions and physics. I tried using per poly collision, but the I found that the result was not quite satisfactory. There were issues like coin getting stuck in the border of the board, coins jumping out of the board, etc. I would like some suggestions on how to setup collisions and physics for such a game, or if it is even possible to get such realistic results using builtin PhysX in UE4.

P.S. this is my first ever post in this forum. If you think I missed some details, please feel free to ask.

So the first thing I can tell you is that you want to avoid using per-poly collision when possible, because it’s extremely expensive in comparison to the built-in primitives that comes with PhysX which are highly optimized mathematical models.

The downside is, there is no Cylinder collision component so you may have to model a collision and import it. In fact there are a very limited selection (Capsule, Box, Sphere). You may be able to tweak the capsule settings to make it a cylinder though and if that works, you’ll want to use that. I imagine that friction of the surface plays a large role in the game, you can change the friction of a surface by creating and setting a physical material on the wood and changing the properties, which will in turn change the friction imposed on the cylinder. For a game like this, it may also be worth increasing the strength of the world gravity to make pieces ‘stick’ to the board a bit better.

You could also look into completely faking it, and programming the ‘physics’ yourself instead of relying on PhysX.

Just code it by yourself. There are so little amount of objects that you can just do bruteforce collision checks and even model everything using just 2d physics. Circle vs circle checks are ridiculous easy.

Increasing the gravity! That’s a great tip, thanks. I didn’t think of that!

As for cylindrical shapes, I was able to get pretty accurate collision for it using Auto Convex Collision. What I can’t figure out is how to create collision for the board itself, as it has holes in it. I would appreciate any suggestions/tips on this. Also, I am pretty new at this, programming the required 3d physics myself would be too much for me.

But you don’t need any 3d physics. Just use 2d physics. It will be simpler this way. Trying to make physX to achieve this is lot bigger task than coding collision routine for static box and couple circle shapes. Whole physic system for this kind of game is just few dozen lines of code.

I’m doing this as a learning exercise and also I insist on doing it on PhysX (if possible) because I’d like to achieve realistic effects like coins falling through the pockets into the nets and such. I already know the 2d physics behind it, and I don’t know if I can achieve the falling effect with just 2d physics. I’d appreciate your inputs if you think it can be done with 2d physics, too.

Thanks.

Falling effect can be just visual.

I built this BilliardGameFramework and trying publish to marketplace.Now it’s stuck in “PENDING APPROVAL”, Hope it’s not too late.

You can’t rely at all on engine physics (chaos).

And even if you could, this and any other newtonian (and some non newtonian) style game (billiards, pool, bowling, Pong, Etc) should not rely at all on a physics engine.

What you do is you create your own physics calculations, and move the pieces around according to what you calculated.

In practice, it becomes somewhat similar to writing your own physics engine.

In reality, you have 0 of the overhead the regular physics engine come bloated with since you are only supporting a miniscule amount of math and objects in comparison.

Calculating impacts, momentum, energy transitions, etc, can happen lightning fast, to the point the engine will know the outcome of a strike the moment you start it.

The rest is just applying what the math figured out to the items in play.

Do a small test with a Pong mockup.
Get a ball to bounce from corner to corner in non-newtonian (constant motion) physics, and update its location accordingly.
Remeber that delta time will affect the object’s movement speed (you may need to look up all those basics anyway being new to the engine, its different than other engines but they all hold the same concept. The fps of the game cannot affect the speed of motion of an object).

Once you figure out how to make the ball move around and deal with corners, you can start working on the same thing using newtonian maths.
The main visual difference will be that the object will eventually come to a full stop.

Either way, you keep on building up from there until you are satisfied with the presentation you get out of the calculations.

While it may feel like you are re-inventing the wheel, you are, but you aren’t.
Your code will likey end up producing the same results for all players anywhere, so it will likely be possible to do networked gameplay with minimal sync adjustments.

None of the “physics” engines usually support that;
Replication is almost always “whatever man, the client does its thing, and we don’t care what that is. The server will decide in the end”.

Needless to say, on something like a game of pool that is networked, having the same identical outcome of a play on all clients becomes imperative?