+1 vote

Hey there !

I always asked myself how a 3D tennis game like Mario Tennis was coded. It's more a thread about my curiosity that anything else (I don't plan to make a tennis game :D)

I assume that the tennis ball (in the most cases) is not physics driven: it's not a Rigidbody 3D.

I would say that the ball is a custom KinematicBody 3D which (base on player's joystick input direction) trace a custom "path" and follows it. Am i right or others techniques could be used ?

In Godot, Tween nodes will be perfect for that behavior, right ? It will allows us to draw a path, set a timing to emulate a hit force, etc...

Just one technical question tho: how "arcs" and "parabols" works with the tween node ?
There are some questions already answer on that QA website but it never really explain why it is made like that.
Also how collisions will be handle through tween's movements ? Because it forces a movement and don't react to physics...

Is Nintendo uses some other techniques to make the game feel better ? Like a "snap player to ball" behavior when you are too far away from the ball ?

So much questions in my head :O

in Engine
edited

+1 vote

I assume that the tennis ball (in the most cases) is not physics driven: it's not a Rigidbody 3D.

It would be a kinematic body, as is any physics object we want the player to fully control. Physics makes things unpredictable.

trace a custom "path" and follows it. Am i right or others techniques could be used ?

Curves are simpler than you think, a curve only requires moving in two different directions at the same time.

For example the ball would have a forward vector, traveling in the direction it was hit.
Then Also gravity would pull it down to the ground. These two vectors would form the curve.

In Godot, Tween nodes will be perfect for that behavior, right ? It will allows us to draw a path, set a timing to emulate a hit force, etc...

In games the smart thing is to follow KISS principle.
Simple things tend to be easier to predict and is more fun for the players. It is why casual games are fun to begin with.

Like jokes, people don't enjoy mechanics they don't understand.

just one technical question tho: how "arcs" and "parabols" works with the tween node ?

The tween node is a curve. Or more precise it is a scalar over time, and just like the above example in often makes a curve.

The reason Tween works to make curves is because of multiplication. 1x1 = 1 and 1x2 =2 ; so 1xcurve = curve.

The problem comes in when you consider movement is a Vector over Time. So using tween to tweak it is: (Vector over Time) * Tween.
The result is that Tween effects the objects speed.

So to get the exact tween curve you need it to tween only one of the values, easy but a very roundabout way of making a curve.

Is Nintendo uses some other techniques to make the game feel better ? Like a "snap player to ball" behavior when you are too far away from the ball ?

The only thing I have noticed is that the characters never miss the ball in range. Probably the "hit" animation is tweaked with Inverse Kinematics, to home on the ball.

Most likely the animation is only cosmetic, that if you removed it the game would still play but with Mario in a T-pose.
Meaning all the "hitting" is a large collision capsule with math to emulate the hit.

by (1,445 points)