Unreal engine physics in a tennis game

I have been thinking about creating a tennis game in Unreal Engine. I want to have full control as the developer about where the ball will land on the court and in what speed it will travel. I also want the game and ball movement to feel as realistic as possible like on this game: Full Ace Tennis Simulator FAMod 1.7. I was thinking of using a ball with physics as kinematic only, but I won’t have much control over the speed of the ball and I think it will be lower than in real life in order to land inside the court. Also I think it will be a bit difficult to implement slice shots for example where the ball floats because of its backward spin. I was also thinking about implementing Magnus force, which is the force that causes the ball to dip and land inside the court on high speed shots, but I don’t really know how I can calculate and have control over where the ball will land on the court (where the player aims), because in this method it will depend on the spin of the ball and the speed of the shot and those change a lot because of drag. Has anybody got any idea on how to implement similar mechanics to the game I linked above ? Thanks

Physics in unreal is not deterministic, you always will get error. It is perfectly fine for non gameplay simulation, passable for things like cars.

However for tennis game, where you have 3 physics objects I would code that myslef (preferably in C++).

for your game using EPICS physics:

  • You have all the code
  • code is not replicated in multiplayer (yes you can replicate it without much work)
  • physics is not deterministic, so you cannot make multiple clients have same results with same starting conditions (it depends on FPS)
  • probably quite hard to PROPERLY implement tricks, and certain moves
  • probably really hard time simulating tennis rackets, stretching bouncing etc.
  • sometimes glitches happen

now, your code for your version of physics.

  • You need to code it yourself
  • i think you can find some papers about tennis physics, formulas etc
  • your code will be not discrete simulation, you can use formulas to calculate more accurate but bit higher level results
  • your code can be specialized and tuned, so easier to control, instead general physics code from EPIC

Its similar problem to making space craft or airplane.

Yes you can add thrusters, some steering code and forces and have decent airplane. But it will not behave like real one (Well it will but as far as your skill and intuition with tuning whole thing). If instead you use proven formulas you will have simulation as accurate as current science is on that topic.

So depends on how accurate you want your game.

And then that problem with glitches in physics, or dependency on FPS.

ps.
answer for your questions about “trick” skills in tennis:
You can add torque, o just a thruster to emulate spinning and drag, same for hitting with racket at angle adding spin. But then how much spin, how much drag? So you need to calculate it. But it is not whole spin or drag, it is just adjusting what physics engine calculated. So no easy way to calculate, and that also depends on FPS and timing. This is what i wrote about EPIC discrete physics vs, formula based for your case. And no i cannot help, i am stuck at inertial space craft, and how to apply forces so it stops exactly where i want. :wink:

pps.
whole thing about tennis and ball + racket may be entirely non linear formulas (just like simulating cars with rubber tires is). So intuition plus tuning discrete physics will be doable, while formulas probably require PHD brain.

ppps.
I asked chatgpt about “tennis, 2 rackets and ball, and physics” as usual it was borderline useless :smiley:
However i google this out:

And nope you cannot simulate that stuff in Epics physics engine, not without adding your own code that handles edge cases. Basically scripting all tricks over physics engine.

So only way is making your own formulas. And scripting it.

1 Like

Wow, thank you for your detailed answer! I think I will start looking into implementing this behavior on my own, seems like the right thing to do and probably the only right way to get the most accurate results. Again, thanks for the answer, it helped a lot!