For the configuration of a tjger-application it is necessary to set some values in the settings file, the menu file and the messages file of HGBase. For the playing relevant configuration there exists an additional XML file.
For a detailed description of the files see in the section Usage of HGBase the chapter Edit the XML files.
The settings file is extended by the entry fileTjger that defines the File for the game configurations and the entry fileProfile that defines where player's profiles are saved. If no profile file is set, no player profiles are stored (the number of player and won games and the total score will be stored anyway).
<set name="fileTjger" value="/xml/tjger_eye.xml" />
<set name="fileProfile" value="tjger_eye.tpf" />
For playing sound files the ids for the sound files (as they are given as parameters for the playAudio-method of the MainFrame-class) and their location must also be defined:
<set name="soundCard" value="/sound/card.wav" />
<set name="soundDice" value="/sound/dice.wav" />
The menu of tjger (MainMenu) offers additional functionality in contrast to the menu of HGBase. For getting use of this functionality the menu file has to be filled with the respective entries.
The menu entry file.next allows starting a new game by taking the current one as base (number of players, players' names). If there is no current game, it does the same like the file.new command. The command file.gameinfo displays a dialog with game information (see The default dialogs):
<item id="file.next" type="action" />
<item id="file.gameinfo" type="action" />
Important entries that are added by tjger are those for zooming. The several entries for the zoom menu are inserted into the menu with the id zoom. This menu also appears as popup-menu of the zooming field in the status bar (see Creating an application):
<menu id="zoom">
<item id="zoom.fitwidth" type="action" />
<item id="zoom.fitheight" type="action" />
<item id="zoom.fitoptimal" type="action" />
<item id="zoom.variable;zoom.75;zoom.100" option="zoom.menu" type="radio" />
<item id="zoom.zoomin" type="action" shortcut="Plus" />
<item id="zoom.zoomout" type="action" shortcut="Minus" />
<item/>
<item id="zoom.fitwindow" option="zoom.fitwindow" type="checkbox" />
</menu>
There is also a default menu command for defining the arrangement of the game material (background, game board, cards, covers, game pieces) and for changing the network port setting:
<item id="settings.parts" type="action" />
<item id="settings.network" type="action" />
The tjger information dialog is displayed by the following command:
<item id="help.tjger" type="action" />
There are default commands for displaying game instructions and game hints (aka tip of the day), see also The default dialogs for that:
<item id="help.instructions" type="action" shortcut="F1"/>
<item id="help.gamehints" type="action"/>
In the settings file you can set the option hideNotShowAgainHintOption to true for not showing the check box that hints shall not be shown automatically.
Switching the sound on and off works - as it was mentioned in Creating an application - with the option nosound. It's possible to take this into the menu as follows:
<item id="settings.nosound" option="nosound" type="checkbox" />
A further option is defining if there shall be a question for saving when closing a game:
<item id="settings.noconfirm" option="noconfirm" type="checkbox" />
To switch recording of a game on and off (see chapter Debug games) the following entry is useful:
<item id="settings.recordgame" option="recordgame" type="checkbox"/>
The tjger framework extends HGBase by some additional messages. Reasons for that are:
The keys of the default messages of HGBase and for tjger are defined exactly. It is recommended to include the default file with messages for tjger (/tjger/messages.xml). Example for English, but probably not complete:
<?xml version="1.0" encoding="ISO-8859-1"?>
<messages>
<include file="/hgb/lib/xml/messages.xml"/>
<language code="lan.en">
<msg code="-10705">Error writing the game state!</msg>
<msg code="-10706">Error reading the game state!</msg>
<msg code="-30216">Could not establish a connection to the server!</msg>
<msg code="-30218">Problems when starting the server!</msg>
<msg code="-30301">Players could not be initialized!</msg>
<msg code="-30303">Could not start the game!</msg>
<msg code="-30305">Error when transferring the game state!</msg>
<msg code="-30307">Error when transferring the player's move!</msg>
<msg code="error.sound">Error when playing sound files! %s</msg>
<msg code="err.onehuman">Only one human player allowed!</msg>
<msg code="err.nohuman">No human player is selected.</msg>
<msg code="err.neednames">All players need a name!</msg>
<msg code="err.samenames">Names of players must not be the same!</msg>
<msg code="err.namewrong">Name has invalid character '%s' !</msg>
<msg code="err.profileexists">Player's profile already exists!</msg>
<msg code="err.nonetwork">Network players are not allowed!</msg>
<msg code="err.networkport">Please enter a valid port (1...65535)!</msg>
<msg code="err.networknoip">Please enter the network address of the server!</msg>
<msg code="err.networkconhost">There exists no connection to the server!</msg>
<msg code="err.networkconclients">Not all network players are connected yet!</msg>
<msg code="err.networknoclients">There isn't any network player available!</msg>
<msg code="err.networksave">Network games cannot be saved!</msg>
<msg code="err.networkclientnot">This action is only allowed for server!</msg>
<msg code="err.netabort">The network connection was terminated!</msg>
<msg code="err.netname">The player's name is already in use!</msg>
<msg code="err.application">On the server there runs the application '%s'!</msg>
<msg code="err.nextgame">A new game was started at the server!</msg>
<msg code="file">Game</msg>
<msg code="file.next">Next game</msg>
<msg code="file.gameinfo">Game information...</msg>
<msg code="file.profiles">Profile management...</msg>
<msg code="view">View</msg>
<msg code="zoom">Zoom</msg>
<msg code="zoom.fitwidth">Fit to width</msg>
<msg code="zoom.fitheight">Fit to height</msg>
<msg code="zoom.fitoptimal">Optimal size</msg>
<msg code="zoom.zoomin">Zoom in</msg>
<msg code="zoom.zoomout">Zoom out</msg>
<msg code="zoom.variable">Variable...</msg>
<msg code="zoom.150">150%</msg>
<msg code="zoom.100">100%</msg>
<msg code="zoom.75">75%</msg>
<msg code="zoom.fitwindow">Fit to window</msg>
<msg code="settings.recordgame">Record new game</msg>
<msg code="settings.parts">Appearance...</msg>
<msg code="settings.network">Network...</msg>
<msg code="settings.noconfirm">No saving confirmation</msg>
<msg code="help.tjger">tjger...</msg>
<msg code="help.gamehints">Game hints...</msg>
<msg code="help.instructions">Game instructions...</msg>
<msg code="dlg.filesave">Do you want to save the game?</msg>
<msg code="dlg.fileclose">Do you want to terminate the game?</msg>
<msg code="dlg.remove">Remove</msg>
<msg code="dlg.newgame">New game</msg>
<msg code="dlg.players">Players</msg>
<msg code="dlg.choosecolor">Choose color</msg>
<msg code="dlg.chooseimage">Choose image</msg>
<msg code="dlg.asktosave">Save settings?</msg>
<msg code="dlg.turnfinished">Turn finished</msg>
<msg code="dlg.roundfinished">Round finished</msg>
<msg code="dlg.gamefinished">Game finished</msg>
<msg code="dlg.currentgame">Current game</msg>
<msg code="dlg.gamestatistics">Game statistics</msg>
<msg code="dlg.highscore">High score</msg>
<msg code="dlg.score">Score</msg>
<msg code="dlg.removescore">Remove score</msg>
<msg code="dlg.removestatistics">Remove statistics</msg>
<msg code="dlg.profileexists">Player's profile already exists</msg>
<msg code="dlg.askprofileoverwrite">There exists already the profile "%s"...</msg>
<msg code="dlg.warnprofileoverwrite">There exist one or more profiles...</msg>
<msg code="dlg.loadgame">Load game</msg>
<msg code="dlg.overwrite">Overwrite</msg>
<msg code="dlg.use">Use it</msg>
<msg code="dlg.all">All</msg>
<msg code="dlg.network">Network</msg>
<msg code="dlg.networkport">Server port:</msg>
<msg code="dlg.networkreset">Reset</msg>
<msg code="dlg.connect">Connect</msg>
<msg code="dlg.stop">Stop</msg>
<msg code="dlg.notshowagain">Do not show hints automatically any more</msg>
<msg code="dlg.debugnextmovetitle">Debug move</msg>
<msg code="dlg.askdebugnextmove">Do you want to debug the next move?</msg>
<msg code="dlg.debugplayer">Player: </msg>
<msg code="dlg.debugmove">Move: </msg>
<msg code="dlg.debuginvalidmove">Invalid move!</msg>
<msg code="type.human">Human</msg>
<msg code="type.computer">Computer</msg>
<msg code="type.network">Network</msg>
<msg code="network.none">No network game</msg>
<msg code="network.server">Set up network server</msg>
<msg code="network.client">Connect with network server</msg>
<msg code="network.waitplayers">Wait for other player(s).</msg>
<msg code="gameinfo.numplayers">Number of players:</msg>
<msg code="status.roundfinished">Round finished</msg>
<msg code="status.gamefinished">Game finished</msg>
<msg code="tooltip.scoreturn">Score of the current turn</msg>
<msg code="tooltip.scoreround">Score of the current round</msg>
<msg code="tooltip.scoregame">Total score</msg>
<msg code="tooltip.gamesplayed">Number of played games</msg>
<msg code="tooltip.gameswon">Number of won games</msg>
<msg code="game.cardset">Cards' set</msg>
<msg code="game.cover">Cover</msg>
<msg code="game.pieceset">Pieces</msg>
<msg code="game.board">Game board</msg>
<msg code="game.background">Background</msg>
<msg code="game.arrangement">Arrangement</msg>
</language>
...
</messages>
The keys for the message entries for game material result by the File for the game configurations. Messages that start with game. is for the default game material.
The configuration file of HGBase stores a lot of more values for a tjger-application, too. These additional configurations are caused by menu settings (see above) or because of saving some settings of the user (e.g. names of players or arrangement of the game material). The names of these settings are defined in class tjger.lib.ConstantValue, see also Library functions.
The file for the game related configuration of tjger (e.g. tjger.xml) has the root node tjger and has some sections. A complete example can be found in section Example application 'Eye of the Tjger'. The first section is for general settings, than there is a section for defining players and the last section is for defining the game material.
The settings are read by the class tjger.game.completed.GameConfig and can be retrieved by methods of this class, too. For some declarations that are made in the configuration file the class tjger.game.completed.PlayerManager is responsible.
These settings are part of the node settings.
<settings>
<players min="2" max="4" onehuman="false" withouthuman="true" order="clockwise"/>
<rules class="mygame.game.MyRules"/>
<gamestate class="mygame.game.MyState" record="game"/>
<newgamedialog class="mygame.gui.MyNewDialog" asktosave="newgame.asktosave"/>
<gamedialogs class="mygame.gui.MyGameDialogs"/>
<infodialogs turn="false" round="true" game="true"/>
<interrupt round="true"/>
<delay round="500" turn="250" move="0"/>
<changed newgame="false" newround="true" newturn="false" aftermove="true"/>
<statistics games="true" scores="false" highscore="10" onlyfirst="true" scrollwhen="5" Lowerscoreisbetter="false"/>
<zoom min="25" max="250"/>
<image welcome="/gfx/mygame.gif"/>
<gamefield width="620" height="400" halign="left" valign="top"/>
<network port="1234" move="network" turn="network" round="network" game="network"/>
<hints path="/html/hints" extension="html" move="" turn="" round="" game="hints.mygame" application="hints.myapplication" />
<advertisements active="true" url="https://example.com/adservice.php?game=mygame&lang=[LANG]" errorpageurl="file:///android_asset/advertisement/defaultadvertisement.html" widthpercent="100" heightpercent="100" productid="no_ads"/>
</settings>
rules: Defines the class that is responsible for the game rules, must extend the class tjger.game.GameRules.gamestate: Defines the class that is responsible for the game state, must implement tjger.game.GameState. If the optional attribute record is set (possible values are game, round or turn) it is possible to debug the game state (see chapter Debug games).newgamedialog: Defines the dialog that is shown when starting a new game. If no one is defined the class tjger.gui.NewGameDialog is used. The attribute asktosave (optional) tells if the user has a checkbox for defining if the current game settings shall be saved or not, see also Allow additional configuration.gamedialogs: Defines a class that extends from tjger.gui.GameDialogs to adapt several dialogs (e.g. at the end of turns, rounds or games) or tabs of dialogs for game information (see also The default dialogs).changed: As saving is done automatically (except the individual values of the game state) it can be defined when the game state is changed. This can be newgame, newround, newturn or aftermove, which have to be set to true.players: Basic settings for players. Define the minimum and maximum number of players. With the attribute onehuman (optional) it's possible to define that only one human player can take part at a game, set the value to true for that. With withouthuman it can be defined if games without any human players are allowed (normally only interesting for testing). The attribute order defines the order of the active players in the game (in contrast to all players as they are display on the new game dialog), possible values are lefttoright, clockwise and counterclockwise.statistics: Defines if statistics shall be stored (optional). If games is set to true then all played and won games are stored. If scores is set to true, every player keeps his scores across several games, although the application is closed. The attribute highscore defines the length of the high score list. With the attribute onlyfirst it's possible to define if only the winner of a game gets an entry in the high score list (true) or all players that have enough scores made (false). The optional attribute scrollwhen allows to define a number of rows where a vertical scrolling starts at the game statistics dialog if this number is exceeded. The optional attribute lowerscoreisbetter allows to define if a lower score means a better rank (true). This attribute affects the high score list and the information dialogs at the end of a turn, a round or the game.zoom: Defines the minimum and maximum zoom. If no zoom is defined it is set to 100%.network: This option is necessary if network games shall be possible. For that a valid network port must be declared. For optimizing the network traffic it's possible to define which reset method of the game state shall be executed. For that the attributes move, turn, round or game are set to local. Otherwise the complete game state is transferred instead of calling the reset method on the clients.image: A welcome image can be defined that is displayed when the application starts.gamefield: The both attributes width and height define the default size of the game field. But the real size of the game field also depends on the game board and the current background. It's always the size used that is defined as the biggest one. With the optional attributes halign and valign the alignment of the game field within the window can be specified. For the horizontal alignment (halign) the values left (default), center and right are valid. For the vertical alignment (valign) the values top (default), middle and bottom are valid.infodialogs: Defines the moments when an information dialog for the current game state shall be displayed. Possible moments are turn, round and game, whereas the respective attribute values must be set to true. The content of these dialogs can be adapted by the class that is defined by the gamedialogs option.interrupt: If the attribute round is set to true the playing cycle stops after every round and must be continued manually by calling the method newRound() of the GameEngine.delay: Defines delays in millisecons between rounds (round), turns (turn) and moves (move). These delays are always before the action (e.g. at the beginning of a new turn) except before the first incidence of this actions in the respective context (i.e. there is no delay before the first turn of a round). A special menu of type gamespeed can be added to the menu that allows changing the game speed and is considered by this delay. There are already default messages available for all menu entries that are created automatically by this menu type.hints: Allows the automatically displaying of game hints (aka "Tip of the day"). The attribute path defines the base location where the files with the tips can be found. The attribute extension defines the file extension. All the other attributes tell when the hint shall appear: At once when the application starts (application), at the start of a new game (game), at the beginning of a round (round), at the beginning of a turn (turn) or before every human move (move). For the attribute value that is set there, a message with the filename (inclusive a possible relative path) must be defined for every language. The files must additionally be numbered serially. For the example settings above there could be a message: <msg code="hints.mygame">en/game</msg> and for that the file /html/hints/en/game0.html.advertisements: Only available for Android applications!active is set to true, the advertisement defined by the attribute url will be displayed after each game. The placeholder [LANG] can be used to access the current language of the app so that advertisements can be displayed in the same language.errorpageurl will be used. This could be a local file, for example (the assets directory can be accessed via file://android_assest/).widthpercent and heightpercent can be used to specify what percentage of the screen is used to display the advertisement.productid can be used to specify the ID of a product for In-App-Purchases. The value must correspond to the ID of the product in the Google Play Console. If a product ID is specified, a “Remove ads” icon is displayed on the main screen (resource ic_remove_ads.png). The icon triggers the purchase process. Once the product has been successfully purchased, the icon is no longer displayed and no more ads are shown.Translated with DeepL.com (free version)
Some of the general settings above can be changed dynamically during a game. This is done by the set-methods of the GameConfig class.
The node players contains some graphical information for the players, the sub-nodes player define different player types.
<players extension="gif" path="/gfx/player" playerimage="player" piececolor="piece">
<player type="type.human" class="tjger.game.HumanPlayer" image="/gfx/player/type.human.gif"/>
<player type="type.computer" class="sample.game.ComputerPlayer"/>
<player type="type.network" class="tjger.game.NetworkPlayer"/>
</players>
extension: File extension for images of player and images for the several players' types.path: Path to the images of the players and players' types.playerimage: Prefix of the images for a player. The images are searched as follows: <path>/<playerimage><0..n>.<extension> , for example: /gfx/player/player1.gif.piececolor: Prefix for the name of the playing pieces that are associated to a player. The pieces depend on the game material that is defined. The colors for the pieces of the players have the format <piececolor><0..n> , e.g. piece0. If no pieces with this color exist, all card sets will be searched for this color name.player: For every type of player the name of the type (as message key) and the implementing class must be defined. The classes must extend tjger.game.GamePlayer (or from HumanPlayer or NetworkPlayer, for details see Classes for the playing cycle). Optional it is possible to set a location for the image of the player type (image), if this attribute is not set the file is searched as follows: <path>/<type>.<extension> , e.g. /gfx/player/type.human.gif.For the different types of game material there are different sections:
backgrounds)boards)pieces)covers)cards)arrangements)parts)colors)For all materials it's possible to define whether they are displayed in the dialog for changing the arrangements or if they are hidden from the user. For that the attribute hidden is set to true or false. Hiding makes sense if only one sort of material exists for a type or e.g. some game boards shall be hidden but some shall be displayed and set active. The developer has access to both the hidden and the visible materials. Note: Hidden materials can never be 'active', that is important for methods of GameConfig: for example hidden boards are returned by the method getBoards() but can never be a return value for getActiveBoard(). The user-defined colors cannot be hidden as this would be senseless.
All materials that contain an image are allowed to specify a shadow. This is done by the attribute shadow that can be set to true (using default values) or by specifying the x and y distance (e.g. 10;10) or by using an additional alpha value as a number between 0 and 1 (e.g. 10;10;0.5). The attribute for the shadow can be added to a single element or on a higher level (e.g. for all cards). Additionally there is the configuration setting drawshadows that determines whether these shadows shall be drawn or not (the proposed menu entry for this configuration is settings.drawshadows).
All materials that contain an image are also allowed to specify a reflection. This is done by the attribute reflection that can be set to true (using default values) or by specifying the vertical gap (e.g. 5) or by using the part of the image as number greater 0 and lower or equal 1 and the alpha value to start the reflection with as a number between 0 and 1 (e.g. 5;0.5;0.5). The attribute can be added to a single element or on a higher level (e.g. for all cards). Additionally there is the configuration setting drawreflection that determines whether these reflections shall be drawn or not (the proposed menu entry for this configuration is settings.drawreflection).
Note for Android applications
In Android, it is possible that individual game materials, sets of game materials, or arrangements must first be purchased via In-App-Purchases. To do this, the attribute productid must be specified for the corresponding game material, set of game materials or arrangement. The value must correspond to the ID of the product in the Google Play Console. Multiple game materials, sets of game materials or arrangements can have the same product ID.
A 🔒 symbol (text resource unpurchased_marker) is then displayed in the selection list next to the game material. When such an element is selected, the purchase process is initiated. If the purchase is completed successfully, the symbol is removed and the game material can be used.
As long as an unpurchased element is selected, no game can be started.
Example:
<backgrounds extension="jpg" path="/gfx/background">
<background name="wood"/>
<background name="carpet" productid="oriental_theme"/>
<background name="stone" productid="medieval_theme"/>
</backgrounds>
<boards extension="jpg" path="/gfx/board">
<board name="plastic"/>
<board name="glass" productid="oriental_theme"/>
<board name="marble" productid="medieval_theme"/>
</boards>
For a background as well an image as a color can be used. For an image it can be defined whether just one image is painted or the image is repeated until the whole game field is filled. For a colored background a default color is defined:
<backgrounds extension="jpg" path="/gfx/background">
<background name="back.green" image="/gfx/background/back.green.jpg" zoom="100"/>
<background name="back.red" repeat="true" hidden="true"/>
<background name="back.red" repeat="true" ignorezoom="true"/>
<background name="back.color" color="40960"/>
<background name="back.white" color="16777215" fixed="true"/>
</backgrounds>
extension: File extension for the background images.path: Directory where the images are searched.background: Defines a background. The name (name) has to be unique and if the background is not hidden there has to be a respective entry in the message file. For images the attribute image is set or no attribute is used. In that case the file is search like <path>/<name>.<extension>, e.g. /gfx/background/back.green.jpg. Optional the attribute repeat is set to true for filling the game field with the image (if the image is too small). With the additional attribute ignorezoom it is possible to define, that the background image will not be scaled if the zoom factor is changed (is only useful if the image is repeated). With the attribute zoom it is possible to set the default scaling for the image of the particular background; this options is not considered if it is a repeating image and ignorezoom is set. For a colored background the attribute color has to be defined. Therefore the hexadecimal code of a color is translated as decimal number, e.g. get the number 40960 for the color code #00A000. With the attribute fixed (and the value true) the user cannot change the color, otherwise it is possible to change it in the dialog for the arrangement of the game material.Game boards are always images. The definition is similar to background images:
<boards extension="jpg" path="/gfx/board" hidden="true">
<board name="board.wood" image="/gfx/board/board.wood.jpg" xpos="20" ypos="20" />
<board name="board.glass" zoom="80"/>
<board name="board.marble" hidden="true"/>
</boards>
extension: File extension for the images of the game boards.path: Path where the images are searched.board: Defines a single game board. The name (name) has to be unique and needs an entry in the message file. Optional the attribute image can be set, otherwise the file <path>/<name>.<extension> is used as image. Additionally an x- and a y-coordinate can be defined for the top left edge of the image. The attribute zoom allows to set the default scaling for the image of the particular game board.For the playing pieces piece-sets are defined. A set is divided into several colors with several pieces for each color. The option orderby defines whether the sorting order is by colors (color), values (value) or there is no sorting (none). An individual sorting is possible by setting the sorter with GameManager.setPartSorter(...).
<pieces extension="gif" path="/gfx/pieces">
<pieceset name="piece.old">
<piece color="piece0" sequence="1" image="/gfx/pieces/piece.old/piece0-1.gif"/>
<piece color="piece0" sequence ="2"/>
<piece color="piece1" sequencestart ="1" sequenceend ="2"/>
<piece color="dice" sequence ="0"/>
</pieceset>
<pieceset name="piece.new" hidden="true">
<piece color="piece0" sequencestart="1" sequenceend="2" value="0"/>
<piece color="piece1" sequencestart="1" sequenceend="2"/>
<piece color="dice" sequence ="0" value="7"/>
</pieceset>
</pieces>
extension: File extension for the images of the playing pieces.path: Path where the images are searched.pieceset: A set needs a unique name (name). If the piece-set is not hidden a message must be defined for that name.piece: Defines a single playing piece for a color or a whole range for a color. The color is defined by the attribute color, whereas color means a more abstract term. For a single piece the attribute sequence is defined which has to be a number. For color range an attribute sequencestart and an attribute sequenceend (both numerical) have to be set. It is possible to define an image with the attribute image, otherwise the image files are searched as follows: <path>/<name>/<color>-<sequence>.<extension> (sequence is the single value of the sequence range between start and end), e.g.: /gfx/pieces/piece.old/dice-0.gif. If the image is defined for a sequence range, all elements get the same image. Additionally to the attribute sequence which has to be unique for every color it is also possible to define a value. If this attribute is not defined the value is the same as the sequence. If desired it is possible to define one value for a sequence range.For the covers of the playing cards only simple images are used. These works as it is described for the game board with the difference that there are no optional attributes for the x- and y-coordinates. The following example should be understandable without any description:
<covers extension="png" path="/gfx/cover">
<cover name="cover.blue" image="/gfx/cover/cover.blue.png"/>
<cover name="cover.red"/>
</covers>
Defining playing cards works similar to the definition of playing pieces. For the playing cards there exist a lot of useful methods like shuffeling or dealing cards or for saving cards into the XML gamestate file (see CardUtil, PartUtil, PlayerCardMap, NetworkUtil and XmlUtil). Typical colors in that case are hearts, spades or diamonds. The option orderby can be used like the same option of the pieces.
<cards extension="gif" path="/gfx/cardset" orderby="color">
<cardset name="cards.normal">
<card color="joker" sequence="1" value="15" image="/gfx/cardset/cards.normal/joker-1.gif"/>
<card color="joker" sequence="2" value="15"/>
<card color="joker" sequence="3" value="15"/>
<card color="hearts" sequence="1" value="14"/>
<card color="hearts" sequencestart="2" sequenceend="13"/>
</cardset>
<cardset name="cards.vector">
<card color="joker" sequencestart="1" sequenceend="3" value="15"/>
<card color="hearts" sequence="1" value="14"/>
<card color="hearts" sequencestart="2" sequenceend="13"/>
</cardset>
</cards>
By default there exists just one type of card set with different char appearance (e.g. modern and classical). For using several types of card set with varying appearances (e.g. modern cards with numbers and classical cards with letters) it is possible to assign a type for every card set. This is done by the attribute type at the cardset entry. The name of the default card set type is defined in ConstantVaule.CONFIG_CARDSET and has not be specified. The syntax is similar to the user-defined sets (see below). By an attribute orderby at a cardset entry it is possible to define the ordering for different types of cardsets that differs from the default behaviour.
<cards extension="gif" path="/gfx/cardset" orderby="color">
<cardset name="cards.normal">
...
</cardset>
<cardset name="cards.vector">
...
</cardset>
<cardset type="cardset.joker" name="joker.normal" orderby="value">
<card color="default" sequencestart="1" sequenceend="3"/>
</cardset>
<cardset type="cardset.joker" name="joker.vector">
<card color="default" sequencestart="1" sequenceend="3"/>
</cardset>
</cards>
For user-defined objects it is possible to define single materials or complete sets. For single materials a type is defined where all objects with the same type belong together and can be selected as alternatives in the dialog for the arrangement of the game materials. For every type there will by a combo box in that dialog. It is also necessary to define the adequate messages in the messages file. The name of the user-defined type may not start with game. as this are default game materials (e.g. game.background, game.board, ...). For single material only images are defined, sets are treated similar to playing pieces or playing cards.
<parts extension="gif" path="/gfx/parts">
<part type="sample.decoration" name="decoration.candle"/>
<part type="sample.decoration" name="decoration.flower"/>
<part type="sample.decoration" name="decoration.none"/>
<partset type="sample.counter" name="counter.normal" orderby="none">
<part color="counter" sequencestart="1" sequenceend="10"/>
</partset>
<partset type="sample.counter" name="counter.modern">
<part color="counter" sequencestart="1" sequenceend="10"/>
</partset>
</parts>
There is a way to let self-implemented classes extend the user-defined objects. These classes have to be extended from the respective base class and has to provide the same constructor. For classes of part (partclass) this is tjger.gui.completed.Part, for partset (setclass) this is tjger.gui.completed.PartSet and for part, that are a member of partset (cvpclass), this is tjger.gui.completed.ColorValuePart. The own classes are defined within separate nodes (extension of the example above):
<parts extension="gif" path="/gfx/parts">
<extend type="sample.decoration" partclass="sample.gui.parts.SamplePart"/>
<extend type="sample.counter" setclass="sample.gui.parts.SamplePartSet" cvpclass="sample.gui.parts.SampleColorValuePart"/>
<part type="sample.decoration" name="decoration.candle"/>
<part type="sample.decoration" name="decoration.flower"/>
<part type="sample.decoration" name="decoration.none"/>
<partset type="sample.counter" name="counter.normal" orderby="none">
<part color="counter" sequencestart="1" sequenceend="10"/>
</partset>
...
</parts>
The colors are just defined by a type and optional a default color (default). If a default color is defined (like the color at backgrounds) than this is the default color of the color chooser dialog, otherwise it's the currently selected color.
<colors>
<color type="sample.colorA" default="40960"/>
<color type="sample.colorB"/>
</colors>
Finally it is possible to define some arrangements for the game materials in advance. Here backgrounds, game boards, etc. are specified that belong together. These arrangements are only useful if the dialog for the arrangement of the game materials is reachable (menu command settings.parts). For the default materials there are own attributes, used-defined objects must be added with sub-nodes. It is not necessary to define all materials for an arrangement.
<arrangements complete="false">
<arrangement name="arrange.standard" background="back.green" board="board.glass" pieceset="piece.old" cover="cover.red.vector" cardset="cards.vector">
<cardset type="cardset.joker" value="joker.normal"/>
<part type="sample.decoration" value="decoration.candle"/>
<partset type="sample.counter" value="counter.modern"/>
<color type="sample.colorA" value="16777215"/>
</arrangement>
<arrangement name="arrange.new" background="back.color" board="board.glass" pieceset="piece.new" cover="cover.blue.vector" cardset="cards.vector"/>
</arrangements>
complete: (optional) Defines if only arrangements are possible that are pre-defined or if a user can change arrangements individual. If complete is set to true, arrangements cannot be changed. In that case all arrangements should define all game materials that are used for the game.arrangement: Every arrangement has a unique name (name) for that a message must be defined, too. Furthermore the single game materials are defined which shall be part of the arrangement. For every default game material an attribute is available (background, board, pieceset, cover, cardset) where a name of a material can be set. It is not necessary to set a value for every material.cardset: If a cardset with special type was defined, it is possible to assign it here to a certain arrangement.part: For every user-defined type it is possible to write an entry whereas the attribute type defines the type and the attribute value the name of the material.partset: For user-defined sets the entries are set similar to single objects.color: For the colors it is possible to add one entry per color type for the user-defined sets.The defined elements (with the exception of the background image and the game board) can be positioned on the game panel in two ways:
GamePanel. The elements must be positioned entirely in Java (see method paintParts(...)).ConfigurableGamePanel (see Configurable Game Panel). The elements are positioned in the configuration file. However, it is also possible to influence this programmatically.The configuration is managed via the gamefieldlayout node. This node supports the following attributes:
* margintop: This defines the upper distance to the edge of the playing field. The specification must be made as a numerical value in pixels. All vertical position specifications take this into account. Example: If 10 is specified as the distance and 15 is specified as the y-position for an element, then the element is positioned 25 pixels from the upper edge of the playing field. The default is 0.
* marginbottom: This defines the lower distance to the edge of the playing field. The specification must be made as a numerical value in pixels. This is only relevant for position specifications using bottom or middle. The default is 0.
* marginleft: This defines the left distance to the edge of the playing field. The specification must be made as a numerical value in pixels. All horizontal position specifications take this into account. Example: If 10 is specified as the distance and the x-position 15 is specified for an element, then the element is positioned 25 pixels from the left edge of the playing field. The default is 0.
* marginright: This defines the right-hand distance to the edge of the playing field. The specification must be made as a numerical value in pixels. This is only relevant for position specifications using right or center. The default is 0.
Areas (areas) can be defined in a layout. An area can be used for the positioning of elements.
An area (area) supports the following attributes:
name: The name of the area.xpos: The x-position of the area on the playing field (taking into account the left margin from the edge of the playing field). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: left, right or center, with which the area can be positioned left-aligned, right-aligned or centered.ypos: The y-position of the area on the playing field (taking into account the upper margin from the edge of the playing field). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: top, bottom or middle, with which the area can be positioned at the top, bottom or center.width: The width of the area. This must be specified as a numerical value in pixels or as a percentage value (as a number followed by %). The percentage refers to the width of the playing field (taking into account the margins to the left and right of the playing field).height: The height of the area. This must be specified as a numerical value in pixels or as a percentage (as a number followed by %). The percentage refers to the height of the playing field (taking into account the margins to the top and bottom edge of the playing field).margintop: This defines the upper distance within the area. The specification must be made as a numerical value in pixels or as a percentage value (as a number followed by %). The percentage refers to the height of the area. All vertical position specifications take this into account. Example: If the distance is 10 and the y-position for an element is 15, then the element is positioned 25 pixels from the top edge of the area.marginbottom: This defines the bottom distance within the area. The specification must be made as a numerical value in pixels or as a percentage value (as a number followed by %). The percentage refers to the height of the area. This is only relevant for position specifications using bottom or middle.marginleft: This defines the left distance within the area. The specification must be made as a numerical value in pixels or as a percentage value (as a number followed by %). The percentage refers to the width of the area. All horizontal position specifications take this into account. Example: If the distance is set to 10 and the x-position for an element is set to 15, then the element is positioned 25 pixels from the left edge of the area.marginright: This defines the right distance within the area. The specification must be made as a numerical value in pixels or as a percentage value (as a number followed by %). The percentage refers to the width of the area. This is only relevant for position specifications using right or center.hidden: This determines whether the area itself should be displayed (as a rectangle). Valid values are true or false. The default is false. The true setting is more for debugging purposes to see if the area is in the desired position.Elements (elements) can be defined in a layout which are to be displayed on the playing field. The elements are the defined game materials.
The layout can be configured for the following game materials:
A set of pieces (pieceset) supports the following attributes:
xpos: The x-position of the pieces on the playing field (taking into account the left margin from the edge of the playing field or area). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: left, right or center, with which the pieces can be positioned left-aligned, right-aligned or centered.ypos: The y-position of the pieces on the playing field (taking into account the upper margin from the edge of the playing field or area). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: top, bottom or middle, with which the pieces can be positioned at the top, bottom or middle.percentsize: The percentage size in which the images of the pieces are displayed. The specification must be a numerical value (without a following %) or one of the following values: scale, scale_x or scale_y. In the percentage specification, the value 100 means the normal size. With the scaling variants, the figures are scaled (while retaining the aspect ratio) so that they fill the playing field or area horizontally (with scale_x) or vertically (with scale_y). With scale, the pieces are scaled so that they fill the playing field or area as far as possible without protruding beyond it.angle: The degree of rotation with which the pieces are to be displayed. This must be specified as a numerical value. The default is 0.area: The name of the area in which the pieces are to be displayed. If an area is specified, the position information refers to the area - otherwise to the playing field.xspacing: The horizontal offset of the individual pieces. This must be specified as a numerical value in pixels.yspacing: The vertical offset of the individual pieces. This must be specified as a numerical value in pixels.orientation: The direction in which the pieces are to be displayed. The following values are valid: ltr_down (from left to right and then down), ltr_up (from left to right and then up), down_ltr (from up to down and then to the right), up_ltr (from down to up and then to the right), rtl_down (from right to left and then down), rtl_up (from right to left and then up), down_rtl (from top to bottom and then to the left) or up_rtl (from bottom to top and then to the left).wrapthreshold: Determines after how many pieces wrapping should take place. This value is only relevant if orientation has been specified.A set of cards (cardset) supports the following attributes:
type: The type of the card set. The type does not have to be specified for the standard card set.playerindex: The index of the player for whom the cards are to be displayed. The specification must be a numerical value. The first player has the index 0.xpos: The x-position of the cards on the playing field (taking into account the left margin from the edge of the playing field or area). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: left, right or center, with which the cards can be positioned left-aligned, right-aligned or centered.ypos: The y-position of the cards on the playing field (taking into account the upper margin from the edge of the playing field or area). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: top, bottom or middle, with which the cards can be positioned at the top, bottom or middle.percentsize: The percentage size in which the images of the cards are displayed. The specification must be a numerical value (without a following %) or one of the following values: scale, scale_x or scale_y. In the percentage specification, the value 100 means the normal size. With the scaling variants, the cards are scaled (while retaining the aspect ratio) so that they fill the playing field or area horizontally (with scale_x) or vertically (with scale_y). With scale, the cards are scaled so that they fill the playing field or area as far as possible without protruding beyond it.angle: The degree of rotation with which the cards are to be displayed. This must be specified as a numerical value. The default is 0.area: The name of the area in which the cards are to be displayed. If an area is specified, the position information refers to the area - otherwise to the playing field.xspacing: The horizontal offset of the individual cards. This must be specified as a numerical value in pixels.yspacing: The vertical offset of the individual cards. This must be specified as a numerical value in pixels.orientation: The direction in which the cards are to be displayed. The following values are valid: ltr_down (from left to right and then down), ltr_up (from left to right and then up), down_ltr (from up to down and then to the right), up_ltr (from down to up and then to the right), rtl_down (from right to left and then down), rtl_up (from right to left and then up), down_rtl (from top to bottom and then to the left) or up_rtl (from bottom to top and then to the left).wrapthreshold: Determines after how many cards wrapping should take place. This value is only relevant if orientation has been specified.covered: Determines if the cards should be displayed with the backside up. The following values are valid: true oder false.An object (part) supports the following attributes:
type: The type of the object.xpos: The x-position of the object on the playing field (taking into account the left margin from the edge of the playing field or area). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: left, right or center, with which the object can be positioned left-aligned, right-aligned or centered.ypos: The y-position of the object on the playing field (taking into account the upper margin from the edge of the playing field or area). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: top, bottom or middle, with which the object can be positioned at the top, bottom or middle.percentsize: The percentage size in which the image of the object is displayed. The specification must be made as a numerical value (without following %) or one of the following values: scale, scale_x or scale_y. In the percentage specification, the value 100 means the normal size. With the scaling variants, the object is scaled (while retaining the aspect ratio) so that it fills the playing field or area horizontally (with scale_x) or vertically (with scale_y). With scale, the object is scaled so that it fills the playing field or area as far as possible without protruding beyond it.angle: The degree of rotation with which the object is to be displayed. This must be specified as a numerical value. The default is 0.area: The name of the area in which the object is to be displayed. If an area is specified, the position information refers to the area - otherwise to the playing field.A set of objects (partset) supports the following attributes:
type: The type of the set.xpos: The x-position of the objects on the playing field (taking into account the left margin from the edge of the playing field or area). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: left, right or center, with which the objects can be positioned left-aligned, right-aligned or centered.ypos: The y-position of the objects on the playing field (taking into account the upper margin from the edge of the playing field or area). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: top, bottom or middle, with which the objects can be positioned at the top, bottom or middle.percentsize: The percentage size in which the images of the objects are displayed. The specification must be made as a numerical value (without following %) or one of the following values: scale, scale_x or scale_y. In the percentage specification, the value 100 means the normal size. With the scaling variants, the objects are scaled (while retaining the aspect ratio) so that they fill the playing field or area horizontally (with scale_x) or vertically (with scale_y). With scale, the objects are scaled so that they fill the playing field or area as far as possible without protruding beyond it.angle: The degree of rotation with which the objects are to be displayed. This must be specified as a numerical value. The default is 0.area: The name of the area in which the objects are to be displayed. If an area is specified, the position information refers to the area - otherwise to the playing field.xspacing: The horizontal offset of the individual objects. This must be specified as a numerical value in pixels.yspacing: The vertical offset of the individual objects. This must be specified as a numerical value in pixels.orientation: The direction in which the objects are to be displayed. The following values are valid: ltr_down (from left to right and then down), ltr_up (from left to right and then up), down_ltr (from top to bottom and to the right), up_ltr (from bottom to top and then to the right), rtl_down (from right to left and then down), rtl_up (from right to left and then up), down_rtl (from top to bottom and then to the left) or up_rtl (from bottom to top and then to the left).wrapthreshold: Determines after how many objects should be wrapped. This value is only relevant if orientation has been specified.A player information (playerinfo) supports the following attributes:
type: The type of information. The following values are allowed:name: The name of the player.game_score: The player's points in the current game.round_score: The player's points in the current round.turn_score: The player's points for the current turn.playerindex: The index of the player for whom the information is to be displayed. The specification must be a numerical value. The first player has the index 0.xpos: The x-position of the information on the playing field (taking into account the left margin from the edge of the playing field or area). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: left, right or center, with which the objects can be positioned left-aligned, right-aligned or centered.ypos: The y-position of the Information on the playing field (taking into account the upper margin from the edge of the playing field or area). The specification must be a numerical value in pixels, a percentage value (as a number followed by %) or one of the following values: top, bottom or middle, with which the object can be positioned at the top, bottom or middle.fontsize: The font size in which the information is to be displayed. The specification must be a numerical value in points, a percentage value (as a number followed by %) or one of the following values: scale, scale_x, or scale_y. In the percentage specification, the value refers to the height of the area or the playing field. With the scaling variants, the information is scaled so that it fills the playing field or the area horizontally (for scale_x) or vertically (for scale_y). With scale, the information is scaled so that it fills the playing field or the area as far as possible without protruding beyond it.color: The color in which the information is to be displayed. It must be specified in the format RRGGBB, where RR represents the red component, GG represents the green component, and BB represents the blue component. The components must be specified in hexadecimal values.angle: The degree of rotation with which the information is to be displayed. This must be specified as a numerical value. The default is 0. This attribute is not available on Android!area: The name of the area in which the information is to be displayed. If an area is specified, the position and size information refers to the area - otherwise to the playing field.Sounds can be configured in a similar way to game materials. There are individual sounds and sets of sounds. Sounds and sets of sounds can also be grouped together into arrangements.
As with game materials, sounds can also be hidden. Hidden sounds are not displayed in the dialog for modifying the arrangements of sounds. The keyword for this is hidden, which can be set either to false or true. The developer can access both hidden and visible sounds. However, hidden sounds can never be active, which mainly affects methods of GameConfig: for example, hidden sounds are returned by getSounds(), but getActiveSound() can never return a hidden sound.
Note for Android applications
In Android, it is possible that individual sounds, sets of sounds or arrangements must first be purchased via In-App-Purchases. To do this, the attribute productid must be specified for the corresponding sound, sound set or arrangement. The value must correspond to the ID of the product in the Google Play Console. Multiple sounds, sets of sounds or arrangements can have the same product ID.
A 🔒 symbol (text resource unpurchased_marker) is then displayed in the selection list next to the sound. When such an element, the purchase process is initiated. If the purchase is completed successfully, the symbol is removed and the sound can be used.
As long as an unpurchased element is selected, no game can be started.
Example:
<sounds extension="wav" path="/sounds">
<sound type="play_card" name="play_card_standard"/>
<sound type="play_card" name="play_card_alternative" file="/assets/playcard.wav" productid="alternativ_sounds"/>
<soundset type="roll_dice" name="roll_dice_standard">
<sound sequencestart="1" sequenceend="10"/>
</soundset>
<soundset type="roll_dice" name="roll_dice_alternative" productid="alternativ_sounds">
<sound sequencestart="1" sequenceend="5"/>
<sound sequence="6" file="/assets/rolldice.wav"/>
</soundset>
</sounds>
Both individual sounds and sets can be defined. A type (type) is defined for identification. All sounds of the same type belong together and are alternatives in the dialog for the arrangement of sounds. For each type, there is a combo box in this dialog. Messages must also be defined in the messages file for the types. If individual sounds are defined, they each contain only one sound. If sets are defined, they contain several sounds. This can be used, for example, to play different dice-rolling sounds when rolling dice.
<sounds extension="wav" path="/sounds">
<sound type="play_card" name="play_card_standard"/>
<sound type="play_card" name="play_card_alternative" file="/assets/playcard.wav"/>
<soundset type="roll_dice" name="roll_dice_standard">
<sound sequencestart="1" sequenceend="10"/>
</soundset>
<soundset type="roll_dice" name="roll_dice_alternative">
<sound sequencestart="1" sequenceend="5"/>
<sound sequence="6" file="/assets/rolldice.wav"/>
</soundset>
</sounds>
extension: File extension for the sound files.path: Directory where the sound files are searched.sound: Defines a sound. A type (type) and a name (name) are required. The name must be unique, and if the sound is not hidden, a message for the name must be defined. Optionally, the file attribute can be set; otherwise, the file <path>/<name>.<extension> is used.soundset: A set requires a type (type) and a unique name (name), and if the set is not hidden, a message for the name must be defined. For a single sound, the sequence attribute is defined; for a sequence range, the attributes sequencestart and sequenceend are used (all values must be numeric). The file can also be specified with file; otherwise, the files are searched in the following format: <path>/<name>/<type>-<sequence>.<extension> (sequence here also represents a single value from the sequence range). If a file name is defined for a sequence range, all elements receive the same sound.Various sounds and sets of sounds can be grouped into arrangements. Such arrangements only make sense if the dialog for modifying the arrangements is accessible (menu command settings.sounds).
<soundarrangements complete="false">
<soundarrangement name="arrangement_standard">
<sound type="play_card" value="play_card_standard"/>
<soundset type="roll_dice" value="roll_dice_standard"/>
</soundarrangement>
<soundarrangement name="arrangement_alternative">
<sound type="play_card" value="play_card_alternative"/>
<soundset type="roll_dice" value="roll_dice_alternative"/>
</soundarrangement>
</arrangements>
complete: (Optional) Determines whether only the defined arrangements are possible, or whether the user can also modify the arrangements freely. If complete is set to true, the arrangements cannot be changed. In this case, the individual arrangements should therefore be complete, i.e., consider all occurring sounds. By default, modifications are possible.soundarrangement: Each arrangement is identified by a unique name (name). A message should also be defined for this name.sound: An entry can be made for each sound, where the attribute type specifies the type and the attribute value specifies the name of the sound belonging to the arrangement.soundset: For sets, entries can be made analogously to individual sounds.