Skip to main content

Posts

Showing posts from 2017

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...

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 us...

Optimization Pattern for Unity Game Programming

Design Patterns summarize the common solutions for particular problems. Book "Gang Of Four Design Pattern" is classic. Book "Game programming pattern" shows solutions to a variety of game related problems. Here, I will summarize the optimization patterns I used often,  mainly in the game of ArmaGallant and a recent mobile game. Both work is carried on in Unity C#. Optimize Pattern 1-----Cache the result, compute once, retrieve later string operation often generate gc, for example, int.tostring(). to avoid gc, can cache the result in a dictionary. Cache result for int.tostring Cache result for string.split(':') Double key-cache result of str1 + "." + str2 or str1+str2 Dictionary<string, Dictionary<string, string>> Notice, do not cache too many things to explode the memory. Optimization Pattern 2---Temporary parameter for an object 2.1 find common set of two sets. Given problem: when you have two sets of same type objects, ...

Brief on visual

My career is mainly visual related.  In the early stage, I have done some image processing related work and then switch to game. This article is an attempt to brief the visual related area in a simple way. 1. What is a pixel? 2. How to see? 3. How to draw? 4. How does the computer think? 5. How does the computer draw? 1. What is a pixel? There are a lot of answers depends on the context. We could general refer a pixel as the a. Picture element. The name pixel is short form of pix element. Pix is the short form of picture. So pixel means picture element. An image is divided into a rectangular grid of discrete dots known as pixels. One common interpretation could be a pixel is the minimal element square block in an image. For example, an image with resolution 200x100 means there are 20000 pixel with 200 horizontally and 100 vertically. b. A light blob. From hardware point of view, it is quite true. The traffic light for pedestrians normally consist of small light blobs. ...

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. ...