跪拜 Guibai
← Back to the summary

Cocos 4.0 Is Out — Why Are Devs Still Shipping on 2.x?

Why Are People Still Using Cocos 2.x When Cocos 4.0 Is Already Out?

Hello everyone, I'm the Billion Programmer.

Collection 1.0

Right after Collection 1.0 was released, I got a private message from a friend:

Didn't have it before, now I do

I stared at this message for a long time.

My first thought was: Cocos is already at 4.0, and 3.8 has been iterated for so long — how can anyone still be using 2.x?

Got it now

But then a second, third, and tenth similar private message came in one after another, and I realized this wasn't a coincidence.

Of course you can

So I did something quite "counter-trend": I took the entire Collection 1.0, originally built on CocosCreator 3.8.7, and forcibly ported it back to 2.4.

Today this article wants to talk about two things:

  1. Why are people still using Cocos 2.x when Cocos 4.0 is already out?
  2. What are the differences when porting a 3.x project to 2.x?

The 2.x version of Collection 1.0 can be obtained at the end of the article. Feel free to go check it out.

1. Let's First Talk About the "Heart-Wrenching" Question

Why are people still using Cocos 2.x when Cocos 4.0 is already out?

1. The cost of migrating old projects is too high

This is the main reason. Many companies' projects:

Upgrading from 2.x to 3.x/4.x is not simply modifying a few lines of code.

For example:

2.x 3.x+
cc.Class ES6 Class
cc.Node API changes significantly
2D architecture 3D architecture
Global cc Modular imports

After upgrading many projects:

It could take months of development time. For projects that are already making money:

Refactoring with no revenue gain is usually not approved by the boss.

2. 2D projects are already sufficient with 2.x

Many card games, slot machines, fishing games, and match-3 games don't need 3D capabilities.

2.4 is already enough to meet their needs.

Many of your projects (slot machines, scratch cards, UI-based games, etc.) can actually be fully developed using 2.4.x.

So many companies think:

If it makes money, don't touch it.

3. The 2.x ecosystem is very mature

Currently in China, many:

Are still based on 2.4.x.

If you often browse the asset store, you'll know that more than half of the plugins and source code are still for 2.x.

2. What Are the Differences When Porting a 3.x Project to 2.x?

Alright, now that we've talked about the "why", let's talk about the "how".

1. Comparison

First, let's put the two engines side by side. This isn't a version upgrade; it's two different engines.

Dimension Cocos 2.x Cocos 3.x
Scene file .fire .scene
Script syntax Global cc.xxx + @ccclass + export default import { ... } from 'cc' + @ccclass('Name')
Node transformation node.convertToNodeSpaceAR() Moved to UITransform component
Coordinates Vec2 Must use Vec3
Color/Opacity node.color / node.opacity Split into Sprite.color / UIOpacity

At the code level, the most intuitive comparison:

2.x:

3.x:

2. Shader Section

Although the .effect file name is the same, and the YAML framework looks similar, almost every line inside needs to be changed. It's essentially a rewrite.

First, the entry point syntax:

2.x:

3.x:

Second, the include paths all changed:

2.x:

3.x:

Finally, the batching strategy:

3.x's Sprite batching is much stricter than 2.x: modifying uniform per-node directly breaks batching.

For example:

My puzzle piece rounded-corner shader (round.effect) in 3.x had to smuggle each piece's position/index through the a_color channel, whereas in 2.x you just set uniform and it's done.

3. 3D Section

Since Collection 1.0 includes a 3D puzzle model game, to keep the collection complete, I also tried porting it.

Puzzle model game

But the result was very disheartening, and I had to give up:

Where's my paper airplane?

So the 2.x version of Collection 1.0 does not include the puzzle model game.

3. So, Who Is This 2.x Collection Suitable For?

Let's be direct:

Suitable for you if:

Not suitable for:

Conclusion

After reading the above, do you now understand why people are still using Cocos 2.x when Cocos 4.0 is already out?

Think about it — Windows is at 11 now, but aren't there still people using Windows 7?

The 2.x version of Collection 1.0 in this article can be obtained by reading the original text. Friends who have already purchased Collection 1.0 can directly choose the Old Customer Repurchase Edition to enjoy a discount.


I am "Billion Programmer", a lead programmer with 8 years of experience in the game industry. In game development, I hope to be able to help you, and through you, help others.

To be honest, I'd like a like and a "wow"! Please share this article with other friends you think might need it. Thank you!

Recommended articles:

Billion Cocos Mini-Game Practical Collection 2.0

Billion Cocos Mini-Game Practical Collection 1.0

The boss said this game is very popular and asked me to copy it, but I can't even figure out how to play it...

This game worth 6.8 billion, don't you want to try it? Arrange it!

My friend said my puzzle game using Mask can't batch...

Who can't make Tetris... huh? Quicksand version?

A very popular puzzle game recently, the boss asked me to make it with Cocos3.8...

The boss said puzzle games are too competitive, asked me to make a 3D version with Cocos...

Dare to challenge recreating the once-popular Cut the Rope game with Cocos3.8?