Skip to main content

A simple prototype to MOBA in Unity C#

Recently, I have been fast prototyping a new game project.  Here is the approach.

1. FontEnd--Hotfix Support

Hotfix is essential, only in China, for better customer experience and more buggy apps.
Lua vs ILRuntime(C#)
Both of the hotfix approaches using interpretor to interpret files(Lua, IL Dll). They share roughly same performance.

As Unity supports Code in C#, it makes ILRuntime the perfect approach for hotfix using ILRuntime as front end programmers only need to focus on one language C#.

AOP Hotifx
With well structured design of front end, you can make Unity runs all compiled C# code without ILRuntime initially, and only trigger ILRuntime after hotfix happen, as these C# files are identical.


2. Backend--Network

ORUDP(Ordered Reliable UDP) is used in MOBA and Lidgren is the great open source networking solutions on UDP.  Lidgren could integrate into Unity with little effect with all the github samples around.

3. Backend--Property System

Property systems are used for state synchronization. It could support replay. Just enter the observe mode in LOL, you could freeze the watch and play later.

Summary
With all these, you have a simple MOBA game prototype. Coding in this approach would be extremely fast as code could be shared between ILRuntime and purely C#, and be shared between front-end Unity project and back-end C# servers.

We do not continue the C# server approach due to already existing of great support of C++ game servers. So the left work is just convert C# related server code to C++. Ignore Lidgren and choose TCP for slow update MMO(refer to the slow update game as position is not frequently updated).

Comments

Popular posts from this blog

Tech note: Java Virtual Machine(JVM) vs Erlang Runtime System(ERTS)

Java is my first language. From third year of undergraduate, I switched to C++ because of image processing/computer graphics related course work. After graduation, I never use Java as Java is not used frequently in the game industry. Elixir is my most recently language.  It is derived from Erlang. I know Elixir follow the path of Unity->Ulink->Riak(Ulink's default database option, which is written in Erlang)->Erlang->Elixir(derivation of Erlang). Follow this path comes with Phoenix(one of most recently web-framework). Now, I have many programming language friends, Java/C++/C#/Python/Elixir and some niche languages. To know a programming language, I only have to know the machine and how the machine speaks the language . Particularly for Java and Elixir, the core is how their underlying virtual machine works.  In Erlang/Erlang virtual machine case, I was forced to think the relationship among OS processes, OS threads and CPU cores.  To make it simple, 1. ...

Fast Game Development in C#(Unity, ET, MongoDB)

This is the continue of the previous blog fast prototyping of a new game project. With the ET game framework(refer to https://github.com/egametang/Egametang), and lack of server support, I decide to continue my attempt to develop our a game all in C#. The progress become very fast, due to following factors. 1. A fast UI making approach. UI has been one of most time consuming work during game development. Managing buttons/labels is extremely tedious when there are lots of UI pages. There is a simple way to handle UI. Take NGUI for example, we assemble the UI widget in a prefab, and drag a list of widgets(example, buttons, labels) in a script, click a button to auto-generate all the boilerplate code. The auto-generated code could be just two files, one view script one control script. For example, Login UI panel, three scripts would be generated, Login_C, Login_V, Login_M. In Login_V, all the widget assignment related code is generated, in Login_C, the value of widget is as...