How to Design the Data Structure for a Turn Based Game

One of the recurring questions you ask our support team is how to actually make a turn based game in Gamedonia. Because you’re already great coding features for your games, all you may need is a little guidance on how to organize your design to make the things you want work. When you see the following example, you’ll see how easy it is.   Stuff needed to build a turn-based game To keep things simple, let’s say you want to build a classic tic-tac-toe game with Gamedonia. What features should you expect from a game like this? Multiple simultaneous games. Players should be able to have multiple games with different opponents taking place at the same time. Different game status. Every game should have a status that indicates what to expect. Waiting, created, running, finished or cancelled. Play with listed friends. You could have the option to challenge your friends to a game or add new friends to the list. Play with random users. You may want to play with people you don’t know. Play same skill users. You might want to play against random players that have a similar skill than you do. Making a game with Gamedonia that has all these features is easy. All you need to know is how to lay out the features to make them work like you want. Here are a few questions you should be able to answer.   #1 How are you going to store data? In Gamedonia, game data is stored in collections, which is like a table in an SQL database. There are some differences though. In a collection you...

Realtime server commands for multiplayer games

When making a multiplayer game, one of the most important issues to cover is how your networking communications will be addressed by your game design. The game characters are constantly moving and you should be able to position them and transmit their location accurately to all the players. But, what type of information should you send to communicate between players if you’re making a real time multiplayer game? You’ve got several options to start off: The position of every character, the exact position at any given moment Start and end position of every character, and have the client interpolate the position The user inputs that makes a character interact with the game, aka commands Let’s break down the characteristics of these options and the problems they pose.   #1 The position of every character This is the most simple approach when trying to communicate with multiple players. The fundamental issue with this approach are the amount of messages that need to be broadcasted, even for simple games. Let’s say that you want to make a 3D game that allows three players to play simultaneously and that you want it to run on 30 frames per second. That makes 90 msg/sec. If every character position has 4 variables: x,y,z for position, and α for rotation, you’ll have to process 360 variables/sec. players fps msg/sec variables variables/sec 3 30 90 x,y,z,α 360 Let’s see how much time you have to process every frame of your game. 1.000 milliseconds / 30 fps = 33,33 ms/frame In those 33ms not only should you compute the position of the players, but also cram in graphics...

Lag compensation techniques for multiplayer games in realtime

Deciding what information to send to the server in order to reproduce a true real-time multiplayer experience is the first step towards designing effective networking communications. Unsurprisingly, there are more key aspects to consider before you can get there. I’m sure you’ve heard about lag, and pretty sure you’ve experienced it yourself in a FPS or RTS. Those are games that only make sense in actual real-time, and lag makes this hard. That’s why I’ll talk about how lag affects games, why addressing lag matters, and offer some techniques to deal with the lag problem. These are the lag compensation techniques, which can be applied from the client-side or the server-side.   Understanding lag compensation These are the basic concepts we need to understand to be able to deal with lag compensation problems: Round trip time Lag Lag compensation   Round Trip Time It’s an essential concept to understand the nature of networking communications. It is defined by the amount of time taken by a packet of information that is sent from a client to get to the server and return to that client, without considering the processing times. Round Trip Time = Time to send + Time to receive   Lag So, what is lag and how does round trip time (RTT) affect it? Lag is the delay that happens since the player sends the “action” (shoot, jump, duck) to when she receives the “reaction” of the server (shoot the bullet, avoid the hit). Let’s find out how RTT affects lag with a practical example. How RTT affects lag Say we have two people, Mary and John, playing a western...

What’s hindering my multiplayer game design?

If you plan to make a real time multiplayer game, there are a few important things you have to bear in mind when you design it. A common misconception developers make is that the most important stuff to plan are programming, graphic simulation, and other technical stuff. I don’t want to underestimate the importance of coding, I’d be foolish to do so. They matter a lot but, they are the mean not the goal. The most important decisions you’ll have to make when designing for online multiplayer are closely tied to the game experience you want to offer players. So I’d like to talk about three essential aspects you definitely should consider if you want to design a great game experience. Lag fairness Reaction speed Game needs   Multiplayer Networking Essentials   #1 Lag fairness When you’re playing with other people across the internet you expect the game to be fair to all the players. You don’t expect to be penalized because you don’t own a state-of-the-art computer or mobile device. And it shouldn’t be that way. The feeling of fairness in a game is affected by the design of the peer to peer (client to client) communications. When developers don’t contemplate in their multiplayer game design that players may have radically different ping times —for example 200ms to 700ms— the player with the lowest ping will be obviously advantaged over the rest of players with higher pings. Which isn’t particularly fair, if you ask me.   #2 Reaction speed It is important that despite there will be hardware disparity from which the users will play your game, they aren’t penalized...

When to start thinking about backend features and database?

It is clear that the social aspect of games has been established as a really important aspect of game development. Improving the game connection, offering balanced play based on the user level, adjusting difficulty based on the analytics of the data in-game. All these functionalities rely on a secure server setup. When running on your own hardware (e.g. VPS, dedicated) you’ll need to figure out what scalability strategy to follow and take protection measures. Even then, servers will eventually go down. So when’s the best time to start planning for servers? Design scalability strategy at the beginning This way you won’t need to change the server architecture and keep the game offline, or in worse conditions because of it. It is hard to face it at first. I mean, if you are doing a small game, do you really need all this stuff? Maybe not. But not taking it into account doesn’t come free. These are some questions you might be asking yourself down the road if you don’t prepare from the start: What happens if my game gets traction? Do I need to test my game live with a huge amount of users? Will the scalability design affect my game design later on? Sooner or later you’ll reach that point, so why not think big from the start? It’s better (and cheaper) to be safe than sorry. Handling the data distribution of a game can be tricky. Mainly because this data depends on players which are constantly updating their information when they’re playing. You’ll need a dynamic database that not only lets your game adapt to new data, usually...