First, create a new CocosCreator project. Select Cocos Creator Dashboard New Project > Empty Project and create a new project.
Now you add GameAnvil connectors to your created projects. GameAnvil connectors can be downloaded from here. Unzip the downloaded file and create a folder under assets. At this time click on No when the following notification appears.
The GameAnvil connector uses protobufjs. Therefore, if the GameAnvil connector is included in a project, the following error will occur.
protobufjs needs to be included in a project using the install feature of Node.js. Enter the following code in the VSCode terminal to create the package.json file.
npm init
When you enter the above code, the package.json file creation process starts and receives the package name. At this time, simply press Enter to use the project name as the default value. The values you receive afterwards also use the default value when you press Enter. See here for more information.
The default package.json file contains the following:
{
"name": "newproject",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
When the package.json file is created, enter the following code in the terminal to install protobufjs.
npm i protobufjs --save
When the installation is complete, the following folder will be created in the project folder.
gameanvil_connector will be added in the dependencies of the package.json file as well.
{
"name": "newproject",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"protobufjs": "^6.10.2"
}
}
core-js and regenerator-runtime need to be installed to support older versions of browsers such as Internet Explorer.
npm i core-js regenerator-runtime