Cocos2d-x Project's Game frame building

Source: Internet
Author: User

The cocos2d-x version used in this article is: Cocos2d-x 3.2


Cocos2d-x Project's Game frame building

Game and Application project in fact, the difference is not very big, even there are many places are the same, but the focus is different, mobile game more focused on user experience, more entertainment, emotional, so that players feel "cool." Mobile phone applications are more focused on simplicity, clarity, and priority to complete the business.

On the basis of the cocos2d-x engine, we actually have to do a lot of preparation work:

I. Analysis of PROJECTS

First of all, we need to know what type of game we play, what the game mechanism is, according to the current market can be divided into the following types and mechanisms:

1. Type of game

A, Action class

B. Policy classes

C, role-playing class

D. Sports Class

E, driving simulation class

F, operating simulation class

G, Adventure Class

H, puzzle solving Puzzles category

I, Social game class

2. Game mechanism

A, physical mechanism

B. Economic mechanism

C. Progressive mechanism

D. Tactical maneuver Mechanism

E. Social interaction Mechanism


When we get the project, we have to understand that, because that's the basis of what we're going to use.

Like the legend of the turret, what basic technology does it need to implement? It's like the bone system in the ad ! What about Angry Birds? I don't need to say that the students know, the physical system ! Then the rest is based on the planning requirements and then add some basic system application.

Second, you know our game is a stand-alone game? Or a stand-alone weak networking game? Or a strong networking game? Whether the communication is a long or short connection.

Finally, the logic is on the server, or on the client side! This is important! There are some things involved, let me say a minute.

Second, the construction project

Once the basic requirements analysis is complete, start creating a Cocos2d-x project.

Wait patiently for a moment ...

All right, project creation is successful!

After opening the project, we can see that Cocos2d-x has helped us integrate some systems:

Chipmunk physics engine and audio system, so let's first compile ...

The familiar HelloWorld is coming!

So what systems do we need to help us complete a game based on demand?

1. Network Manager

Network manager, generally according to the needs of the game, we will use 2 ways, short connection and long connection. Short connection cocos2d-x has provided us with a network library, and long connection? Socket will need us to find a third-party library, for the socket personal comparison recommended Odscoket, because Android and iOS are compatible, cross-platform is the king!

2. Data Manager

Data Manager, plainly, is a packaged single-instance data module that facilitates management and invocation of the data Set manager.

3. UI Manager

The UI manager, let alone, is our own packaged UI manager, and of course first we need to familiarize ourselves with the Cocos studio! Personally feel that there is Cocos studio for IP and no more trouble with the program, I intend to the next section in detail about the UI manager. You want to use the library file that Cocos Studio must add.

4. Database Manager

For medium-sized and large-scale games, it is sure to use the database, fortunately Cocos2d-x also prepared for US Sqlite3 library, here we need to be familiar with the general SQL statements, at least Delete and change must be AH! As it is, everything has its own, and it owes only to the east.

5. Encryption Manager

Why to mention encryption, mentioned above, the logic is on the server or the client, most of the game logic is on the server, why? is because of the problem of encryption, the client is only responsible for the display of logic and the submission of business, but there are many game logic in the client, the server is only responsible for the preservation of data and data validation. In fact, I personally prefer to put logic on the client, so that will greatly reduce the server pressure, but the client must do a good job of encryption! In general, client-side encryption can use a variety of means, such as BASE64, MD5, AES, etc., specifically suitable for the current project, or to see the actual situation of the project.

Cocos2d-x Project's Game frame building

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.