My Game Module – Tutorial

Module file structure:

Suppose you want to give a new module name to Demo Puzzle instead of My Game, then in all files and folders you need to change the below text.

Where it has MyGame, you have to use DemoPuzzle.

Where it has mygame, you have to use demopuzzle.

Where it has my_game, you have to use demo_puzzle.

Make sure to respect the capital & small letters as it is.

First of all, unzip the module zip file into a folder, you will find below files & folders:

(1) Here you don’t need to modify init.php file, just open package.json file into your preferred code / text editor such as notepad++, sublime text etc.

Here you can change name, description and if you want version number too.

Where it has MyGame, you have to use DemoPuzzle.

In the description, you can put text like Demo Puzzle module for Siberian CMS. It’s only visible while you’re installing the module.

(2) controllers main folder:

Here you will find a file named as ApplicationController.php, Open it in a text / code editor and change the text MyGame to DemoPuzzle.

controllers > Mobile

Now in a Mobile sub folder, you will find a file named as ViewController.php, edit it and change the text MyGame to DemoPuzzle.

(3) Model main folder:

Here you will find MyGame.php file, rename it to DemoPuzzle.php and then edit it and change the text MyGame to DemoPuzzle.

(4) resources main folder:

4.1 design sub folder: resources/design/desktop/flat

4.1.1 layout sub folder: layout/mygame.xml

Here rename file mygame.xml to demopuzzle.xml and edit it and change the text mygame to demopuzzle.

4.1.2 template sub folder: template/mygame/

Here rename folder mygame to demopuzzle and go to sub folder application/edit.phtml file. Edit it and change the text: mygame to demopuzzle & my_game to demo_puzzle.

4.2 translations sub folder: resources/translations/default/my_game.po

Here rename file my_game to demo_puzzle and edit it and change the text: my_game to demo_puzzle, My Game to Demo Puzzle.

(5) features main folder:

features/mygame — Here rename the folder mygame to demopuzzle.

You will find feature.json file and some sub-folders there.

5.1 feature.json

Edit feature.json and change the text: My Game to Demo Puzzle, mygame to demopuzzle, MyGame to DemoPuzzle, mygameicon.png to demopuzzleicon.png

5.2 assets sub-folder:

Go to assets/templates/l1/view.html edit it and change the text mygame-view to demopuzzle-view.

5.3 icons sub folder:

Here you will find mygameicon.png, delete it and put your White Color PNG 512x512px icon there with a file name: demopuzzleicon.png

5.4 js sub folder: Here you will find two sub-folders.

5.4.1 js/controllers sub folder

Here rename mygame.js to demopuzzle.js and edit it and change the text MyGame to DemoPuzzle. Change the default link from https://example.com to your game link.

5.4.2 js/factory sub folder

Here rename mygame.js to demopuzzle.js and edit it and change the text: MyGame to DemoPuzzle and mygame to demopuzzle.

After that, open your main folder and zip the all files & folders. Make sure while opening your zip file it should directly display the main four folders, package.json & init.php. It means main files & folders shouldn’t be under any top folder.

That’s it.