Month: September 2016

LAG in Games

There are different ways in which Lag can affect a game, from having a constant Lag that will make your game feel a little weird or slippery, to having massive Lag-Spikes that could shuffle everything in your game depending on how you do things.

There could be very different approaches on how to deal with Lag and Lag-Spikes depending on what kind of game you’re doing. Something that has a big impact on your game latency is what protocol you’re using, UDP or TCP.


 – UDP vs TCP

Most games use UDP since its generally a faster protocol that does not check the integrity or order of the incoming packets. If you’re using the built in technology on your game engine, it’s probably using a modified version of UDP, that makes it a little more reliable without sacrificing so much on performance and speed.

If you’re programming your own solution for this (Sockets), I would highly recommend to use UDP for most cases, it really makes a huge difference vs using TCP, especially if it’s an online game. When communicating over a network there is always some packet-loss, even more when on the internet vs a LAN. This packet-loss is what slows down TCP so much.

Can packet-loss affect my game when using UDP? Yes, but in reality, not that much. If you think about it, in most games you’re going to be sending several messages a second to keep the server/clients updated, if some of these don’t make it through, it will not affect your game so much since the newer messages that do make it through will update everything anyways.

When would I use TCP? If you’re making a turn-based game that does not require a “real-time” response. Many Mobile games actually use TCP as their protocol. Lets face it, mobile games are not there yet to actually have a fully functional  real time FPS experience compared to computers. There are not many mobile games that actually try to do this.


 – LAN Games

Although the technology now is allowing for easier, cheaper, and faster online games, there are still some people that would like to have their game tied strictly to a LAN.

Remember those glorious LAN-Party days? Well these types of games are the ones we’re talking about, from FPS games like in the old days Counter Strike, Quake and Unreal Tournament, to newer games that are leaning more on the indie side like Artemis Spaceship Bridge Simulator.

When making a strictly LAN game, we are tied to making a game that will act or be sold as a product, meaning that there are no monthly fees, no services tied to it, a self-contained product.

There is one big advantage to having a LAN game, and that is, an extremely low Lag. Unless we are connected through a VPN which simulates a LAN and still works, it can definitely introduce some significant Lag into the whole experience.

Why make a LAN game?… Well, if you don’t really have much experience with networked games, this is the place to start. It’s certainly easier and simpler to manage a few IPs inside your LAN than to manage several URLs, especially when you’re not used to it. Having to deal with either your cloud provider or hosting services just adds an extra layer of unnecessary complexity and cost.

If you’re just starting with multiplayer games, I highly suggest you start with some LAN projects, this will get you going and will allow you to learn the most important and useful things on multiplayer games for the least amount of work and virtually no extra cost.

Even though LAN games have very little Lag, there are still some system designs that could make your game feel and play better. These are the differences between a fully authoritative server vs non-authoritative servers (more on these later).


 – Online Games

Here is where we really need to worry about Lag and the consequences that it will have in our game. When a game is laggy, it can sometimes feel choppy, slippery, with slow response, or just weird in general. This weird feeling while playing your game could have a great impact on the whole experience for the users playing.

What can we do about Lag? There are several ways we can approach Lag. We will be discussing the most useful and common ways to approach this, including: client predictions, regional servers, network/server optimizations.


 – Client Predictions

This simply means that our Client (whatever the user is running on his computer)  application will try to predict all the movable object’s positions over time in case there is a Lag-Spike or a slight disconnect.

Lets review a simple example. Assume you’re running your online game and the server updates the position of another character to your Client. Based on the previous position and in relation to the new position, the client will know the direction in which the updated character is moving. This is usually known as interpolation. So if in case of a Lag-Spike the server fails to update the position on the next frame, the client is able to “predict” the position of the character for the next frame. This is assuming that the character will keep doing the same action.

So if we didn’t have any type of client prediction and had a Lag-Spike, we will have to wait for the server to reconnect. And whenever the server updates the position of everything in the game, things will just snap to their new position. Even when we don’t have considerable Lag-Spikes, just having a rather high Lag will make our game look and feel very choppy.

A possible negative effect of having a not so good client prediction is that the game will feel more slippery. It is important to know in your code when the client predictions kick in and, if possible, have a variable strength depending on the general latency and/or delay of the messages.


 – Regional Servers

One possible solution for handling high latency in online games is to have regional servers.

Lets say the server is physically located in California, and someone is playing your online game in Australia. There would be a massive amount of Lag in this case, considering the distance, many in-between connection nodes, unoptimized routing tables, etc. This is why regional servers are a great way of providing a better service to many regions around the world.

