--- sidebar_position: 1 --- # Game Configuration While the core logic is responsible for calculations and maintaining the game state, it's the client's responsibility to define all game-specific information. Let’s go step-by-step to define these elements. ## Slot Items Each game features specific slot items displayed on the reel panel. By default, the Slot Core includes only two items: **Wild** and **Scatter**. For `Roma Legacy`, there are 8 slot items total, including **Wild**. ![Symbols](./img/symbols.png) To define the 7 additional items for this game, create the following script: ```jsx title="assets/game-assets/scripts/slotty-settings/slotty-item.js" var SlottyItem = p4fslot.require('slotty-item'); var Enum = p4fslot.require('extendable-enum'); Enum.InitEnum(SlottyItem, [ 'Pic1', 'Pic2', 'Pic3', 'Pic4', 'Pic5', 'Pic6', 'Pic7', 'Bonus' ]); module.exports = SlottyItem; ``` **Note**: Item names are defined using the texture asset names, not the symbol names received from the server response. |Asset's name | Server Response | |-------------|-----------------| | Pic1 | PIC1 | | Pic2 | PIC2 | | Pic3 | PIC3 | | Pic4 | PIC4 | | Pic5 | PIC5 | | Pic6 | PIC6 | | Pic7 | PIC7 | | Bonus | BONUS | For example, if the server returns a symbol named **BONUS**, the game should display the **Bonus** asset. To establish this mapping, use the following configuration script: ```jsx title="assets/game-assets/scripts/configs/extend-hyper-gaming-config.js" var HyperGamingConfig = require('hyper-gaming-config'); var SlottyItem = require('slotty-item'); HyperGamingConfig.itemMapper['BONUS'] = SlottyItem.Bonus; HyperGamingConfig.itemMapper['PIC1'] = SlottyItem.Pic1; HyperGamingConfig.itemMapper['PIC2'] = SlottyItem.Pic2; HyperGamingConfig.itemMapper['PIC3'] = SlottyItem.Pic3; HyperGamingConfig.itemMapper['PIC4'] = SlottyItem.Pic4; HyperGamingConfig.itemMapper['PIC5'] = SlottyItem.Pic5; HyperGamingConfig.itemMapper['PIC6'] = SlottyItem.Pic6; HyperGamingConfig.itemMapper['PIC7'] = SlottyItem.Pic7; ``` ## Slot Setting There are two settings that determine the betting method used in the game: - **TypeBetConfig**: this defines the bet calculation method. The available options are: - Way - Line - BetOptions - Dynaways - **TypePayline**: this setting determines which text label is displayed in the game's UI. Each type corresponds to a different label: | Type | Text Message | |---------|----------------| |Way | BET PER WAY | |Line | BET PER LINE | |BaseBet | PLAY MULTIPLIER| Depending on the requirements of your game, you can customize both Payline and BetConfig by adding the following script: ```jsx title="assets/game-assets/scripts/slotty-settings/extend-slotty-setting.js" var BaseSlottySetting = p4fslot.require('slotty-setting'); var SlottyItem = require('slotty-item'); var SlottyParameter = p4fslot.require('slotty-parameter'); BaseSlottySetting.prototype._getDefaultTypePayline = function () { return SlottyParameter.TypePayline.Line; }; BaseSlottySetting.prototype._getDefaultTypeBetConfig = function () { return SlottyParameter.TypeBetConfig.Line; } ``` ## Default Slot Item Pattern When the game is opened, the reel panel should display a **default pattern** that contains no possible win lines. For instance, the following item pattern should not be used, as it contains two win lines: ![Win Pattern](./img/win-pattern.png) To keep the gameplay experience fresh, the displayed pattern should be selected randomly each time. At a minimum, three non-winning patterns should be available. To configure these patterns, add the following method to your **extend-slotty-setting** script: ```jsx title="assets/game-assets/scripts/slotty-settings/extend-slotty-setting.js" BaseSlottySetting.prototype._getPatternNotWin = function () { return [ [SlottyItem.Pic5, SlottyItem.Pic3, SlottyItem.Pic5, SlottyItem.Pic1, SlottyItem.Pic5, SlottyItem.Bonus, SlottyItem.Pic6, SlottyItem.Pic5, SlottyItem.Pic1, SlottyItem.Pic5, SlottyItem.Pic2, SlottyItem.Pic6, SlottyItem.Pic2, SlottyItem.Pic1, SlottyItem.Pic2 ], [SlottyItem.Pic4, SlottyItem.Pic7, SlottyItem.Pic2, SlottyItem.Pic5, SlottyItem.Pic7, SlottyItem.Pic4, SlottyItem.Pic7, SlottyItem.Pic6, SlottyItem.Pic5, SlottyItem.Pic7, SlottyItem.Pic7, SlottyItem.Pic3, SlottyItem.Bonus, SlottyItem.Pic2, SlottyItem.Pic3 ], [SlottyItem.Pic1, SlottyItem.Pic2, SlottyItem.Pic3, SlottyItem.Pic7, SlottyItem.Pic3, SlottyItem.Pic2, SlottyItem.Pic7, SlottyItem.Pic4, SlottyItem.Pic3, SlottyItem.Pic2, SlottyItem.Pic1, SlottyItem.Pic7, SlottyItem.Pic4, SlottyItem.Pic3, SlottyItem.Bonus ] ]; }; ``` The results of those 3 patterns are shown below: | Pattern 1 | Pattern 2 | Pattern 3 | |---------------------------------|---------------------------------|---------------------------------| |![Pattern 1](./img/pattern-1.png)|![Pattern 2](./img/pattern-2.png)|![Pattern 3](./img/pattern-3.png)| ## Hyper Gaming Integration The Slot Core supports both SmartFox and Hyper Gaming connections. For Hyper Gaming, we integrate specific modules using the DIContainer. To connect and interact with the Hyper Gaming server, we need to register two key modules: - **hyper-gaming-config**: manages the connection configuration for the Hyper Gaming server. - **hyper-gaming-server-handler**: handles request and response data for game-server communication. To register these, add the `_registerInjection` function in `extend-slotty-setting.js`: ```jsx title="assets/game-assets/scripts/slotty-settings/extend-slotty-setting.js" var DIContainer = p4fcore.require('di-container'); BaseSlottySetting.prototype._registerInjection = function () { DIContainer.Register('serverConfig', require('hyper-gaming-config')); DIContainer.Register('serverHandler', p4fslot.require('hyper-gaming-server-handler')); }; ``` In addition to server modules, all Hyper Gaming projects should initialize the following handlers for sound, hotkey and UI interaction. In the same `extend-slotty-setting.js`, add this function: ```jsx title="assets/game-assets/scripts/slotty-settings/extend-slotty-setting.js" var HyperSoundHandler = require('sound-handler'); var UISoundHandler = require('ui-sound-handler'); var HyperHotkeyHandler = require('hyper-hotkey-handler'); var HyperNotificationHandler = require('hyper-notification-handler'); BaseSlottySetting.prototype._initializeParameter = function () { new UISoundHandler(); new HyperSoundHandler(); new HyperHotkeyHandler(); new HyperNotificationHandler(); }; ```