Unity Client Basic Framework (reprint)

Source: Internet
Author: User
Tags unity 5

Framework Overview:

Framework of the basic system, which includes:

    • UI Framework ( NGUI + MVC )
    • Message Management ( Advanced CSharp Messenger )
    • Network Layer Framework ( Socket + Protobuf )
    • Tabular data ( Protobuf )
    • Resource Management ( Unity 5.x the AssetBundle scenario)
    • Heat more frame ( tolua )
UI Framework:

Use Unity 5.x for the game development of friends, most people want to use the system to UGUI build the UI framework, this is not bad, but for the engine upgrade is not friendly, if the unity upgrade to UGUI make a relatively large changes, then a molded project to upgrade the engine, The cost of modification is immeasurable, so here I still use NGUI as a tool to build the UI framework, in addition to the integration of MVC architecture also consider the post-access thermal update.

Message Management:

Here we use the Advanced CSharp Messenger message manager for this C # event, which is characterized by the ability to send game objects as parameters. Moreover, this advanced C # version of the messaging system automatically cleans up the event table at a new level to load, which prevents programmers from accidentally invoking the Destroy method, thereby helping to prevent many MissingReferenceExceptions . This message delivery system is based on the Rod Hyde Csharpmessenger and the Wolffelt csharpmessenger extension of the Maghreb.

Unity 3D Gaming client base framework messaging system

Network Layer Framework:

With the upgrading of the mobile network, in the 4G network has long been popular today, in addition to single-machine games, now the vast majority of online gaming is a strong networked way to achieve, select Socket the communication can be updated in real-time player status, the choice of networking methods, but also need to consider the network protocol customization problems, Protobuf is undoubtedly a better choice, on the one hand is good cross-platform features, on the other hand, small data volume can save communication costs.

Building a multi-threaded asynchronous Socket framework for the Unity 3D Gaming Client Foundation framework
Unity 3D Gaming client base Framework PROTOBUF Network framework

Tabular Data:

In game development, there is a lot of data is not to be pulled down from the server through the network layer, but by the format of the table configuration stored locally, for example: a game props, usually the server issued the item Id (unique identification) and lv (level), The client then retrieves the item's specific property value from the local data. Tables are typically used Excel to configure the data, but we typically do not package the form .xlsx 's original files directly into the game app package, usually by serializing the tool into a binary file format and then deserializing the data when it is read. We mentioned the use of Protobuf custom network protocols, but Protobuf in fact the serialization and deserialization features can meet our requirements for tabular data transformation.

"Unity 3D Gaming client Infrastructure" PROTOBUF Excel Tabular Data

Resource management:

For the management of resources, in fact, in order to provide the next access to the hot update possible, Unity production game resource management method through the AssetBundle tool to the resources into multiple ab packages, for hot-updated resources to heat more, not a single file of the heat more, but rather through the network download new ab Package to replace the local old package, thus achieving a more thermal purpose.

Hot Update Framework:

It is common to use C # for unity Development, but pure C # scripts can only support hot updates under Android, and there is nothing to do with the iphone system, so it is often necessary to introduce a scripting language lua , write the underlying framework using C #, and write business logic using LUA. This is the most common design method in the industry, and there is a very mature hot-Update Framework tolua (formerly known as ulua ). Typically hot updates are: Picture resources, UI prefabrication, and Lua scripting, and for cross-platform considerations, C # Scripts are not allowed to be hot.

Summary:

Above just roughly said the whole framework will be involved in the tools and technical points, below I will each point on a per-article refinement, interested can continue to follow, of course, according to these suggestions to self-study, which may also be much faster.

Reprint Address: http://blog.csdn.net/linshuhe1/article/details/75175112

Unity Client Basic Framework (reprint)

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.