• Austin Laimos

Game Engine Development: Godot

Updated: May 8, 2020

Hello again and welcome to Game Engine Development II! This time my classmates and I looked at the Godot Source Code to see how it works. Here you can see a basic diagram of the object layout in Godot. Everything in the engine inherits from object, which essentially just contains a tiny bit of data like the type it is, its name and metadata. It is mostly bare-bones as it relies on implementation from other things.

The Node object is the best descriptor of a GameObject-like feature in this engine. It is capable of having parent-children relationships, it can have a filename, and is capable of using an event system with notifications. Most of the things the end user will interact with will be nodes, however they will have specific bits that are unique to said Node depending on what inherits it. (Whether it renders, or has collision, etc).

If you want the object to have a transform in space, you would want to make it a spatial. This has a position, rotation, scale, whether or not it’s visible, and has its own version of parent-children. This is specifically spatial parent-children, so it works with the more spatial dimensions of how parent-children work.

That's the basic layout of the building blocks of Godot, so let's look at a specific implementation of that, the physics engine: (Note: The code shown here is the 3D Physics Part. There is a separate 2D Physics code that is a lot of the same code but handles things a bit differently because it's in 2D. Even though the code is very similar, both 2D and 3D physics are very distinct and separate entities.)

The Collision Object is the basic block of the Physics Engine. It branches off of the Spatial class, so it has all the odds and ends of that, as well as a thing called a Shape Data. This essentially handles the shape(s) of the collider, or how it will interact with other colliders. This is then handled by the basic PhysicsBody, which just puts the collision on a layer/mask and has a lot of virtual functions that are then handled by the two main ways of handling physics: static and rigid bodies.

The Physics Material is a separate class that just stores the values of friction, bounciness, and whether it is rough/absorbent. This is then used by the various bodies to handle collisions.

The Static Body is something that isn't intended to be changed much. It has a constant velocity and does have a material, but doesn't have a lot of the implementation that the RigidBody has.

The RigidBody has all your good physics stuff. The mass, material, velocities, gravity scale, dampening and whether or not the body is sleeping (that is, whether or not to check for updates). The RigidBody can also change between static, kinematic, character, or rigid. There is also a Kinematic Body which handles more of the kinematic versions of physics. That is, collisions and normals are but into a greater extent in this version of the Physics Body.

This has been a quick snippet of the framework of Godot, which we are looking at to get ideas for how to structure our own game engine.

0 views0 comments

Recent Posts

See All