Developing real-time multiplayer game using MagicOnion -1. Overview-

This post is introduction of my real-time multiplayer game development.

Table of Contents

Introduction


I’m developing real-time multiplayer Tetris like game since January 2021. Thanks to this experiment, I could learn know-how of the network libraries or tools such as MagicOnion, .Net Core, and docker. So I’m going to share these ones in my blog posts.

In this first post, I’ll introduce motivations, objectives, and results about my real-time multiplayer game developing. If you want to read the details of them, please wait the next blog posts!

You can see other posts or source code are as below.

  1. Developing real-time multiplayer game using MagicOnion -1. Overview-
  2. Developing real-time multiplayer game using MagicOnion -2. Architectures-
  3. Developing real-time multiplayer game using MagicOnion -3. Client Program-
  4. Developing real-time multiplayer game using MagicOnion -4. Server Program-
  5. Github Source Code / LineDeleteGame

My Results


My developing result is as below.

You can see the Tetris-like game works with each player’s playing. These game-plays are working on multiply devices under real-time networking.

I’ve published my source code and how to setup the developing environment on github. Please referenced ReadMe.md if you wish run this game on your computer.

Github / LineDeleteGame

Motivations


I’m working as a game developer, but recent my duties are responsibilities to Jenkins CI and maintenance game developing environments. I enjoy it very much, but, to tell the truth, I have desire of game development, too. So I decided to start developing game as hobby and try to learn technologies that I’ve never used.

The reason of why I’ve selected Tetris in my game is as below.

  • I’ve never developed it, so I want to learn tetris’s logic.
  • I want to focus learning real-time networking technologies, so I don’t want to be bothered by the complex game logic.
  • Since I’ve seen below video, I had desired that someday I develop tetris someday.

I’ve referenced this movie to develop my tetris game.(Sorry, but this video is Japanese only.)

Objectives


The objectives that my game developing are as below.

Game logic will be executed on servers so that players won’t be able to cheat.

Think about when the game logic executes on the client such as PC or smartphone, and sends game’s score to the server. Players can modify their game results easily using cheating tools. It is difficult for servers to detect whether players do cheat or not because they don’t have any information to rely on.

So my plans which I’ve developed are as below.

  • Servers calculate game board’s information based on the client’s inputs, and send them to client as real-time.
  • Clients send only their key inputs to servers. Clients just draw server’s results.

In this way players can’t have any rights to modify their game results.

Support for offline game play

In order to support for both offline game play and server executing, the game logic must have been placed common place that both of them can referenced it. There are lots of problem if the game logic is different between clients for standalone and servers for multiplay. So we have to make them even.

Bring server programs to public server spaces.

Usually, I was satisfied with just developing localhost server. But in this experiment, I want to deploy my server program to public space such as cloud server in this experiment. To achieve this, I want to have scrap and build environments because I have to deploy various servers.

Environments


This game’s developing environment is as below. The details of these libraries or tools will be introduced next posts.

Platform

  • Windows 10 (Includes Winsows Subsystems Linux)
  • Mac Pro(Catalina)
    • Using as develop and debug machine
  • AWS EC2 (Ubuntu 20.4/LTS)
    • Boot as server on Docker container

Because made with Unity, Client Program can boot any platforms. Thanks to .Net Core, server programs are able to boot any OS, too.

Tools/Libraries

Client Program

In this game, I’ve developed with Unity and C#. UniTask has been installed for my learning asynchronous processing.

Server Program

Server has been developed with “.Net Core”, and using MagicOnion for Connecting with client. LogicLooper is used for manipulating game loop and threads on servers.

Server Infrastructure

  • Docker (Docker-compose)

Server program is deployed using Docker container. They can be brought to any OS if they are written correctly and OS will be supported Docker services. It was not difficult for me to deploy Docker container to cloud server such as AWS although I have had a hard time to describe and execute Dockerfile.

Other Liceneses

I have adopted simple font without using built-in them.

Next Post


I’m going to explain my game’s system and network architecture overviews on next posts.

y-tomita
y-tomita
Game Programmer
Build Engineer

I’m a Game Programmer. In my work, I often use Unity3D Engine with C#/C++ to develop game app.

Next
Previous

Related