It’s the most powerful game engine you didn’t know about

If you decide 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.

Why not unity?

I started with unity and worked on it for several years. Then I 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, is not very good. In addition, it has its drawbacks. Articles on best practices for Unity often write: don’t use it, it’s slow, write your own implementation, etc. In addition, Unity is closed source, which also gives certain restrictions.

Other engines that 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 defold’s community, it’s very cool, the builds are small, which is very important for browser games, the scripts use the wonderful Lua scripting language. If there are difficult tasks, you can rewrite on the plus side. defold has a lot more good stuff, but more on that another time. And you will learn about coconut in the course of the article.

What else is a coconut?

Most have not heard of Cocos Creator, and some have associations with Cocos2d-x. So, Cocos2d‑x is a framework that stopped being updated in 2019. Now Cocos Creator is up to date. But the Cocos Creator base layer evolved from Cocos2d-x.

From the official website of Cocos:

Cocos Creator is a free and open source cross-platform game development tool based on scripts, components and data, with content creation at its core. 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 games to be quickly published to the Web, mobile phones, and various minigame 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 even uses it?

Ubisoft, Gameloft, Square Enix, FunPlus, Tencent and more.

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 (Publisher of Archero): Over 1 million installs on Google Play.

Minimal Dungeon RPG by CapPlay: Over 1 million installs on Google Play.

Please note that this data is at the time of writing and the number of installs 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 exactly Cocos?

There are several reasons why I preferred Cocos Creator to other engines:

  1. Familiar interface. Cocos Creator provides an editor with familiar windows such as scene, resources, inspector, hierarchy, etc. making it easy to work with, especially if you already have experience with other engines like Unity.

  1. Flexibility. Cocos Creator allows you to cut engine modules in your build that you don’t need. This makes it possible to create optimized and compact builds.

  1. Development speed. Cocos Creator is actively developed 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 to improve performance.

  1. Open source. Cocos Creator is an open-source project, which allows you to make your own changes and additions to the engine.

Underwater rocks

However, there are a few drawbacks to be aware of:

  1. Popularity outside of China. Cocos Creator is currently more popular in China, which means less educational content available in English and Russian. This can be a hassle for beginner developers, and support may be limited outside of the Chinese community (I’ve started fixing this).

  1. Not much work. Unlike popular engines like Unity, there may be fewer job openings for developers on Cocos Creator. This may require additional efforts in finding a job or creating your own team.

However, if you are willing to deal with these shortcomings, Cocos Creator can be a great choice for developing your HTML5 games.

What’s under the hood?

Since version cocos creator 3.6, the engine can be called “dual-core”. That is, there is a core in c ++ and a core in js / ts. And for different platforms, their kernel is used. Yes, this approach is not common in gamedev, because it is extremely expensive. To do this, it is necessary that there are no “strong” differences between the cores, otherwise there will be a pig on one core, and a creeper on the other (those who understand, understand).

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 for those who have been sitting on unity or unreal, it will be unusual, because many tools will be missed. For example, at the time of writing, there is no brush for drawing objects on the terrain. And you have to do everything by hand. But I have already implemented a couple of tools for automatic placement and a kind of brush for the landscape (TerrainWorldElementGenerator).

Cocos Creator Interface

Cocos Creator Interface

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.

Ts is loved by about 72% of programmers on Stack Overflow. Ts is another open-source project.

The scripting engine uses Typescript. Javascript hasn’t been used for a long time, only occasionally for plugins.

I had never used Ts before Cocos Creator, but I personally liked it. What I liked about Ts was the way of combining types (quite a useful feature in some cases) and working with types in general. And many other features of the language. If you have used unity, then you will quickly get used to this language.

For Ts I use vs code with plugins. For some, this will be a plus, since you do not need to install dozens of gigs to write code (hello, ordinary visual studio) or the RAM-consuming ide from jetbrains.

Physics

Let’s start with 3D physics. Cocos Creator supports 4 physics engines (what if it was possible?):

  • Bullet(default): default physics engine, asm.js/wasm version of Bullet. Physics engine with collision detection and physics simulation.

  • built-in: Embedded physics engine, light engine just for collision detection.

  • Cannon.js: Physics engine with collision detection and physics simulation.

  • PhysX: Game physics engine developed by NVIDIA. Physics engine with collision detection and physics simulation.

What each physics engine supports.

What each physics engine supports.

DO NOT USE BULLET FOR RACING GAME

When they made a racing game, they didn’t know about the nuances of bullet. And in the middle of development, it was noticed that sometimes the car could fall through or push off the ground when it was driving or falling at high speed. And this was not my problem, but the physics engine, because with certain collisions there will be unpredictable behavior and a lot of buzzwords why this happens …

2d physics – everything is easy here, there is Box2d and built-in (for simple games). There are also various connections for both 2d and 3d.

Cocos Creator 3.8 will have a character controller.

About trimming the engine

In Cocos Creator it’s called feature cropping. You just uncheck the modules you don’t need, and voila – your build has become smaller.

An empty project with all modules disabled weighs 305 KB.

With modules for a 2D physics game (Box2d) an empty project weighs ~600 KB, with a normal set of modules for a 3D physics game (Bullet) an empty project weighs ~1250 KB.

The weight is written for the build in zip. Cocos Creator version 3.7.3.

Development process

Development for the web is just a fairy tale (after Unity). How the process goes:

You write the code – Ctrt + S – went to Cocos – went to the browser – and the game is already starting.

Minimum delay. And development 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, since AppGallery is also a popular store (hello, smartphones from HUAWEI). But we must understand that there will not be many countries from the first tier.

And there will be no problems with the sdk for browsers, since Ts is used. And if you use services like gamepush, it will be very easy and fast.

Can you make an online game?

Yes, there is colyseus sdk (free) for multiplayer. You may have come across 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 (developer of LeoEcs) made a port for Ts (of course, it also works under cocos creator), but at the time of writing, to get LeoEcs, you need to be a sponsor on boosty.

Various realities

VR, AR and WebXR are present.

Features of Cocos Creator:

Outcome

Cocos Creator is a good alternative to unity. If you use coconut, then you will already have advantages over games on unity and other engines under the web. But the main thing is to make games in which the player will have a good time.

Links:

Cocos Creator.

My group on Cocos Creator, there you will find a lot of useful information.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *