Introduction to the "Go" Egametang framework

Source: Internet
Author: User
Tags lua cpu usage

Discussion QQ Group: 474643097

1. Available vs single-step debug distributed server, n change 1

In general, the distributed service side to start a lot of processes, once the process is more, single-step debugging becomes very difficult, resulting in server development basically by playing log to find the problem. The usual development game logic also has to open a lot of processes, not only start slow, and find problems and inconvenient, in a heap of logs to check the problem, it feels very bad, so many years no one to solve the problem. The ET framework uses a similar overwatch component design, and all server-side content is split into components that mount the components you need at startup based on the type of servers. This is a bit like a computer, the computer is modular into memory, CPU, motherboard and so on parts, with different parts can be assembled into a different computer, such as home desktop needs memory, CPU, motherboard, video card, monitor, hard disk. But the company uses the server does not need the monitor and the video card, the Internet Café computer may not need the hard disk and so on. Because of this design, the ET framework can hang all the server components on a single server process, then the server process has all the functions of the server, a process can be used as a whole set of distributed servers. This is similar to a computer, desktop computer components, it can also be used as a corporate server, or as an internet café computer.

2. Random Split function of distributed service side, 1 to N

The distributed server is going to develop many kinds of servers, such as login server,gate server,battle server,chat server friend server and so on. Traditional development methods need to know in advance what the current function to put on which server, when more and more features, such as chat function in a central server, and then need to split up a separate server, this will involve a lot of migration code work, annoying. The ET framework does not need to be concerned about what server is being developed at the time of normal development, only one process is developed, and functionality is developed into the form of components. Is it convenient to publish in a multi-process format using a multi-process configuration? Whatever you do, split the server. You can split it by simply modifying very little code. Different servers hang different components on the line!

3. Cross-platform distributed service side

The ET framework uses C # as a server, and now C # is completely cross-platform, install mono on Linux, and you can run without modifying any code. Performance, because. NET is open source, Mono has been acquired by Microsoft, and now Mono has a strong performance, testing, only a little slower than windows, much faster than Lua,python. Playing the game server is completely a cinch. Normally we develop debugging with VS on Windows and release it to Linux when it is released. The ET framework also provides a one-click Sync Tool that turns on Unity->tools->rsync synchronization to synchronize code to Linux,

You can compile the boot server.

4. Provide the support of the co-process

C # inherently supports asynchronous variable synchronization syntax async and await, much more powerful than Lua,python's, and the new Python and JavaScript languages even copy C # 's thread syntax. Remote calls between a large number of servers in a distributed server, without the support of asynchronous syntax, will be cumbersome to develop. So Java does not have an asynchronous syntax, do a single service is not suitable for large-scale distributed game server. For example:

Send c2r_ping and wait for the response message r2c_pingsession. call<c2r_ping ()); Log.debug ("received r2c_ping"); //A player with ID 1 is queried for MongoDB and waits to return game.scene.getcomponent<dbproxycomponent> ().  query<player> (1);  Log.debug ($ "Print player name: {player. Name}")          

As you can see, with async await, all of the asynchronous operations between servers become very coherent and no longer need to be split into multiple pieces of logic. Greatly simplifies the development of distributed servers

5. Provide an actor message mechanism similar to Erlang

One of the great advantages of the Erlang language is the location-transparent messaging mechanism, where the user does not have to care about which process the object is in, and gets the ID to send a message to the object. The ET framework also provides the actor message mechanism, the entity object only needs to hang up the actorcomponent component, this entity object becomes an actor, any server only need to know this entity object's ID can send to it the message, There is no need to care what server this entity object is on, and on which physical machine. The implementation principle is also very simple, the ET framework provides a location server, all the entity objects that Mount Actorcomoponet will register their ID with the location server, the other server when sending messages to this entity object, if you do not know the location of this entity object, Will first go to the Location server query, query to the location and then send.

6. Provide the server to keep the dynamic update logic function

Heat is an indispensable function of the game server, the ET framework uses the component design, can be made overwatch design, components only members, no method, all methods into the extension method into the hot DLL, the runtime to reload the DLL can be hot more all logic.

7. Client hot Update One-click Switch

Because of the limitations of iOS, the previous Unity Hot update typically uses LUA, causing Unity3d developers to write two kinds of code, which is a hassle to die. Then fortunately out of the Ilruntime library, using the Ilruntime library, Unity3d can use the C # language to load hot update DLLs for hot updates. Ilruntime a drawback is that the development time does not support vs Debug, this is a bit uncomfortable. The ET framework uses a precompiled instruction Ilruntime, which can be seamlessly switched. Instead of using ilruntime in the usual development, use Assembly.Load to load the hot update dynamic library, which makes it easy to use vs single-step debugging. At the time of release, defining the precompiled Directive Ilruntime can seamlessly switch to using Ilruntime to load the hot update dynamic library. It's so easy to develop and you don't have to use dog-poo lua anymore.

8. Client server in the same language and shared code

To download the ET framework and open the server project, you can see that the server has referenced a lot of the client code and implemented the two-side sharing code by referencing the client code. For example, the client side of the network message between the two sides of a full file, add a message only need to be modified once.

9.UDP TCP protocol Seamless switching

The ET framework not only supports TCP, but also supports a reliable UDP protocol, UDP support is encapsulated Enet Library, Enet is also used by the League of Legends Network Library, which is characterized by fast, and network packet loss in the case of the performance is very good, this we have tested TCP in the case of packet loss 5%, Moba game on the card, but using enet, lost 20% still do not feel the card. Very powerful.

10 There are many more features, I will not introduce the details

A. and its convenient check for CPU usage and memory leak checking, vs self-profiling tools, no more worrying about performance and memory leak checking
B. Using the Nlog library, playing log and its convenience, in the ordinary development, you can have all the server log into a file, no more files to search for log
C. Unified use of MongoDB Bson serialization, messages and configuration files are all Bson or JSON, and later use MongoDB to do the database, no longer do format conversion.
D. Provide a powerful AI behavior tree tool
E. Providing a synchronization tool
F. Provide command line configuration tool, configuration distribution is very simple

The service side of the ET framework is a powerful and flexible distributed service-side architecture that can meet most large-scale gaming needs. Using this framework, client developers can do their own double-ended development, saving a lot of manpower and resources, saving a lot of communication time.

How to use:
Operation Guide

Discussion QQ Group: 474643097

Introduction to the "Go" Egametang framework

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.