This is a documentation for Board Game Arena: play board games online !

Studio file reference: Difference between revisions

From Board Game Arena
Jump to navigation Jump to search
No edit summary
 
(27 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Studio_Framework_Navigation}}


This is a quick reference for the files used to implement a game. For more information, edit the file and read the introductory comment.
This is a quick reference for the files used to implement a game. For more information, follow the wiki links.


=== 'img' directory ===
=== software versions ===


This directory contains the images for your game:
See [[Studio#Software_Versions]]
* game_box.png is displayed on the main site on the game description page and when creating a table (280x280 px)
 
* game_icon.png is the icon displayed in the lists of games and tables (50x50 px)
=== img/ ===
* publisher.png is the logo of the publisher of the game, displayed on the game description page (width: 150 px)
 
* and other images that you need. You should use [http://www.w3schools.com/css/css_image_sprites.asp CSS sprites] for better web performance.
This directory contains the images for your game (the game art).
 
When game graphics changes it require full reload in browser (Ctrl+F5) to clear the cache. Changing marketing graphics and deleting files require extra actions from control panel.
 
See [[Game art: img directory]]
 
=== gameinfos.inc.php ===
 
In this file you describe the meta-information for your game: game name, publisher name, number of player, game categories, etc...
 
When this file changes it requires special reloading using control panel.
 
See [[Game_meta-information:_gameinfos.inc.php]].


=== dbmodel.sql ===
=== dbmodel.sql ===
Line 14: Line 27:
File for creating specific database tables that you will need to persist data during the game (for example a table for cards).
File for creating specific database tables that you will need to persist data during the game (for example a table for cards).


=== gameoptions.inc.php ===
When this file changes it requires restart of the game. If game was already in production it requires migration.


File for describing your game options (= game variants)
See [[Game database model: dbmodel.sql]]
 
=== gameoptions.json, gamepreferences.json (was: gameoptions.inc.php) ===
 
File for describing your game options (or game variants).
 
When this file changes it requires special reloading using control panel.
 
See [[Options_and_preferences: gameoptions.json, gamepreferences.json]].


=== <gamename>.action.php ===
=== <gamename>.action.php ===


File used to describe methods that can be called from the client interface through javascript, get parameters and call the appropriate game functions.
File used to describe methods that can be called from the client interface through javascript, get parameters and call the appropriate game functions.
When this file changes reloading is not required.
See [[Players actions: yourgamename.action.php]].


=== <gamename>.css ===
=== <gamename>.css ===
Line 26: Line 51:
CSS styles specific to your game.
CSS styles specific to your game.


=== <gamename>.game.php ===
When this file changes it requires forced reloading (Ctrl+F5) to clear the cache.


This is the main file for your game logic. Here you initialize the game, persist data, implement the rules and notify changes to the client interface.
See [[Game interface stylesheet: yourgamename.css]].
 
=== modules/php/Game.php ===
 
This is the main file for your game logic. Here you initialize the game, persist data, implement the rules and notify changes to the client interface.
 
When this file changes reloading is not required.
 
See [[Main game logic: Game.php]].


=== <gamename>.js ===
=== <gamename>.js ===
Line 36: Line 69:
* what happens when you get a notification for change from the server and how it will show in the browser.
* what happens when you get a notification for change from the server and how it will show in the browser.


=== <gamename>.view.php and <gamename>_<gamename>.tpl ===
When this file changes you need to do simple reloading of currently running game (F5).
 
See [[Game interface logic: yourgamename.js]].
 
=== <gamename>.view.php, <gamename>_<gamename>.tpl ===


Files used to set up the page layout ('view') for the game.
Files are used to set up the page layout ('view') for the game.
 
When this file changes you need to do simple reloading of currently running game (F5).
 
See [[Game layout: view and template: yourgamename.view.php and yourgamename yourgamename.tpl]].


=== material.inc.php ===
=== material.inc.php ===


File used to describe all the game material (cards with their description, dices, tokens...). You can also use it to define game constants.
File used to describe all the game material (cards with their description, dices, tokens...). You can also use it to define game constants.
When this file changes reloading is not required, however if your js side using some data from there (which it should) do simple reloading of currently running game (F5) .
See [[Game material description: material.inc.php]].


=== states.inc.php ===
=== states.inc.php ===
Line 48: Line 93:
This file describes the game states machine of your game (all the game states properties, and the transitions to get from one state to another).
This file describes the game states machine of your game (all the game states properties, and the transitions to get from one state to another).


=== stats.inc.php ===
When this file changes it requires simple reloading, however if changes are breaking it requires to start a new game.
 
See [[Your game state machine: states.inc.php]].
 
=== stats.json (was: stats.inc.php) ===


File used to list statistics that you want to update during the game to be presented to players at the end of the game.
File used to list statistics that you want to update during the game to be presented to players at the end of the game.
When this file changes it requires special reloading using control panel.
See [[Game statistics: stats.json]].
=== version.php ===
Don't edit this file. It is used internally by the build system.
=== modules/ ===
Modules directory can contain additional php files which can be included in main game.php via include or require. It also can contain addition js files. This directory is checked in version control.
=== misc/ ===
Directory containing files you would like to keep with project but not needed on production server. This directory is checked in version control. Total limit is 1 Mb for this directory.
=== <other files> ===
You can use other files but they won't be checked in source control and published in production. That includes any additional .js or .php files. If you need them use modules/ directory.
[[Category:Studio]]

Latest revision as of 11:24, 9 October 2024


Game File Reference



Useful Components

Official

  • Deck: a PHP component to manage cards (deck, hands, picking cards, moving cards, shuffle deck, ...).
  • Draggable: a JS component to manage drag'n'drop actions.
  • Counter: a JS component to manage a counter that can increase/decrease (ex: player's score).
  • ExpandableSection: a JS component to manage a rectangular block of HTML than can be displayed/hidden.
  • Scrollmap: a JS component to manage a scrollable game area (useful when the game area can be infinite. Examples: Saboteur or Takenoko games).
  • Stock: a JS component to manage and display a set of game elements displayed at a position.
  • Zone: a JS component to manage a zone of the board where several game elements can come and leave, but should be well displayed together (See for example: token's places at Can't Stop).

Undocumented component (if somebody knows please help with docs)

  • Wrapper: a JS component to wrap a <div> element around its child, even if these elements are absolute positioned.

Unofficial



Game Development Process



Guides for Common Topics



Miscellaneous Resources

This is a quick reference for the files used to implement a game. For more information, follow the wiki links.

software versions

See Studio#Software_Versions

img/

This directory contains the images for your game (the game art).

When game graphics changes it require full reload in browser (Ctrl+F5) to clear the cache. Changing marketing graphics and deleting files require extra actions from control panel.

See Game art: img directory

gameinfos.inc.php

In this file you describe the meta-information for your game: game name, publisher name, number of player, game categories, etc...

When this file changes it requires special reloading using control panel.

See Game_meta-information:_gameinfos.inc.php.

dbmodel.sql

File for creating specific database tables that you will need to persist data during the game (for example a table for cards).

When this file changes it requires restart of the game. If game was already in production it requires migration.

See Game database model: dbmodel.sql

gameoptions.json, gamepreferences.json (was: gameoptions.inc.php)

File for describing your game options (or game variants).

When this file changes it requires special reloading using control panel.

See Options_and_preferences: gameoptions.json, gamepreferences.json.

<gamename>.action.php

File used to describe methods that can be called from the client interface through javascript, get parameters and call the appropriate game functions.

When this file changes reloading is not required.

See Players actions: yourgamename.action.php.

<gamename>.css

CSS styles specific to your game.

When this file changes it requires forced reloading (Ctrl+F5) to clear the cache.

See Game interface stylesheet: yourgamename.css.

modules/php/Game.php

This is the main file for your game logic. Here you initialize the game, persist data, implement the rules and notify changes to the client interface.

When this file changes reloading is not required.

See Main game logic: Game.php.

<gamename>.js

This is the main file for your game interface. Here you will define:

  • which actions on the page will generate calls to the server
  • what happens when you get a notification for change from the server and how it will show in the browser.

When this file changes you need to do simple reloading of currently running game (F5).

See Game interface logic: yourgamename.js.

<gamename>.view.php, <gamename>_<gamename>.tpl

Files are used to set up the page layout ('view') for the game.

When this file changes you need to do simple reloading of currently running game (F5).

See Game layout: view and template: yourgamename.view.php and yourgamename yourgamename.tpl.

material.inc.php

File used to describe all the game material (cards with their description, dices, tokens...). You can also use it to define game constants.

When this file changes reloading is not required, however if your js side using some data from there (which it should) do simple reloading of currently running game (F5) .

See Game material description: material.inc.php.

states.inc.php

This file describes the game states machine of your game (all the game states properties, and the transitions to get from one state to another).

When this file changes it requires simple reloading, however if changes are breaking it requires to start a new game.

See Your game state machine: states.inc.php.

stats.json (was: stats.inc.php)

File used to list statistics that you want to update during the game to be presented to players at the end of the game.

When this file changes it requires special reloading using control panel.

See Game statistics: stats.json.

version.php

Don't edit this file. It is used internally by the build system.


modules/

Modules directory can contain additional php files which can be included in main game.php via include or require. It also can contain addition js files. This directory is checked in version control.

misc/

Directory containing files you would like to keep with project but not needed on production server. This directory is checked in version control. Total limit is 1 Mb for this directory.

<other files>

You can use other files but they won't be checked in source control and published in production. That includes any additional .js or .php files. If you need them use modules/ directory.