+4 votes

Dear all,

If I want to make a Mario-like game (3D platformer), in which the character can jump, wall-jump, climb, roll, etc, like the actions Mario can perform, which one I should choose to be my character controller in Godot, Rigid body in character mode or Kinematic body?

Thanks!

asked Dec 11, 2017 in Engine by icqqq (221 points)

2 Answers

+11 votes
Best answer

My answer depends on an assumption

The term "Mario-like game" means a game like one of the Super Mario Bros. series (SMB). If you meant games like Super Mario 64 or Super Mario Galaxy the answer may doesn't fit your needs but still can be helpful.

TLDR

You can use both but I would choose the KinematicBody.

At the end it depends on your implementation details. I can totally recommend to read a lot of articles about the physics system and used programming tweaks in the Mario games. You will see that it is often a mixture of approximated physically based computation and well defined edge cases where the calculation results are anticipated, rounded or replaced by a kind of state pattern.

At first

Look into the provided Godot demos. There are platformer (2D and 3D) demos that you can investigate. Also you should experiment with the PhysicsBodies in Godot until you have a good grasp of all the available kinematic methods, collision detection, rigidbody modes and the connection between velocity, acceleration and inertia.

What is the difference between Kinematic and RigidBody?

Answer: Applied mechanics.

You can move your KinematicBody without ever thinking about its mass, inertia, acting forces, friction and damping. But you can also implement parts of a physics system into your movement algorithms (mostly done with acceleration for walking speed and gravity while jumping). So it is sometimes easier to have a very restricted physics environment (KinematicBody) than thinking about every aspect of a realistic behaviour (RigidBody). Some things can be implemented without using physics at all: think about rolling - you can rotate your characters PhysicsBody (torsional moment for RigidBody) or just play a rotating sprite animation.

If you want to read more about the difference I can recommend you these pages (combined with studying engineering mechanics :D ):

If you feel confident with using forces to move your character then try to use a RigidBody. It makes some things easier as it provides a simple interface to a full blown realistic physics environment. But pay attention: The Mario-like games aren't realistic! For example the gravity changes while jumping to make the movement smooth and more reactive. You can also change your direction while in mid-air. These things are getting tricky to implement with a RigidBody.

So in the long run choosing a KinematicBody may be the better choice but you have to implement some physics stuff yourself. :\

Watch videos / Read a lot

But wait! There is more in a Mario-like game than simple walking and jumping. To get an overview you can watch one of these related videos:

You can get an idea of how to implement such things while watching these videos:

You should also read a lot what others have said:

And if you are crazy enough you can jump into someones source:

We are talking Godot here!

Sorry for the Unity, Love2D, LibGDX stuff... I am sure an implementation combined with a tutorial for Godot will be available in the future. There are some attempts here:

[!] Pay attention: None of these repositories seem to have a licence specified.

Conclusion

SMB (and other Mario-like) games are polished like a diamond when it comes to game mechanics and character control in particular. This needs a lot of design thinking (how it should look), level preparation (measurements) and a lot of trial and error (to determine game constants like gravity). Start with a simple platformer with walking and jumping, collision detection and then try to figure out how controlling your character should feel. The decision for one specific node can not replace this experimentation.

answered Dec 11, 2017 by rolfpancake (1,006 points)
selected Dec 16, 2017 by icqqq

Thank you for your answer.
Actually, I have specify the "Mario-like game" in the question, it means 3D platformer, which also means games like Super Mario 64 or Super Mario Galaxy.

However, your answer is very useful and very informative.

BTW, do you have any idea about the character controller in games like Super Mario 64 or Super Mario Galaxy, which one I should use, Rigid body in character mode or Kinematic body?

Thanks

I tried to answer your question as broad as possible. Although I am mostly talking about SMB much of the provided information still has value for creating games like Super Mario 64 etc.

I am sorry but because I haven't worked on such a game in 3d space I can't say which will be better. If the provided links did not help you, why not create an MVP and try to implement basic walking, running and jumping with a KinematicBody and then another one with a RigidBody? This shouldn't take too much time compared to the rest such a project will take up - and at the end you can decide for yourself what seems to be the best way.

You could also provide your lessons learned to the community then :)

@rolfpancake +1 for the bunch of very informative links :>
Do you have anything of this kind for the "Super Mario 64"-type too?
I find SM64 control & movement mechanics to be a template to look at for 3D platformers, it's really well-designed. I heard that the creator of the game started from the character itself and a mock-up playground level with all sorts of obstacles and platforms to jump on just to test these movements and fine-tune them before he even started working on actual levels.

I added some more links and a second answer regarding your requests.

For Mario 64-like, the answer may be neither, look at this https://www.youtube.com/watch?v=UnU7DJXiMAQ
This analysis may be accurate, is highly probable that Miyamoto & Co. are keeping the super fake physics style since SMB 1.

@eons
Thank you so much. I don't know mario 64 handle physics like this!

+2 votes

Regarding the comments

As an addition to my first answer: here are some resources for a 3D platform game. There is not much out there, articles are rare and games are almost always closed source. I will add stuff gradually to this list when I stumble upon something new.

3D Platformer games

Read their wiki entries, search the internet for articles about these games, stalk the developers twitter accounts and personal homepages etc...

Articles and such

Videos and such

Godot related stuff

Sources for 3D games which are platformers in the widest sense

Dive into their src folder to find some game mechanics...

Other resources that may help

answered Dec 13, 2017 by rolfpancake (1,006 points)
edited Dec 16, 2017 by rolfpancake
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.