logo
Published on

Making a Multiplayer FPS: Interpolation

Authors

banner

Introduction:

Hi, and welcome back to the third part of this series. In this part, we will be seeing how I implemented interpolation and also started to develop the weapon system.

Firstly, I know that it has been months since the last post, but as I mentioned in a previous post, this September I started my baccalaureate, and I haven’t had much time since then. I’m mainly making progress now that it’s Christmas and on weekends if I don’t have any exams.

Now let’s see the progress made in this installment!

Implementation of Interpolation:

As mentioned in the previous post, interpolation is the solution for the jittery movement seen as a result of not being able to send data every nanosecond. If you want more details, check out the previous post.

The process of implementing this technique wasn’t that complicated; the most apt word is tedious. I had to read some articles to understand how this works and how to implement it, especially from Valve on how they made multiplayer for Source. You should take a look at it as it was really helpful for me to understand interpolation as well as other things like client-side prediction, lag compensation, and more. Which are not implemented yet, but at least now I know what they are all about.

This article was also a lot of help: entity-interpolation

Now that it is implemented, the movement is smooth, and it doesn’t seem anymore that you are running at 30 fps. However, I still need to optimize it a bit for certan cases where there are strage movememts.

Starting the Weapon System:

I also started to create the weapon system, I haven’t finished it, and that’s because I want to make it as easy to use and convenient as possible. This includes adding inheritance, scriptable objects, custom editor windows for better management, and some little things more.

I think I will talk about this in the next post, as I don’t want to make this one too long, and it is also not the main topic of this part.

Inheritance

Example of how inheritance works

Conclusions:

With interpolation finally done, I have implemented one of the new things every multiplayer game has. The next important implementations are the ones already mentioned before, client-side prediction, lag compensation… Which from what I saw and read is not as “easy” to implement as interpolation. But we will see that in another installment.