This is the most powerful game engine you didn’t know about.
If you decided to start making games for Yandex Games, but Unity and other engines do not suit you – builds weigh a lot, long downloads and other problems – then this article is for you.
Contents
Why not unity?
I started on unity and worked on it for several years. Then switched to unreal engine 4/5. But it so happened that I got into html5 games, and unity in this regard, to put it mildly, not very well. In addition, it has its drawbacks. In the best practices for Unity articles, they often write: it’s not yuzai, it’s slow, and write your own implementation, etc. In addition, Unity has a closed source code, which also gives certain limitations.
Other engines I use do not suffer from such problems. Of course, the choice of engine depends on your needs and preferences. Personally, I decided on two engines for developing HTML5 games: Defold for 2D, and Cocos Creator for 3D and 2D games. I like the community in defold, it’s very cool, the images are small, which is very important for browser games, and for scripts they use a great Lua scripting language. If there are difficult tasks, you can rewrite them on the plus side. There is still a lot of good in defold, but more on that another time. And you will learn about coconut in the course of the article.
What kind of coconut?
Most have not heard of Cocos Creator, and some associate with Cocos2d-x. So, Cocos2d‑x is a framework that stopped being updated in 2019. Cocos Creator is currently relevant. But the base layer of Cocos Creator evolved from Cocos2d-x.
From the official Cocos website:
Cocos Creator is a free, cross-platform, open-source game development tool based on scripts, components, and data, with content creation at its heart. With an easy-to-use content creation workflow and a powerful set of developer tools, developers can easily create their own games with Cocos Creator’s deep support for all major platforms, allowing you to quickly publish games to the Web, mobile phones, and various mini-game platforms. For web platforms and mini-games, a pure JavaScript engine is used for better performance and a smaller package size. On other mobile platforms, the underlying framework is implemented in C++ for greater runtime efficiency.
In short, it’s like unity, only from the Chinese, free and open source, cross-platform, for 2D and 3D games.
Who uses it anyway?
Ubisoft, Gameloft, Square Enix, FunPlus, Tencent and others.
And what games are made on it?
Brain Out by Focus Apps: Over 100 million installs on Google Play.
Top War: Battle Game by Topwar Studio: Over 50 million installs on Google Play.
Idle Heroes by DHGAMES: Over 10 million installs on Google Play.
Idle Mafia by FunPlus: Over 10 million installs on Google Play.
SSSnaker by Habby (published by Archero): Over 1 million installs on Google Play.
Minimal Dungeon RPG by CapPlay: Over 1 million installs on Google Play.
Note that this data is at the time of writing and the number of installations may increase over time.
Cocos Creator is also popular for developing browser games, especially on the WeChat platforms (there are more than half of the games on Cocos Creator) and Facebook (the Meta organization, as well as its Instagram and Facebook products, are recognized as extremist and banned in the Russian Federation).
So why Cocos?
There are several reasons why I preferred Cocos Creator over other engines:
-
Familiar interface. Cocos Creator provides an editor with familiar windows such as scene, resources, inspector, hierarchy, etc., which makes it easier to work with, especially if you already have experience with other engines like Unity.
-
Flexibility. Cocos Creator allows you to cut out the engine modules in the image that you don’t need. This makes it possible to create optimized and compact builds.
-
Development speed. Cocos Creator is in active development, and the developers regularly release new features and updates. For example, there is already experimental support for WebGPU, which allows you to use modern technologies for improving performance.
-
Open source code. Cocos Creator is an open-source project that allows you to make your own changes and additions to the engine.
Pitfalls
However, there are a few drawbacks to be aware of:
-
Popularity outside of China. Cocos Creator is still more popular in China, which means less educational content available in English and Russian. This can be difficult for novice developers, and support may be limited outside of the Chinese community (I’ve started to fix this).
-
Not much work. Unlike popular engines like Unity, there may be fewer jobs for Cocos Creator developers. This may require additional efforts to find a job or build your own team.
However, if you are willing to deal with these drawbacks, Cocos Creator can be a great choice for HTML5 game development.
What’s under the hood?
Starting with version cocos creator 3.6, the engine can be called dual-core. That is, a c++ core and a js/ts core. And different platforms use their own kernel. Yes, this approach is not common in gamedev, because it is extremely expensive. For this, it is necessary that there are no “strong” differences between the cores, because one core will have a pig, and the other will have a creeper (who understood – he understood).
Editor interface
Almost like in unity. Everything is standard: the scene window, assets, inspector, hierarchy, etc. If you have experience with other engines, then there will be no problems with the editor. But it will be unusual for those who used Unity or Unreal, because many tools will be missing. For example, at the time of writing, there is no brush for drawing objects with terrain. And you have to arrange everything by hand. But I’ve already implemented a couple of tools for automatic placement and a similar terrain brush (TerrainWorldElementGenerator).
Typescript
TypeScript is a programming language developed and maintained by Microsoft that is a superset of the JavaScript language. It adds static typing to JavaScript, allowing developers to define data types for variables, functions, objects, and other code elements. TypeScript compiles to plain JavaScript, so it can be run in any environment that supports JavaScript.
About 72% of programmers on Stack Overflow like Ts. Ts is still an open-source project.
The scripting engine uses Typescript. Javascript has long been deprecated, only occasionally for plugins.
I had never used Ts before Cocos Creator, but I personally liked it. What I liked about Ts is the combination of types (in some cases quite a useful possibility) and working with types in general. And many other possibilities of the language. If you used unity, then quickly master this language.
For Ts I use vs code with plugins. For some, this will be a plus, because you don’t need to install tens of gigs to write code (hello, normal visual studio) or a lot of RAM that consumes ide from jetbrains.
Physics
Let’s start with 3D physics. Cocos Creator supports 4 physics engines (what, it was possible?):
-
Bullet(default): default physics engine, asm.js/wasm Bullet version. Physics engine with collision detection and physics simulation.
-
Built-in: built-in physics engine, lightweight collision detection engine only.
-
Cannon.js: Physics engine with collision detection and physics simulation.
-
PhysX: A game physics engine developed by NVIDIA. Physics engine with collision detection and physics simulation.
DO NOT USE BULLET FOR RACING
When they made a racing game, they did not know about the nuances of bullet. And so, in the middle of development, it was noticed that sometimes the car could fall or push off the ground when driving or falling at high speed. And this problem was not mine, but the problem of the physical engine, because in certain collisions there will be unpredictable behavior and a lot of smart words, why this happens…
2d physics – everything is easy here, there is Box2d and built-in (for simple games). There are also different compounds for both 2d and 3d.
Cocos Creator 3.8 will have a character controller.
For trimming the engine
In Cocos Creator it is called Feature Cropping. You simply uncheck the modules you don’t need, and voila — you’ve got a smaller build.
An empty project with all modules disabled weighs 305 KB.
With modules for a 2d game with physics (Box2d), an empty project weighs ~600 KB, with a normal set of modules for a 3d game with physics (Bullet), an empty project weighs ~1250 kb.
The weight is written for the zip build. Cocos Creator version 3.7.3.
Development process
Development for the Internet is just a fairy tale (after Unity). How the process works:
You write the code – Ctrt+S – went to Cocos – went to the browser – and the game is already running.
Minimum delays. And the technology does not turn into waiting and looking at the progress bar (hello, unity).
Support for integration with third-party services
There is integration with HUAWEI App Gallery Connect and HMS Core. Which is very useful, because AppGallery is also a popular site (hello, HUAWEI smartphones). But it must be understood that there will not be many countries from the first shooting range.
And there will be no problems with the sdk for browsers, because Ts is used. And if you use services like gamepush, it will be very easy and fast.
Is it possible to make an online game?
Yes, there is colyseus sdk (free) for multiplayer. You may have encountered it in other engines. The server part is also written in Ts. Colyseus is also open-source.
What about ECS?
If you’ve worked with ecs in unity, you’ve probably heard of LeoEcs. So, leopotam (the developer of LeoEcs) made a port for Ts (of course, it also works under cocos creator), but at the time of writing the article, to get LeoEcs, you need to be a sponsor on boosty.
Different realities
There is VR, AR and WebXR.
Features of Cocos Creator:
Result
Cocos Creator is a good alternative to unity. If you use coconut, you will already have advantages over games on unity and other web engines. But the main thing is to make games in which the player will have a good time.
Link:
Cocos Creator.
My band is Cocos Creator, there you will find a lot of useful things.