How to port Cocos2d-x game to Axmol game engine

How to port Cocos2d-x game to Axmol game engine

Cocos2d-x is an open-source game development engine that supports multiple platforms, including iOS, Android. and now they have stopped giving future updates.

You might wonder what happens for cocos2dx projects.there no issue if you are not giving updates for the game.

If you want game engine updates and issue fixes. We have found a fork of cocos2dx v-4 with the new name Axmol Game Engine here we have developer support. And regular Bug fixes.the major purpose.

  • ●  C++ 17/20
  • ●  Focuses on native game dev (easy to use, fast deployment, intuitive)
  • ●  Bugfixes ASAP However, developers may wish to use other game engines for their projects. If you’re one of those developers who have cocos2dx projects you might wonder how to port Cocos2d-x to Axmol. We have done porting of our projects from cocos2dx-3.17.2 to axmol engine. Here’s a step-by-step guide to help you port Cocos2d-x to Axmol Game Engine: Step 1: Understand Axmol Game Engine Before you start the porting process, it’s essential to understand Axmol Game Engine. Axmol is a C++-based game engine that uses OpenGL for rendering. It is designed to be cross-platform and supports Windows, macOS, Linux, Android, and iOS. Step 2: Prepare the Axmol project The first step in porting Cocos2d-x to Axmol is to prepare the Axmol project. Create a new Axmol project. Creating project in axmol engine is almost similar to cocos2dx
    Clone axmol engine from
  1. Enter Axmol root directory
  2. Run python, restart the console after it has finished for environment variables to take effect

Creating A New Project

Using a console window, the command to generate a new project is as follows:

axmol new -p YOUR.UNIQUE.ID -d PROJECT_PATH -l [cpp|lua]

and then copy the following files from the Cocos2d-x project to the Axmol project:

  1. Classes directory
  2. Resources directory

3. directory -> don’t replace the whole directory u need

       add dependencies in gradle files and modify manifest file

and activity files and icons as well
4. proj.ios_mac directory -> here u just add the files which ever

       required into new axmol project

Step 3: Building in xcode project

After copying the necessary files to the Axmol project, it’s time to modify the project files. But to modify the files you may need .xocdeproj for that u need to build based which device or simulator you will be working

=> The axmol engine building project will be using cmake.

Ensure xcode12+ & cmake3.21+ are installed, install cmake command line support: sudo “/Applications/” –install

Generate the relevant xcode project using one of the following commands:

  • ●  for ios arm64: cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=$AX_ROOT/cmake/ios.toolchain.cmake -DPLATFORM=OS64
  • ●  for ios armv7,arm64 combined: cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=$AX_ROOT/cmake/ios.toolchain.cmake -DPLATFORM=OS
  • ●  for ios simulator x86_64: cmake -S . -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=$AX_ROOT/cmake/ios.toolchain.cmake -DPLATFORM=SIMULATOR64 After cmake finishes generating, you can open the xcode project at build folder

Step 4: Modify the project files

After copying the necessary files to the Axmol project, it’s time to modify the project files to work with Axmol. Here are the changes you need to make:

  1. Replace all the #include <cocos2d.h> statements with #include “axmol.h”.
  2. Modify the main function to create an AxmolGame instance instead of a cocos2d::Application instance.
  3. Replace all instances of “cocos2d::” with “axmol::”.
  4. Replace CC with AX example CC_CALLBACK_0 to AX_CALLBACK_0 , CCLOG and so on..

Step 4: Modify the resource loading code

The next step is to modify the resource loading code to work with Axmol. In Cocos2d-x, you can load resources using the cocos2d namespace cocos2d::Sprite::create function. In Axmol, you need to use the axmol::Sprite::create function instead.

And whenever you add the new class or resource file in the resources folder u may need to rebuild xcode project as given in step 3. New class file you have to add in cmakelist file. if you miss the build u cant use the resource that you are Added to.

Once you’ve completed all the steps above, you should be able to run your Cocos2d-x game using Axmol Game Engine. Keep in mind that some features in Cocos2d-x may not be available in Axmol, so you may need to modify your code accordingly.

In conclusion, porting Cocos2d-x to Axmol Game Engine is not a complicated process. With some basic knowledge of C++, and game development, you can easily modify your Cocos2d-x project to work with Axmol. By following the steps outlined in this guide, you should be able to get your game up and running on Axmol in no time.

Leave a Reply

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