Research on 3D model replacement system of cocos2d-x, cocos2d-x replacement

Source: Internet
Author: User

Research on 3D model replacement system of cocos2d-x, cocos2d-x replacement

This article will not provide specific implementation and code (because I haven't done it yet), but will analyze the update system I understand and give directions.

I. What is a replacement system?

In RPG games, different weapons and equipment are replaced, and the character model is changed accordingly. This is the replacement system. The update system can increase the expressiveness. For example, if you change the armor in the dark, the characters will look different, and some of the best equipment will still be surrounded by light effects, so that the equipment will be more interesting.


Ii. How to Implement the update system

1. Replacement of weapons and external components (such as shoulder guard and cloak.

This is the simplest and most basic. You can create a binding point on your hand or shoulder, and then attach the object to it. Most of these objects are rigid bodies without animation, and the corresponding binding point skeleton will drive the correct motion of the object. The binding points and bones in Unity are combined with the Transform component, so the operation is very intuitive.

2. Replace the Model

Early online game processing is very simple, and equipment will affect the appearance of weapons, helmets and armor. Therefore, you only need to prepare a model for each armor, and change the corresponding model when you change the armor. This is also very simple, similar to weapon processing, but it is the difference between the basic model and the mounted model.

3. Replace Materials

Art will design different textures for the same model when contributing to the source. For example, the same monster can be either green or yellow. If the pattern is more complex, it can be an elite monster. The same is true for armor. You can replace different textures with the same model to achieve the effects of different equipment.

4. Replace parts

This is the most troublesome and involves sharing bone data. In simple words, the skeleton animation drives the vertex (subject value) and the vertex affects the skin. Generally, 3D models and animations have three core data types: model data, which determines the display appearance; and skeleton data, which is the basis of animation, describes the weights and relationships between bones. The last one is animation data, which describes how the bones move. Different models can share the same set of bones and the same set of animations. This can save resources to a large extent. A model may only have 100 or 200 kb, but an animation may be several megabytes.

A prerequisite for component replacement is that the replaced object uses a set of bones and has the same weight as the original object. You should also pay attention to it during production. For example, the armor and the head cannot have seams during animation.

Many parts of torch light are placed on a virtual model, that is, they look like a humanoid, but they are useless except for gloves, armor, boots, and helmets. Based on a configuration file, the game determines which parts are deleted and which parts are added when a device is put on. The advantage of doing so may be that it is more convenient for production and viewing, and it can better process equipment and body animations.

The update Implementation is simple. It is nothing more than deleting the original object and adding a new object. But we need to understand the reason why we can replace the package. Cocos2d-x can replace, we need to study.

At least for now, cocos2d-x v3.2 cannot be replaced. Because it does not support submesh, a model is a whole. However, I checked that the latest code on github supports submesh and binding points. In theory, the model can be changed. The specific code can be completed only after research.

Okay, just looked at the latest cocos2d-x, inside the 3D model function has been relatively complete, and there is a demo, I said several ways can be achieved. You don't need to study it yourself. If the animation bone reuse is OK, it really saves time (don't consider the cocos2d-x is not wrong), you can spend more time to study the particle system. You can also take the time to see if you can make the cocos2d-x compatible with the OGRE mesh format.


Is there a successful case of a replacement system for the COCOS2D-X?

Tian Xian, ZENONIA 5. You can use Spine or CocoStudiol to implement bone animation + update.
 
How to achieve the Cocos2d-x CCNode node touch?

It is recommended to look at the wheat college Cocos2d-x tutorial! There will be a solution! Mr. Long lingxiu said. Don't miss it!

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.