Devlog #2 – Technical topic: collisions

By 3 enero, 2018 2 Comments

Hi everyone, my name is Victor Ortega and I am the main programmer of the game.

I will talk about technology topics in our video game. I have to say this post isn’t as pretty as Abraham’s post, but I am a programmer, this job isn’t pretty ;_( (just kidding, it is).

In this first post I will talk about the basic aspects that must be known when making a game. First of all we must know that a game is like a movie, if something isn’t necessary it it shouldn’t be done, and if something can be done quickly and functionally, it is done. We will try not to waste more time than necessary.

When playing a game, we suppose that all the walls and buildings in our way can’t be crossed, but what happens if instead of being a wall is a coin? We assume that when touched, it will disappear. Well, here we should start talking about collisions, that is, the objects that we find in a game don’t have any associated physics that tells you if that can be crossed or not. For example, the soil is something we assume is always going to be able to step on but there are games with false floors where we can fall or walls that can be traversed.

So that we can see a little test, the green lines represent the collisions, our character has a capsule that surrounds it to detect when it collides, likewise the floor and the wall on the right serve us to walk on the stage but we don’t let it out of the stage until you find the way out. Currently the character is affected by gravity, therefore makes it walk above the ground.

Here is another image of the capsule colliding with the wall on the right. We can see a small part of the head of our character peeping behind the oil can.

If you realize, the character doesn’t have a collision in the whole body, that is, neither the hands, nor the feet, nor the head: if it isn’t necessary, it isn’t done. Depending on what we want to do, we will specify more the collisions, for example in a shooter, shooting at the head does more damage than hitting the body, therefore they will have two or more different collisions.

Does this mean that you will never be able to go through? Only if we give that behavior to the assets, for example in the next image we will see how an object, a needle, is crossing the ground. Moreover the player can pass behind the needle and the would not collide.

We already know that objects are differentiated between visual and physical collisions. Also having a collision associated with an object does not mean that you can’t cross, but instead it helps us give a behavior, either by clicking on it, passing over (coins) or when you get hit in a shooter.

Click to play:

We can differentiate three types of objects in our scene: the floor and the wall that is an object that has a collision and that can’t move, it’s static; the character that affects gravity and can collide with static objects and finally the needle that has its own collision, it doesn’t affect the gravity and doesn’t collide with other objects such as the ground or the character.

Now that we have all these concepts clear, we can talk about a game mechanic, ‘get out of the way’. I have commented that the character is affected by gravity, but during the game we can leave the path to go to the bottom / front to interact with other objects.

Click to play:

For this we have to tell the character to approach the object but without being affected by gravity. And when it is out of the way and we move it, we have to find where the road is and redirect it to follow it, once it is close enough we tell it to be affected by gravity and normal walking on our marked path. With this we can give our game depth and look like a “fake” 3D game, although it’s a 2D game.

If you want me to talk about some technical aspect as the frustum culling, the occlusion culling, meshes, textures, animations… I will try to do it for future devblogs and I will try to make it related to our game.

Regards and until next time.


Victor Ortega

Author Victor Ortega

More posts by Victor Ortega

Join the discussion 2 Comments

Leave a Reply to raendy Cancel Reply