Unity3d development practices: technical details of the Three Kingdoms!

Source: Internet
Author: User
In last November, Wang Weifeng, CEO of Shanghai huoyan network, took his first 3D mobile game product "Three Kingdoms" as an example to explain the unity3d mobile online game development experience, it involves the team composition, personnel requirements, common unity3d development pitfalls and solutions. In his speech, Wang Weifeng also contributed various experiences summarized during the Three Kingdoms development process and explained many details such as optimization, plug-in library, server architecture, and SDK. It is worth mentioning that Wang Weifeng's speech at the scene was very humorous, and the jokes continued to burst, so that the audience could listen to this special technical speech in the continuous laughter. <Ignore_js_op>
The following is a live speech by Wang Weifeng: I am very touched. You have been waiting for so long to hear about unity3d, right? Joke. <Ignore_js_op>
I am very surprised and honored that Hong Tao (gamelook editor-in-chief) invited me to give you a technical explanation. Speaking of mobile games, I have been engaged in technology for many years. As a person hiding behind the symbol, I have many things to talk about. Let's talk about my feelings in the light of our product development process. We may not be familiar with this product. Let's take a look at our video. <Ignore_js_op>

 

I will briefly introduce my game experience. I have been a client game before, and now I am working with two old guys to make the Three Kingdoms. Let's take a look at the composition of our team. So far, we have a total of 18 people, including 6 developers, 3 artists, 8 programs, and 1 test. I am talking about technology today. Maybe these jobs are my focus. One is engine programs, server programs, and tool programs. I mainly focus on programs. Server programmer <ignore_js_op>
I will not elaborate on its knowledge, skills, and responsibilities. It is a bit like recruitment inspiration. Although responsible for technology, his main responsibilities also provide some decision-making for product decision-making and direction. His most important evaluation indicator is experience. It is best to lead or participate in the development of an online game. For example, two programmers graduated from the West Pacific University, focusing on complex electronic stabilizer. Another person may have developed a game under the coal boss. Although the game is not big enough, it can hold 3000 people. I must have chosen a person who worked with the coal boss, this is my understanding of server programmers. Engine programmer <ignore_js_op>
Speaking of unity3d, I have an engine programmer who wants to understand the 3D engine. How do you judge that this engine programmer is not qualified? What book did you ask him to read? He said that I could not be an engine programmer while reading "21 days to learn unity3d. This is an engine programmer's shelf. What books have you read? Game programming essence, GPU essence, shaderx series, etc. Even if you go out looking for a job, you can talk to your boss about it and I have read it, at least it looks like, even if you haven't seen it, at least your vision is open. unity3d is not easy to use because there are so many books to watch. If you often go to the unity3d School website, this is useless. So simply reading "21 days to learn unity3d" won't learn unity3d. <Ignore_js_op>
Engine Programmer I want to talk about the core points. First, he wants to understand the working principle of the 3D engine, optimize it, and find out how to solve the fire. If you are not sure about the project standards at the beginning, you will jump into the trap accidentally. The worst thing about this is me. For example, 50 sets of characters have been made. If you don't do it, you will be able to repeat it again, and then you will be able to get rid of this art resource. Find reliable unity3d people, that is, "Mom no longer has to worry about using unity3d for mobile games ." One sentence proves that you have used unity3d. The comments of ordinary people are: unity3d has many pitfalls. Experts will say? A startup team who uses unity3d for mobile games will die. At this point, I think most people just want to hear about the pitfalls of unity3d. <Ignore_js_op>
Unity3d is the most serious pitfall for programmers who do not know 3d and use unity as an office. After so many years of development, unity has become a powerful engine. I just picked it up and talked about the pitfalls we encountered. It was a bit difficult to use, that is, 5th articles. It had an asset server that cooperated by many people, and sometimes it was unreliable, now we use SVN for version management. Then there is a pitfall, that is, many teams seldom perform real machine tests, and diaosi developers may not even have an iPhone. Once the test finds that the game is not running at all. There are also 10th items. C # Code cannot be updated in IOS. If the update is MB, this is not a unity error. It is an iOS error. We did not know the restrictions on IOS when we were doing "Three Kingdoms". We should have planned to make it a script update. To put it simply, because Windows Phone is also very popular now, we need to test WP as soon as possible. It has been identified that unity is a good engine for the masses to enjoy and make fortune. Then there is experience sharing, "top secret", and how we make the "Three Kingdoms. Before that, I would like to express my gratitude to our two entrepreneurial partners. These are all top secret and are not easy to say. At present, unity has a certain threshold. However, after three months or half a year later, when you are familiar with these tools, the value of our team will be reflected. Our programmers are doing a good job of logistics. <Ignore_js_op>
Let's first talk about the working environment of our program. The first is the small black house. The working environment of programmers cannot be too bright. We do not have to worry about the cost of hardware facilities. For example, the dual-screen display of the high-end atmospheric class on the right side, i5cpu + win7 64, 8 GB memory, SSD. Why is it so good? Many programmers will ask when they are recruiting, is your company a dual display? From the perspective of productivity, this "camera" can greatly improve the development efficiency of unity3d. In the whole process of programmer development, unity3d actually requires a lot of disk reading operations. You have such a set of machine configurations, I think the programmer's work efficiency should be improved by 5-6 times. If you are still as high-end as we are, you should also match a MacBook Pro. Efficiency Optimization then let's talk about the general method of efficiency optimization. Of course, we will talk about these methods based on one method, that is, you will understand the 50 books you have read before, and you will understand what you say. The first exclusion method, where the screen drops if you suspect it. This is the most basic and effective method. The second is to use data to speak and make good use of unity4's powerful profiler tools. I now feel a bit horizontal for programmers who rely on unity4's powerful profiler tools and have no reason to make a game that cannot run, because the performance analysis and statistics designed here are quite detailed and quite useful, it can count your CPU usage, and you can count every module and function, the time of each execution. There is also the CPU benefit, and we know that there is a video card, and a GPU. The GPU is a very intuitive picture of how many triangles you have rendered. The expert knows it at a glance. The last point is to emphasize the real mechanism test, which is often released to the mobile phone for running. If it is a diaosi team, you should buy it if you do not have an iPhone.
Optimization 1: Let's talk about our method. How can we solve this problem when draw call is too high. <Ignore_js_op>
3D rendering is different from that of one hundred people. You have to render one hundred times for one hundred people. How can this problem be solved? The best way to improve efficiency is to lower the draw call speed if it is higher. The fastest rendering means no rendering. This is something we can't see outside the room, but the computer can see. You don't need to render it, or who is behind me, if there are two people, I will delete them. You can also manually configure the visible range list. The second is that there are too many objects. You can consider merging multiple objects into one. This can be done by art or programs. I used to be a forest with at least 20 trees. Let's merge the fine arts and combine these 20 trees into one object. It looks like a forest, the other is to let the program do it. You can see that we are in the west of the battlefield. Because we have attacking troops, a team of more than 30 people shooting an arrow, this requires more than 300, let the program merge all the dynamic into three. Including shadows, that is, dynamically merge all shadows. Optimization 2 <ignore_js_op>
Understand the implementation principle of material and avoid misuse of material. As mentioned above, unity is the same as playing a game. If you find that the game is not running, you need to have a person who wants to make a plan for you. Do you have such an effect? If so, how do you implement it. What kind of shader should we use? Is there a high/low configuration. Let's take a look at the effect of some of the materials we have written on the left side, including the characters and effects. The third optimization aspect is that there are too many models. <Ignore_js_op>
This is a person on the video card, but it is actually composed of triangles. For example, do you have many triangular shapes? What should we do? And then subtract. When rendering a lot of soldiers, we will use this one with no legs on the right. In fact, when playing games, the game vision is masked. Tool-based <ignore_js_op>
One-click installation packages for all platforms. Because we know that you have received so many channels now, you have a version and a key. For example, if you have ten channels and you don't have our camera, it takes half an hour to package a channel. This is an out-of-the-box tool for our android channel, ranking in no particular order (laughter ). Because I have been doing this technology for so many years, I am very interested in tools, including the need for programmers to use tools to free themselves. Server Structure <ignore_js_op>
This is a typical client game structure. The previous one is a connection server. Its function is to say that our game is a persistent connection game. A physical server has limited carrying capacity, we need to have many servers, followed by the Routing Server, and connect two or more servers. The red behind is the game server, followed by the database server, providing a high-speed buffer. This type of server structure is selected because it is easy to expand and put plug-ins <ignore_js_op>
The third is the secret of our game. The core of the entire battle on this battlefield is written in C ++. One advantage of this is writing multiple operations at a time. Further benefits I will talk about later. The disadvantage is that the development speed is slow and debugging is difficult. This is anti-plug-in. There are several principles for anti-plug-in, that is, only the server is trusted, and all player data is stored on the server. The combat results are verified by the server. Because my combat module is written in C ++. Data analysis is followed by data analysis. Now we are all concerned about big data. In fact, we did this three or four years ago. All the players' behaviors in the game are generated by logs on the server. Every day, the program collects this massive amount of data and then stores it in the database for analysis. Crazy SDK <ignore_js_op>
The next step is the crazy SDK. We now have IOS 10, Android 40 +, which is indeed quite a lot, but there is nothing wrong with it. However, there are two principles to note: one is less relevant to the game code, and the other is easier to debug and test. In this way, when we connect to the SDK, we can use tools that can be understood by SDK programmers. At the same time, developers can also hand over the SDK to someone else to pick it up, without the embarrassment and worry of leaking game code. It turns out that our android channel agents are very powerful, and the sdks of all our android channels are all for us. There are two ways to solve this problem. One is the client, from the first standard interface, and then the server we introduced a server for SDK transfer, the interface of our game is equivalent to connecting through a bridge. I use a stable server. Able to test and debug engineers. This can also improve work efficiency, and he doesn't have to get familiar with your game levels all day. Plug-in library <ignore_js_op>
The next step is a plug-in/library, which is a third-party thing we use, and a ngui. This is a more reliable UI and there is no choice for unity. The second and third are protobuf. This is a library used to transmit message packets between the client and the server. This library is good and stable, and is made by a programmer who is full of support from abroad, it supports many platforms, such as Android and IOS. Next is unityvs, which is a plug-in for unity code debugging. It is good to use and can stay away from the mono tool provided by Unity itself. The last one is the prime storekit. This is the payment for genuine apple. After you bought the apple, you had to go through the pitfalls. I suggest using a third-party code library with caution, which may cause trouble for cross-platform release. Manufacturing of leading role <ignore_js_op>
Next we will refer to the three-point illumination method, which is our main character in the game. The role on the left is the effect of the illumination model, and the role on the right is normal, let's take a look at the difference. The picture on the left is more three-dimensional. Then it was the manufacture of the protagonist. We also spent a lot of money on this protagonist. Although it was a diaosi company, we saved money and didn't pay for it. We invited the concept art of Longjiang to make a setting for us, we can see that the restoration degree from the original image to the 3D model is very high. <Ignore_js_op>
Next, let's talk about our scenario practices, because the scenario is a basic effect, which is cool. If you want to increase the mode, you can see the illumination effect provided by unity. The latter part is our appreciation of some of our scenes. This is a small village of ours. The earliest wandering place of Emperor Han xiandi is our main city, Jingzhou City. <Ignore_js_op>
Finally, our cards are used by experts. The cost is over one thousand. In the end, I used this picture to make an end. In last May, three of our three founders, three computers, and three founders, were working on the Three Kingdoms. <Ignore_js_op>
In the face of this photo, I feel a lot of emotion every time I read it. What strength does it support? In And, web games were still in full swing, at that time, no one talked about mobile games. If you talk to investors about mobile games, investors will ignore you. At that time, why were the three men so bold that they dared to establish such a product, including the gameplay of the game, including the entire method, which had not been changed. What makes it possible for us to make such a decision and stick to it for one year and six months. My conclusion is that we have been playing games and we are players. Thanks for our love for the game and our reverence for the game. Thank you!

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.