Keep in mind, you need enough users in each region to make this worth it for the users and yourself. Meaning, if there are not enough players connected to a specific region, it is not worth it to have that region functional since it incurs a greater cost to you and affords no player diversity for the users in these low-usage regions.

I would generally recommend to have fewer regions and to have them as centralized to your target markets as possible. For instance, if your target market is English speaking countries, you can have two servers, one centralized in the US that would cover both the US and Canada, and another centered in between the English speaking areas of Europe.


 – Network and Server Optimizations

These types of optimizations require a high knowledge of the whole network structure, how your system works, and in most cases they go hand in hand with custom network solutions, meaning that you coded your own socket based communication system.

There are a lot of great improvements to be done if this is the case.  We will go into detail about this in a later article.

Some of these could include:

  • Minimizing message usage – when you code your own communication solution, you can actually control the frequency and/or eventuality of the messages you’re sending. This can improve not only on Server/Client process performance but also better communication. The fewer packages that are sent, the fewer packages that are lost.
  • Minimizing the bytes sent – simply put: the smaller the byte usage in your network messages, the smaller and fewer packages to send and to get lost. There are several ways to do some Bit-wise optimizations that can greatly improve this aspect of your communications.
  • Choosing the specs for your servers once you have an MVP server running, you can stress test and load test your servers, and based on this choose the best configuration for the specs of your servers, whether you’re hosting or using cloud services.



Please  post some questions, comments, or suggestions. I want to be able to help you guys as much as I can by covering as much as possible. We can go into a very detailed and specific  discussion on whatever you need.



System Design for Multiplayer Games

Designing a multiplayer game might not seem like something that would require a lot of extra thinking compared to a single player game, and that might be true for some specific scenarios, but in most cases you start designing and suddenly you realize that things are getting a little out of hand.  When you’re finally grasping a general idea of how you want to design certain aspects of the game, you bump into one or two “What Ifs” from which you branch out into a complex spiderweb of design decisions. Before you know it you’re way over your head, confused, lost, and overwhelmed, then you think about all the hours of effort that you might need to put into your game just to get a Minimum Viable Product (MVP) running.

Well that’s what we’re here for, to talk about all these little and sometimes big things that affect our games and how we design them.

This is the first post of a series of articles that talk about the Design of a Multiplayer Game from a technological point of view. This article is aimed for Indie developers who have a desire to create a multiplayer game. I do not intend to tell you how to design your game but to guide you on how to make some design decisions and overcome some bumps in the road you may encounter while developing a multiplayer game. I’ll be highlighting some caveats, listing some common types of multiplayer games, and the work required to get them running. Hopefully this will ease your path into this challenging but exciting experience.

When talking about multiplayer games, we have a few options: Couch-coop, split screen, LAN, and Online games.  This series will regard only LAN and Online games, games that have a network component into them.

In this first article I’ll start by listing limitations, scenarios related to those limitations, and possible solutions for each. Each of the following articles will try to address the former in detail.

Lets get started.


 – LAG
I wasn’t sure if I wanted to start with this point or not, due to its complexity and all the things that need to be taken into account while designing a game that might be highly affected by LAG. And yes, some games are more prone to feeling “Weird” or just not working as expected due to LAG. This can be easily overlooked while designing a multiplayer game. Trust me when I tell you, LAG is REAL!

We will look into what are the differences between a Fully Authoritative server vs a more permissive approach. What if your game is Online or you just want to make a LAN game, “a la Counter Strike” when it first started, and possibly sell it as a product. What is Client prediction? What types of solutions are there? What are the Pros n Cons for each of these? What about Lag Spikes? Finally, we will talk about regional servers, and how this affects the game performance and your wallet.


 – Price/Cost
Regional servers could really hurt your operational costs. The fact is that all the points we’ve listed so far affect your OPEX somehow. You need to decide between selling your game as a product or as a service.  Those that sell their game as a service include any typical MOBA, Free2Play (F2P) or even an MMO like WoW. We will list and explain the necessary components to develop a game for each of these models. Moreover, we’ll talk about the scale you could start with. It is not only easier but also cheaper to grow something than to shrink down on your Cloud Structure.

What about your Content Distribution Network (CDN)? It is expensive to distribute your game, since there are storage and Bandwidth costs.
One key word is Cloud! Yes, most scenarios should use the cloud, because it’s not too expensive and will give you a lot of flexibility.


 – Server Types
