Cocos2d-xna: horizontal strategy game development experiment 1

Source: Internet
Author: User

There are a variety of game engines in the world, many of which are excellent. cocos2d, as a popular engine, is very good, especially with complete tools. The most important thing is that it is free. In addition, various groups provide various engine support, cocos2d is also widely used in mobile development. Currently, it is available in various languages, although WindowsPhone will have C ++ in the future, after all, the unique features of C # will make it difficult for supporters to give up. cocos2d makes it easier to develop WP games since the XNA version is available, even now, you can play WinRT games. You can read the previous articles.

Let's play a game.

Long time no instance of the article, this time from the development of a more complete game with cocos2d-xna, so that everyone can appreciate the unique charm of C. What kind of game should we develop? It's still a strategic game. In this way, we can basically practice all the technical points. The first step in game development is to plan and design and think about the final game form, which is generally in the gaming company, this step is to establish a project. In most cases, it is a flash of thought, and then start to work, however, excellent development teams will certainly spend some time on planning and design-but do not take too much time, on the one hand, because they cannot get stuck in the infinite YY, on the other hand, because a good game is changed, the initial design can achieve 80% is already very good.

So we can simply design this game:

1. Style: Three Kingdoms

2. This is a strategic game that tends to expand to intelligence.

3. Two-party gameplay

4. The enemy and I are on both sides of the map.

5. The soldiers automatically hedge and attack the enemies on the road. The soldiers have a life value.

6. Buy soldiers in one way: reinforcements or money

7. Soldiers will win when they defeat the Lord, and the Lord will have a life value and will not be easy to beat

8. Soldiers are divided into infantry, gun soldiers, cavalry, and bow soldiers.

9. The restraint relationship is: Step, gun, and ride. The bow is the weakest, but it is a remote attack.

10. The primary will have some special capabilities that require money

OK, the preliminary design of this game has come out. Maybe your design will be better, but don't be greedy. Now we will find that this description is too simple to describe a game at all. So, we can use our various design tools to design and create a blueprint. If there is an art design that helps you be a very happy thing, we can only do it by ourselves. Below is a design drawing, the art materials come from dark blue's right hand game tutorials. Okay, they all come from the Internet. Don't ask me about copyright.

This is just a very brief preview. We will probably use it to understand what the game is, and more details will be modified at the back.

Body Structure

Before making such a game, you have to think about what functions are needed, especially how many interfaces are needed. It is best to plan as follows:

Through the above figure, we can see what the specific form is. Is it better than the previous thought stage? Then, we may need to perform more detailed requirement analysis, such as basic roles, skill systems, and map logic. Generally, we provide detailed plans by planning, then the main program completes the program architecture based on the planning and design, and defines various interfaces,

Next, let's make a try like this. There may be some places that you don't quite understand. It doesn't matter. In the future, we will give a step-by-step explanation, and the first architecture will be omitted in general.

Step 1 first build a simple cocos2d-xna project, here I use WindowsPhone as a development platform, through the previous article Win8 Metro App play XNA: how to use and port cocos2d-xna games, you can also easily port to Win8, if you have installed the latest cocos2d-xna Engineering Template, then you can see the following interface in the new project.

If you have any questions about this part, you can refer to this article: "Cocos2d-x for WindowsPhone: tall buildings can also do not need to flat."

Now, it's easy to get confused about building the entire game architecture. I don't know how to start it. At the initial stage, I just want to do what I think, and I don't think too much about it, early on, I wrote a simple game shelf:

From the Game entry point to the AppDelegate class, jump to the scenario to the start interface. If there is a load, it is generally added to Loading. Okay, we don't need this, here is a simple description of these classes:

SceneStart: Game start scenario

SceneSetting: Set the scenario

SceneSelect: Map selection scenario

SceneGame: game scenario

SceneOver: Game end scenario

Compared with the previous process, we can skip the previous steps in these scenarios. However, an Actor class is required for a game with actors, which is helpful for development, among them, ActorData for data processing processes data here. Generally, the logic of ActorBase processes animations here. Actor processes the game logic here. If necessary, it can inherit from heroes in the future, we should not waste our energy here.

The framework code in: https://github.com/Nowpaper/SanguoCommander_cocos2dxna_Sample

Now, let's take a look at it today. In the next article, we will handle scenario switching and redirection, as well as resource processing operations.

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.