Study notes (four): logic and script development

1. Logical system purpose

  • Implementation planning design document
  • Build gameplay
  • Realize program and player interaction

2. The logic system seems to be a part with not so high
technical content, but the technical content involved is quite a lot. The logic system is one of the most complex systems in a game project. It is necessary for the writer to build a more comprehensive and extensible logic architecture through experience as much as possible at the beginning, and then continue to iteratively improve.

**3. Features of the logic system: **In fact, the features of the logic system correspond to the characteristics of the game itself. A game needs to have very strict performance requirements, changes in requirements are extremely frequent, and development efficiency is emphasized.
Then the corresponding logic system must meet the requirements of good operating performance, not crash (no kidding), and have good scalability. Due to the tight time period, it is unlikely to spend too much time considering architecture and design patterns.

4. Commonly used languages ​​for game logic development:

  • C++ Unreal engine, Cocos engine, most self-developed engines
  • C# Unity
  • JavaScript Unity
  • As a scripting language, Lua can be used in all engines and is often used for hot updates

The above-mentioned language compilation and operation mechanisms are different, and the specific content needs to be studied in depth.

5. The application purpose of the scripting language:
simple modifications can be handed over to planning to achieve, which can improve work and development efficiency, and can be used for hot updates.

6. What is a hot update?
Hot update means that you do not need to re-edit the underlying code, and modify the game logic directly by modifying the script. For mobile games, players cannot download a
complete game package every time they update . We can update the game logic by only updating the script code when entering the game. This requires your engine to support the virtual machine corresponding to the script.

7.
C # brief description The syntax is close to C++, but it is easier to use and learn than C++.
There is a garbage collection mechanism, no need to manually release the memory. It
is the official scripting language of Unity
. It can be converted to C++ code compilation and execution through IL2CPP on the IOS platform.

**8. Note on garbage collection: ** Do not call for forced garbage collection frequently (the performance overhead is quite large), and allocate as little memory as possible,

9. C# use notes:

  • Avoid using foreach, string splicing, boxing and unboxing (the reference types in C# all inherit the System.Object class)
  • To avoid frequent memory allocation, you can allocate a relatively large space of memory in advance, or you can use the memory pool to create an object pool to reduce the performance overhead caused by object memory allocation and release
  • Try to use struct instead of class. Because struct in C# is allocated on the stack and Class is allocated on the heap, garbage collection is required. There is no difference between the two in C++

10. C# commonly used containers

  • Array List ArrayList (the member types can be different)
  • LinkedList(包含LinkedListNode)
  • Dictionary (high performance overhead)
  • HashSet
  • Queue

**11. About event and delegate: ** If this thing is relatively shallow, it is recommended to understand it briefly, I have time to explain it in detail (it took a long time to understand it at first).
Those interested in learning its principles can refer to the link:

12. Unity uses object components as its main development model. Most of the functions are on components. By adding different components to an object, it has different functions.

**13. About the coroutine: ** First, it is recommended to understand multi-threading. After watching the video, you can refer to the link: http://dsqiu.iteye.com/blog/2029701 http://www.cnblogs.com/zhaoqingqing/p/3750522.html

14. The construction of a simple game system in the video:

  • Overall logical system framework construction
  • Input system
  • Checkpoint system
  • Role control system
  • Original link (please indicate if reprinted): http://blog.csdn.net/u012999985/article/details/79090524

Guess you like

Origin blog.csdn.net/qq_43801020/article/details/108927784