What are the differences between having a dedicated socket server vs accessing a REST API? Where should I use each? Things to keep in mind while developing these.


 – The Networking Back-End
We’ll be talking about 2 engines in general, Unity and Unreal Engine. Both have a built-in Networking solution. Although these options are great for testing and making a quick draft, you can also create your own networking back-end solution which you’ll have total control over and can allow you to improve a lot on Networking performance, by controlling the size and occurrence of the messages and other cool tricks.


 – Game Modes
This is not related to what kind of networking solution you should use, this design decision is more related to how many people play the game and the sad but true possible scenario “What if there are not enough users playing my game?”.  What type of game mode should you start with? A free for all is always a good idea. What about queue times if you have a MOBA type of game? Should you do it match based or have big persistent maps?

These are some considerations to keep in mind while designing your game. We will discuss this in a top-down approach since these considerations come after the type of game you’re developing and not the other way around.


 – Multiple Services
There are some development choices that you might be forced to take because of some bottlenecks on some of the services developed. This will allow you to design ahead and have a clear view of what you need to do instead of having to re-factor your whole system in order to accommodate possible expansion scenarios. In short, if you do it right, you’ll do it once and it’ll be clear. We will go a little more into some topics like… What about friends, parties, chat, should I have my own VoIP? How will inter-server communication work?

In any case, we will try to approach most of the possible problems found in designing and developing a multiplayer game. I hope you find these articles useful.


After discussing all the parts that I want to point out that are necessary to understand and complete a multiplayer game, I will give some fully detailed examples on some game types such as: MOBA, FPS, RTS, and maybe even an MMO. I could also include some Mobile API based game. This will depend on whatever people requests I get.


On a side note: The reason why I say “WE” is because I include you into the discussion and expansion of these topics. It would be great if you can either comment or send me a message about the article regarding its content and  any concerns and specific question you may have. Your feedback will aid in enriching the articles posted here and allow us to further explore solutions for issues that may arise.

Starting a blog

Ever wanted to start writing a blog, or even wondered how to start one? I’ll share my experience and resources I used to get this one going.

If you read my Hello world post, then you already know why I started with this blog, basically to be able to help anyone interested in creating something a little more complicated than the entry level demo kind of game that most people create when starting to use a game engine like Unity or UE4.

Since I don’t really have any experience in writing blogs or anything similar to it, my whole life I’ve only written code, I needed some guidance on how to properly start a blog, what were the best or at least better options for someone that is just starting out. While browsing and searching for a tutorial or some type of guide I bumped into the Youtube channel of Simple Programmer by John Sonmez. I watched a few very interesting videos related to development, how to improve productivity, great books for developers, and several other topics. He mentions his free course on how to start your own blog.

In this course, he breaks it down step by step and sends e-mails twice a week, including instructions and some good options for starting a blog, i.e. ready made blogs like vs hosting your own blog with blue host using wordpress. Just so you know, I ended up choosing the latter. He also sends a lot of useful tips on how to increase traffic to your blog, and things I never even thought about like why is it such a great idea to start writing your own blog to promote yourself.

If you want to check his free course, this is the link Create-Your-Blog, highly recommended if you want to start a blog of your own.

One thing I would always recommend to anyone, is to do your research before starting anything, whether it’s a blog, a game or anything in life. You might encounter something that sounds amazing from the perspective of whoever is explaining it, but their needs may differ a lot from your own needs. Try to always make an educated decision on whatever you’re doing, learn from your own mistakes, and even better from other people’s mistakes.

Please let me know what you think about starting a blog, if this was helpful to you and/or if I could use any other resources to improve things in this blog, from my writing to themes and how to manage a website, etc.

Hello World!

Hi my name is Willy Campos and welcome to Game-Savvy.

This blog is aimed to help those wanting to make a game on their own or in small indie teams. We will deconstruct several processes of game development, analyze, and talk about the design decisions, best practices, possible bumps in the road, and many other things to consider while developing an Indie game.

I will stick to the technical design and programming details, and will not wander into either gameplay design or the business side of things, although some future suggestions may impact greatly on important budget or business decisions.

I’ll try to post at least once a week. Please note that everything in this blog will be based on my own Video Game Industry experience,  entire programming career, personal game projects, and education in the field. By no means am I suggesting that whatever is posted here is the best way  or the only way to do things.

I hope you enjoy and most of all find this blog useful. My goal is to create a roadmap to help you make important design and technical decisions and to have fun while doing this.

This is my first blog ever, so please bare with me while I become better at writing and explaining concisely.