Although I have played many games since I was a child, I have only written two games since I started programming. One was a snake game written on the MTK platform in 2011, and the other was a maze game written on an embedded development board in 2010. The first one had about 3,000 lines of code, and the second one had about 2,000 lines. Both games are very simple, and there are many ready-made examples on the Internet for reference, so the difficulty is relatively low. In the past two days, I finished reading the game engine chapter of "Android Application Development Revealed" , which I had been putting off for a long time. I gained a lot from it, so I'm writing a reading note here. Regarding Game Engine, I can think of a few questions:
Let’s discuss a few issues below: 1. What is Game Engine?The gaming industry is a huge industry in the world, and a game masterpiece contains a lot of elements. Games involve plots, characters, tasks, levels, maps, image quality, art, music, networks and many other elements. Developing a game actually requires a lot of resources. It is said that North Star's "GTA V" cost hundreds of millions of dollars. Because of this, it is very important to reuse the successful things of previous projects as much as possible during the development process. In a game, the Game Engine directly controls the plot, levels, art, music, operations, etc., bundling all elements of the game together. Generally speaking, a Game Engine needs to include the following modules:
—————-Dividing line, the following is an important but relatively independent part——————– 2. What problem does Game Engine solve?Game Engine actually effectively reduces the redundant labor of developers when writing programs, while enhancing the portability of games . Engine is the framework of the game. We need to fill the framework with content to form a game. An engine is a series of tools and production chains. Mature engines like Unreal 3 and Unity are very convenient to use because their level/scene editors are very user-friendly and support multiple scripting languages. If such engines are used properly, in theory, most of the work of level debugging and object assembly lines can be completely removed from programmers. 3. Game Engine Architecture
The current Game Engine architecture is a Model-View-Controller architecture, where logic and display are separated, and a logical control flow is used to coordinate client requests and server actions.
Message loop->update data->draw each node This is the basic structure of drawing and there will be no major changes. A large part of the variants of various engines are encapsulation of game logic. Whether it is scripting or direct coding. For example, the older separation of data and functions, represented by C language. The popular class structure, represented by C++. And now Halo Sun's CBSE, component-based architecture 4. How to design a game engine?<1>. Structural design and functional designThe design of Game Engine includes structural design, functional design and precautions. Game Engine includes graphics engine , script engine, physics engine, tool module, sound engine, network components, event components, etc. Android games mainly include an Activity class, a process control class, a game thread class, and a game object class. The Activity class is the execution unit of the game and is responsible for controlling the game life cycle. Process control: Provides methods for switching between multiple interfaces in the game; Game thread: constantly monitors various events that may occur, calculates the game status, and refreshes the screen. <2>. Notes:The main problem with mobile games is hardware limitations and battery bottlenecks. Insufficient CPU and memory, screen size, sound effects and other limitations need to be taken into account when designing. 5. Implement a game engineA game engine is just a cooking wok, but having a good cooking wok does not necessarily guarantee good dishes . The implementation of the game engine is very complicated. It needs to be coded according to the architecture and functional design in the previous section. At present, most of them are object-oriented programming, and various classes are designed. For example, characters, NPCs, props, animations, animals and plants, etc. Students who have spare time can study it. Some of the popular games recently don’t actually require a particularly awesome game engine. Only by fully exploring the user’s pain points can a good game be designed. There are many open source game engines available for research, such as Unity3D, Box2D, etc. You can search and research them online. 6. Outlook for mobile gamesI have played a lot of mobile games in the past two years. Let me talk about the characteristics of a good mobile game:
|
<<: Chrome and Android apps are interoperable, so why doesn’t Google have any appeal?
>>: Understand the functional features and application scenarios of WeChat Enterprise Account
In the past, when we went to the supermarket to b...
In many superhero and science fiction movies, air...
Summary of 2020 National Civil Service Exam Essay...
After Windows 10 2004 separated Cortana and the s...
According to multiple sources, Xpeng Motors has d...
Recently, it was reported that Snapchat’s daily v...
Salt is a necessity for human survival. Throughou...
There are three ultimate questions in philosophy:...
Introduction to Lao Liang's Value Investment ...
Author: Xiao Lin China Rehabilitation Research Ce...
According to DeviceAtlas latest data, KaiOS has s...
As an e-commerce operator , you often have to men...
Not long ago, Pinduoduo's market value surpas...
Einstein has many intriguing quotes, such as he s...
Review expert: Mao Xinmei, Chief Physician of Ped...