Home > other >  How to study large game project source code? Unreal engine source learning ideas to share
How to study large game project source code? Unreal engine source learning ideas to share

Time:11-08

Do each and every one has his own style and habits, around when you discover that a person is very good, you go to see him is how do you spend 24 hours a day, and then compare your 24 hours, the answer is very clear, in the same way, if you find it hard to learn the source code, might as well ask the more cattle "survivor", have a look at the others learning source module process, in particular, of course, affect the latitude of a thing, details, prerequisite for many, copying someone else's method may not work, such as people can learn a firm 10 hours a day, the almost impossible in some body, the source of that how to study large game project? Below I myself learning unreal engine source code (c + +) train of thought and process to share with you,

About millions of unreal engine source line (no accurate statistics, pure code can refer to the following folder screenshot), the earliest can be traced back to 1998 Epic, independent research and development of 3 d games, fantasy, for a provides a so perfect game engine, can imagine his code is quite complex, so the learning you need to have a clear at the beginning, your purpose should not be read from cover to cover all his source, but after good learning goals determine, branches and organized to sort out a particular module, the content of the

This simplified version of the summary is given first, then I will do further elaboration for each,

Preparation: recommend to large and continuous time (finely time comb easily break class relation), a more convenient to find the IDE or tools (VS, notepad + +, etc.), the class diagram tool (staruml, Edraw, etc.)

Learning step (simplified version) :

1. Decided to study module, find the official documentation, the summary of relevant articles, sort out about learning content and target

2. Run the program, observing performance

3. Run the source code, the breakpoint debugging, from the beginning with source code execution process, pay attention to the function stack

4. Draw the class diagram, flow diagram, the first important class, shows the relationship between the various classes

5. Record the questions that don't understand the content of the class or recorded in the form of questions

6. Writing articles, notes, and try to solve the problem of legacy before
one by one
2-6 May need to be repeated continuously

Learning step (detailed) :

1. To find the official documentation, relevant summary article

, for example, I want to study network module, the first to the official document, BBS, wiki inside again all network related content, this time don't understand the problems as far as possible to solve, down won't solve the problem, first go to the official documentation to see I think is very necessary, because the article is the most authoritative, the error rate is very low, then, go to Google, baidu search related articles and posts, at the same time you can join some technical qq group (group of decisive back some water, keep some high quality communication group), again these articles and the information, now we can see a better technology website basically (BBS) on the official website of each technology, StackOverflow, zhihu, blog, Jane books, CSDN, some personal website, etc., of course, some sites copy and paste is serious, the need to filter, proposal can find links to the original as far as possible to the original inside look, because you are likely to see more good articles from the original author,

2. When running the program, we need to adjust the various parameters to perform different situation, and then observe the effect of performance to prove our conjecture and conclusion

For example, for a dormant Actor attribute whether can normal synchronization, whether attributes if the client and server will execute the callback function, such as the executor can quickly come to a conclusion, and then according to the conclusion that we can more accurately analyze, in order to improve the efficiency, it's best to be set in a different configuration, such as GM to dynamic changes in the project runtime operation content, because big projects are generally a compiled language, we may probably need to modify the code compile again run frequently,

3. Debugging is arguably the most critical step, 80% of the details need you to understand in the debugging

Function when executed here (function breakpoint)? Every step of each attribute value is how much? When the attribute value change (conditional breakpoint)? What is a complete implementation process () function stack? These problems need you bit by bit tracking debugging, and then to solve,

4. Draw the habit of many people may not, but I personally think it is an indispensable link, because he can greatly improve the speed of the framework you understand

For any complex projects, each module will be involved in a lot of classes (exclude pure C project), kind of relationship is complex, and in order to reduce the coupling may also use a variety of design patterns, these are reading difficulty, greatly improving the code is likely to you after 3 or 4 class totally confused what they are, for example, I was watching UE4 attribute synchronization module, completely is obtained, the relationship between the classes so I see a class took his class pictures down, see the relevant class record their relations, and finally got the following such a simplified class diagram, after combing, a few words I can sum up the relationship between them,

, of course, in addition to the class diagram and flow diagram, sequence diagram, and even yourself in order to convenient invention "module diagram", this figure with the kinds of specification is not so important, as long as they can help you to understand,



5. Record the question has two kinds: someone else give you problems and give your own

People to your question: you can't be plain sailing, when reading may be in the first step, has encountered numerous problems, then don't try so hard, the order of importance, in turn, solve, simple question direct search on the net, can not solve the around looking for the great god, and of cattle people solve online, if still won't do, just write down the problem, and then continue to learn, when you go to a certain degree, the sort of problem may be you,

Yourself: when you solve the problem of the others to you, you should have understood more than half, however, anyone can not cover all articles, you need to dig more deeply into the problem, and then himself to answer, so that you can do so much more than others, more can reflect the value of yourself,

6. Write articles and write notes there is a difference between, but they are very meaningful

Writing an article about it than the above steps I don't think it is necessary, that is suitable for the pursuit of perfection will make time, what you wrote is for others to see, so you give to others is the purpose of clear, when I was writing an article will consider this thing I said really right, is there a hold, considering the overall, whether under this self torture, I'll try to improve my knowledge system, change the contents of the article that appear to not accurate enough, if finally can be clear to the reader, that is you really are,

Writing is much easier than writing your notes, I just put my summary, the content of the learning harvest, don't need to worry about things so much, although there is no writing so pursuit of perfection, but in this process, we may also be a lot of thinking, more later in the learning process of rapid recalled his learning experience,

Note: for the first time to carry out the process is quite long and difficult, if you like me at first knowledge reserves is insufficient, so almost every step needs a lot of learning and check information, but as long as the stick to it, you will eventually find their harvest is very large, it a lot easier to read other module source code also

Just above I study the source code of a method, may not be for everyone, there are a lot of places can be further perfect,

Finally, I emphasize again, if it is good to use a tool, you don't need to completely understand everything, because your time is limited, if you really are holding the learning attitude to study the source code for the details, so please ready to spend a lot of time and stick to it,
  • Related