# Start a game ## View Game spec 取得遊戲名稱以及初步了解遊戲玩法 >路徑位置 Docs/GameSpecs/ ## Add game to server 1. Get the game id from variable NAME of <font color="#660E7A">***gameId***</font>Constants.java ```java= static final String NAME = "GoGoMonsters"; ``` 2. Add game name translation in i18n files(目前支持三種語言: 英文, 簡中, 繁中) - Server/etc/i18n/strings_en.properties ``` game.name.gogomonsters = Go Go Monsters ``` - Server/etc/i18n/strings_zh-Hans.properties ``` game.name.gogomonsters = 怪兽大作战 ``` - Server/etc/i18n/strings_zh-Hant.properties ``` game.name.gogomonsters = 怪獸大作戰 ``` 3. Add game sql commands - Get bet set from <font color="#660E7A">***gameId***</font>Constants.java ```java= static final int UNIT_BET = 88; ``` | BetSet | UNIT BET or LINES | | -------- | -------- | | SET1 | 1 ~ 10 | | SET2 | 11 ~ 20 | | SET3 | 21 ~ 87 | | SET4 | > 87 | - Sql commands ```sql= INSERT INTO Games (name, enabled, fixedSelections, localizedKey, lockVersion, mathClass, minimumBuildNumber, minimumLevel, progressiveEnabled, sequence, newGame, popular, socialEnabled, realMoneyEnabled, betSetName) VALUES ('GoGoMonsters', 1, 1, 'game.name.gogomonsters', 0, 'com.boqugames.slotspalace.math.gogomonsters.GoGoMonstersMath', 770, 0, 1, 160, 1, 0, 1, 1, 'SET4'); INSERT INTO GameVersions (comingSoon, gameVersion, iconFile, maximumBuildNumber, minimumBuildNumber, packageFile, name, lockVersion) VALUES (0, 1, 'GoGoMonstersIcon.zip', 999, 770, 'GoGoMonstersPackage.zip', 'GoGoMonsters', 0); INSERT INTO Games_GameVersions (Game_name, gameVersions_gameVersionId) SELECT 'GoGoMonsters' as Game_name, gameVersionId as gameVersions_gameVersionId FROM GameVersions gv WHERE gv.name = 'GoGoMonsters' and gv.gameVersion = 1; UPDATE GameVersions SET packageHDSHA256 = null, packageSDSHA256 = null, packageHDPVRTCSHA256 = null, packageSDPVRTCSHA256 = null WHERE name = 'GoGoMonsters'; ``` - Hibernate data ```java= Game gogomonsters = new Game(new GoGoMonstersMath().getMathName(), GoGoMonstersMath.class.getName(), 0, 330, 179, "game.name.gogomonsters", true, true, true, true, false, true, true, "SET4", RMPGameListGame.GAME_TYPE_SLOTS); gogomonsters.addGameVersion(new GameVersion("GoGoMonstersIcon.zip", "GoGoMonstersPackage.zip", 1, 330, 999, false)); saveList.add(gogomonsters); ``` 4. Game icons on our web site: https://www-test.kaga88.com/ 支持三種不同的語言, 各六種形狀. :::info circular_<font color="#660E7A">***gameId***</font>.png circular_framed_<font color="#660E7A">***gameId***</font>.png oval_framed_<font color="#660E7A">***gameId***</font>.png oval_<font color="#660E7A">***gameId***</font>.png rectangular_<font color="#660E7A">***gameId***</font>.png square_<font color="#660E7A">***gameId***</font>.png ::: 原始圖檔路徑: spassets/RMPIcons/<font color="#660E7A">***gameId***</font>/ 存放目的路徑: slotspalace/Server/etc/war/image/gameIcons/ ## Client APP ### Create game class stubs 1. Create game folder in Client/Classes/Games/<font color="#660E7A">***gameId***</font> 2. Create c++/header files :::info <font color="#660E7A">***gameId***</font>GameFactory.cpp(.h) <font color="#660E7A">***gameId***</font>Icon.cpp(.h) <font color="#660E7A">***gameId***</font>Background.cpp(.h) <font color="#660E7A">***gameId***</font>Reels.cpp(.h) <font color="#660E7A">***gameId***</font>Symbol.cpp(.h) <font color="#660E7A">***gameId***</font>Paytable.cpp(.h) and others ::: 3. Android project settings 1. Create Android.mk in Client/Classes/Games/<font color="#660E7A">***gameId***</font> 2. in Client/proj.android-studio/app/jni/Android.mk 1. add gamename_static \ ![](https://i.imgur.com/cS7AbSA.png) 2. $(call import-module,gamename) ![](https://i.imgur.com/g0lr0Z3.png) 4. Add game in GameFactoryManager.cpp ```c++= void GameFactoryManager::initializeGameFactories() { initializeGameFactory("Zorro"); } void GameFactoryManager::clearGameFactories() { if(_factoryMap["Zorro"]) _factoryMap["Zorro"]->setGame(nullptr); } ``` ### Using TexturePacker to create spritesheets ##### Content protection Encryption Key: 8c9a97cd3201ecebc59d508271ba6202 ![](https://i.imgur.com/1D2Z0Qm.png) We also set the key in app project: ```c++= AppDelegate::AppDelegate() { ZipUtils::setPvrEncryptionKeyPart(3, 0x71ba6202); // this is split into 4 non-sequential parts on purpose - harder to read from hexdump ZipUtils::setPvrEncryptionKeyPart(1, 0x3201eceb); // this is split into 4 non-sequential parts on purpose - harder to read from hexdump } bool AppDelegate::applicationDidFinishLaunching() { ZipUtils::setPvrEncryptionKeyPart(2, 0xc59d5082); // this is split into 4 non-sequential parts on purpose - harder to read from hexdump ZipUtils::setPvrEncryptionKeyPart(0, 0x8c9a97cd); // this is split into 4 non-sequential parts on purpose - harder to read from hexdump } ``` #### Max Size 2048 * 2048 ##### Scaling variants ![](https://i.imgur.com/TegisL4.png) #### Algorithm and Trim mode Using MaxRect as usual, also can use polygon algorithm and Trim mode: Polygon outline for APP. Web is not allowed. | Algorithm | Trim mode | Usage | -------- | -------- | -------- | |MaxRects | Trim |APP/Web | |Polygon | Polygon Outline | APP | #### Alpha sheet and No Alpha sheet | | Alpha sheet | No Alpha sheet | | -------- | -------- | -------- | | Texture format | PNG-8 | PNG-8 | | Pixel format | RGBA8888 | RGBA888 | ### Add game Audio: (Use Adobe Audition) 1. 用來調整分貝大小, Slow down/Speed up ![](https://i.imgur.com/WVSd4Eb.png) 2. Export the audio ![](https://i.imgur.com/rvveCwj.png) Format: MP3 Audio Sample Type: 44100Hz, 16bit Format Settings :MP3 128kbps Uncheck “Include markers and other metadata" ![](https://i.imgur.com/zfbfkSy.png) 3. Put the mp3 files into folder. App : /slotspalace/Client/Resources/sfx/<font color="#660E7A">***gameId***</font>/ ## Web Client ### Resources #### Icon Copy SD icon to WebClient/com.boqugames.slotspalace/res/images/icons/<font color="#660E7A">***gameId***</font>/ #### Sprite Sheet 需要分成兩種Texture Format: png and webp(Chrome browser supported) **- png**: Copy from app sd resources to WebClient/com.boqugames.slotspalace/res/images/Games/<font color="#660E7A">***gameId***</font>/png/ :::warning 如果之前Layout algorithm有用到Polygon, 要記得要改用MaxRects. ::: **- webp**: Texture packer 產生Webp format sprite sheets to WebClient/com.boqugames.slotspalace/res/images/Games/<font color="#660E7A">***gameId***</font>/webp/ ![](https://i.imgur.com/mNtDqLR.png) ![](https://i.imgur.com/9OMaRRy.png) #### Spine animation files Copy SD resources to WebClient/com.boqugames.slotspalace/res/images/Games/<font color="#660E7A">***gameId***</font>/ #### Font 除了原先的ttf字體檔, Web client還需新增兩種woff, woff2檔. :::info Outline font converter: https://cloudconvert.com/ttf-to-woff https://www.onlinewebfonts.com/woff2-converter ::: #### Logo in Vertical mode Web client直式版本, 在畫面的最上方會擺放遊戲logo 原始圖檔路徑: spassets/RMP_Mobile_PortaitMode_Logo/ 存放目的路徑: WebClient/com.boqugames.slotspalace/res/logo/ #### Obfuscation 1. Add Obfuscation Tag a. Create GAME_SOCIAL_OBFUSCATION_TAG = "<font color="#660E7A">***gameId***</font>"; in <font color="#660E7A">***gameId***</font>Background.js b. GAME_REAL_OBFUSCATION_TAG = "<font color="#660E7A">***gameId***</font>"; in <font color="#660E7A">***gameId***</font>GameFactory.js c. GAME_OBFUSCATION_TAG = "<font color="#660E7A">***gameId***</font>"; in <font color="#660E7A">***gameId***</font>Paytable.js 2. Add "<font color="#660E7A">***gameId***</font>" with lower case in obfuscation_game_list.txt :::info 路徑位置: WebClient/com.boqugames.slotspalace/obfuscation_game_list.txt ::: 3. Add file name in project.json and project_rmp.json :::info 路徑位置: WebClient/com.boqugames.slotspalace/project.json WebClient/com.boqugames.slotspalace/project_rmp.json ::: :::danger class name 存放在project.json/project_rmp.json 裡的檔案順序 "src/Game/factories/WitchAcademyGameFactory.js", "src/Lobby/gamelist/icon/WitchAcademyIcon.js", "src/Game/background/WitchAcademyBackground.js", ...... "src/Game/paytable/WitchAcademyPaytable.js" :::