How Creator prevents scene version submission conflicts

Cocos creator is data-driven, component-based development, and visual editing, which is very convenient. In daily development, many people cooperate, and the scene is often modified by multiple people at the same time. There will be conflicts in the submitted version, and the transmission code conflicts, this is easy to solve. We can just manually merge and correct it, but how to resolve scene conflicts? (Humans cannot read scene files) The general approach is that everyone divides the game into multiple scenes, and each person is responsible for one scene. When multiple people change the scene, it is a pain in the ass^_^.

How to solve this problem? Let’s take a look at a few principles. 

1: Try not to have anything in the scene. Only have some basic things inside, such as Cavans + Camera,

Scene content can be generated by loading prefabs through code.

2: Try not to bind code to the prefabricated view. In this way, there will be no conflict when modifying the code of a component at the same time. Binding code to the view can be done by adding components through code. Binding code events on the view is also done using code.

3: Each view is made into a unit with as single function as possible. It can be developed by one person at the same time to avoid conflicts between everyone.

How did we do it? I will keep an important node in the scene, which is the startup node, and then hang a startup script. The startup script is responsible for initializing some important management modules and script modules. Some important management modules

Everything that needs to be mounted is completed. Then enter the initialization process of the game, such as creating views, creating maps, hanging scripts, etc. When making a view, use the scene editor. After the creation is completed, save the view as a prefab, and then use the new code. At the same time, write some unified interfaces to hang scripts, events, etc. on the UI.

Don't hang up on the interface.

This can basically solve the problem of creator development conflicts.

Guess you like

Origin blog.csdn.net/m0_69824302/article/details/135463959