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

Post-release phase: Difference between revisions

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


Your game is now on BGA: congrats!
Your game is now on BGA: congrats!
Line 6: Line 7:
Don't be afraid: you're still allowed to modify your game. You just have to pay attention to the points below.
Don't be afraid: you're still allowed to modify your game. You just have to pay attention to the points below.


== BGA packages: when my updates will be visible by players? ==
== Bugs reporting ==


BGA website is updated with "packages". When needed, we build a new package with all games and release a new version of BGA with this package.
Bugs are reported on the [https://boardgamearena.com/bugs BGA bugs page].


It means that your updates won't be visible by players until a new package is build and released on the website.
During days after your game has been published and from time to time, please have a look at it to check if everything is fine.


Usually, there is less than 2 weeks between 2 packages, so it's quick. BUT, if you detect some major bug in your game, please warn us immediately so we can decide what to do. Usually, we do the following:
== How to submit changes? ==
* We can do a "hotfix": you send us a very little change and we fix the website immediately. This is only possible if you change only the PHP side. The good news is that most blocking bugs are on PHP side - the client side bugs are most of the time solved by a page refresh. Of course, we don't hotfix minor bugs.
* We can build another package. Of course, it's better to fix several bugs in each package, in order we don't have to build another package right after the first one :)
* If the situation is critical, we can suspend the game from BGA waiting for the update.


Of course, we particularly care of your game during the days after your game is available on BGA. During this period of time, there's no problem to build package and to hotfix just for your game, and this is done in close collaboration with you. You just have to inform us when you're ready to publish a new version.
There are steps to make your changes visible on BGA (from your game Control Panel, i.e. https://studio.boardgamearena.com/studiogame?game=mygamename):


Note: don't forget that in any case, you need to commit your changes to made them available for the next package. Modifications that are not commited are not included in the packages.
* In Build a new release version section
** Enter some notes about the release (i.e. fixed bug xxx, added feature yyy)
** Press "Commit & build a new version now"
** Do not dismiss the build dialog right away, make sure it does not have Errors. If there are error build has failed.
* Deploy your new version in production
** Find your newly build version (should be latest, but check release note to make sure)
** Press "Deploy to production" button
** Do not dismiss the deploy dialog right away, make sure it does not have Errors. If there are error the deploy has failed.
* To check - the version of deployed game should be updated in "Online version" of control panel and also in section Credits page of the running game
* Go to Group page of your game and post update anouncement (usually using release notes from the deployment)
 
Note: if your game is very popular it will be pretty drammatic if it breaks, you can use two tricks to help your users
* [https://en.doc.boardgamearena.com/BGA_Studio_Cookbook#Disable_/_lock_table_creation_for_new_deploy Disable / lock table creation for new deploy]
* [https://en.doc.boardgamearena.com/BGA_Studio_Cookbook#Force_players_to_refresh_after_new_deploy Force players to refresh after new deploy]


== What can be modified after release? ==
== What can be modified after release? ==
Line 27: Line 38:
===Changes that breaks the games in progress===
===Changes that breaks the games in progress===


Some changes will break the games in progress at the moment the release/the hotfix will be performed.
Some changes will break the games in progress at the moment the release/the hotfix will be performed. Each time you make a change, you should ask you the question "it is safe to make this change in a game in progress", and if the answer is "no" you have to inform us.
 
Example of changes that break the games in progress:
* Changes in the database schema of the game (dbmodel.sql).
* New global variable or game option accessed during the game (if it's only used during setup, it should be safe).
* Change ID of existing game states (adding new game states is fine).
* Changing flow of game states (for example, if you change 1 -> 2 -> 3 -> 4 to 1 -> 3 -> 2 -> 4, players at state 2 will skip state 3)
 
Of course, as a rule of thumb, you should avoid to introduce changes that break a game in progress. Sometimes however, you do not have any other choice. In this case:
* Try to group all your updates in one version, thus we won't have to block your game several times.
* Tell us explicitly that you introduce some update that can break games in progress so we can block the game during a short time.
 
Note: in the near future, we will introduce the possibility for you to block/unblock a game directly from your Control Panel in order to perform all the process by yourself.
 
=== Updating game options ===
 
* If you add options, you should let us know which value should be used for the arena mode, so that we can update the arena configuration.
* If you remove an option or change a option ID, it will break the arena configuration and prevent creating new arena games, so you should let us know so that we can synchronize to update the configuration at the same time as you deploy the new version.
* Do not change option IDs once the game is in production, it will break ongoing games and audience option statistics.
 
=== Updating Statistics ===
 
You should be careful when updating a statistics:
 
* If you want to add a new statistic, please be aware that for ongoing games this statistic won't always be correct since it has not been counted from the start of that game.
* If you want to update a statistic, please update it and do not remove/create another one. Otherwise, the statistic won't keep the same ID and players will lose all the historical statistics data.
* If your game is published on BGA, please don't remove any statistics (historical data will be lost).
 
=== Updating the database schema ===
 
If you want to update the database schema of the game (dbmodel.sql) and your game is already open to everyone on BGA (from BETA onwards), you should inform us before releasing the new version (see "[[#Changes that breaks the games in progress|changes that breaks the games in progress]]").
 
Any modification in dbmodel.sql should also appear in your nameofyourgame.game.php, in a function
 
  function upgradeTableDb( $from_version ){
<nowiki> </nowiki>
<nowiki> </nowiki>if( $from_version <= YYMMDDHHMM ){ // where your CURRENT version in production has number YYMMDD-HHMM
<nowiki> </nowiki>
<nowiki> </nowiki>          // You DB schema update request.
<nowiki> </nowiki>          // Note: all tables names should be prefixed by "DBPREFIX_" to be compatible with the applyDbUpgradeToAllDB method you should use below
<nowiki> </nowiki>          $sql = "CREATE TABLE DBPREFIX_xxxxxxx ....";
<nowiki> </nowiki>
<nowiki> </nowiki>          // The method below is applying your DB schema update request to all tables, including the BGA framework utility tables like "zz_replayXXXX" or "zz_savepointXXXX".
<nowiki> </nowiki>          // You should really use this request, in conjunction with "DBPREFIX_" in your $sql, so ALL tables are updated. All utility tables MUST have the same schema than the main table, otherwise the game may be blocked.
<nowiki> </nowiki>          self::applyDbUpgradeToAllDB( $sql );
<nowiki> </nowiki>}}
 
Note1: of course you need to change your dbmodel.sql accordingly, so that new games get your updated scheme.
 
Note2: this is always risky to modify the DB scheme, so:
* if your game is already open to everyone on BGA (from BETA onwards), it may be worth contacting us before, so we can stop the realtime games during the update (this way, only turn based games are concerned by the DB live upgrade).
* if you can avoid it... try to avoid it :)
 
Note3: testing on the studio is possible by following the following procedure:
* make sure the current state of your project is correctly committed
* revert to the revision currently in production using the version control tools ("Display commit log" -> find the revision matching the current version in production, then "Overwrite working copy with this revision" to get back the matching code)
* launch a game with this code
* revert to your code latest version using the version control tools (use "Overwrite working copy with this revision" with "head" for the revision)
* access the game database
* in the "global" table, find the row with id 300. Its value is 999999999 by default on the studio. Change it to the current production version number
* hit refresh to reload your game page. Your upgradeTableDb() function will be run and the global value will be updated again to the studio value
* check the database to see if your changes have been correctly applied.
 
Note4: consider that if your game has some undo support capability through 'db_undo_support' => true,' in the gameinfos.inc.php, calling the undoRestorePoint() could restore to a prior game version and the upgradeTableDb() could be called again. In that case, it's better to secure the SQL Alter Table Request with something like:
      function upgradeTableDb( $from_version ){
        if( $from_version <= YYMMDDHHMM )
        {
          // ! important ! Use DBPREFIX_<table_name> for all tables
          // test first the new column existance since it can exists from a previous call to upgradeTableDb while an undo was performed
          $result = self::getUniqueValueFromDB("SHOW COLUMNS FROM tablename LIKE 'new_column'");
          if (empty($result))
              self::applyDbUpgradeToAllDB("ALTER TABLE DBPREFIX_tablename ADD `new_column` tinyint(4)  unsigned NOT NULL DEFAULT '0';");
        }
      }
 
=== Updating string to be translated  ===
 
When you update a string that has been marked to be translatable, please keep in mind that all current translations done by the BGA community will be lost.
 
Consequently, when you are about to modify a string to be translated (after release), please ask you the following questions:
* Is it just an English misspelling? In this case, it is better to fix the English translation of the string than the original string to be translated.
* Has the meaning of the string changed? If yes, you HAVE to change the original string in order to invalidate all translations that has been done already.
* Is there a similar string already used elsewhere in my game? In this case, you'd better use it again to enjoy immediately all translations already available.
 
===Tell the community about your changes :)===
 
The player's community is always happy to know that someone is taking care of their preferred game :)
 
If your are the developer of game XXXX, you are also the administrator of player's group "XXXX's players", and you can publish some news in this group newsfeed.
 
When you fix a bug or add something, do not hesitate to tell the players about this in this group: you'll get the "thank you" you deserved :)
 
See for example Werewolves group:
https://boardgamearena.com/group?id=2465913
===Major changes===
 
If you do some major changes to your game like:
* Introducing a new expansion.
* Major code rewriting/refactoring.
 
... please tell us. In this case, we can:
* Make your game back from "gold" to "public beta", to incite player to report bugs.
* And eventually, publish a news about it :)
 
== Avoiding version mismatches ==
Be advised about the timing of deployments: Your new PHP backend code takes effect '''immediately''', but your new JS/HTML/CSS frontend code does not take effect unless current players reload the page (F5). This can lead to unexpected behavior and difficult-to-reproduce bugs caused by old JS client code interacting with new PHP server code.
 
Until the BGA framework handles this automatically for everyone (please upvote https://studio.boardgamearena.com/bug?id=106), your game should definitely implement something like [[BGA Studio Cookbook#Force players to refresh after new deploy]].
[[Category:Studio]]

Latest revision as of 02:06, 13 October 2023


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

Your game is now on BGA: congrats!

But what happened when there are some bugs to fix or when you want to optimize something?

Don't be afraid: you're still allowed to modify your game. You just have to pay attention to the points below.

Bugs reporting

Bugs are reported on the BGA bugs page.

During days after your game has been published and from time to time, please have a look at it to check if everything is fine.

How to submit changes?

There are steps to make your changes visible on BGA (from your game Control Panel, i.e. https://studio.boardgamearena.com/studiogame?game=mygamename):

  • In Build a new release version section
    • Enter some notes about the release (i.e. fixed bug xxx, added feature yyy)
    • Press "Commit & build a new version now"
    • Do not dismiss the build dialog right away, make sure it does not have Errors. If there are error build has failed.
  • Deploy your new version in production
    • Find your newly build version (should be latest, but check release note to make sure)
    • Press "Deploy to production" button
    • Do not dismiss the deploy dialog right away, make sure it does not have Errors. If there are error the deploy has failed.
  • To check - the version of deployed game should be updated in "Online version" of control panel and also in section Credits page of the running game
  • Go to Group page of your game and post update anouncement (usually using release notes from the deployment)

Note: if your game is very popular it will be pretty drammatic if it breaks, you can use two tricks to help your users

What can be modified after release?

Everything can be modified. BUT, some items requires a special attention, and you must inform us in some cases:

Changes that breaks the games in progress

Some changes will break the games in progress at the moment the release/the hotfix will be performed. Each time you make a change, you should ask you the question "it is safe to make this change in a game in progress", and if the answer is "no" you have to inform us.

Example of changes that break the games in progress:

  • Changes in the database schema of the game (dbmodel.sql).
  • New global variable or game option accessed during the game (if it's only used during setup, it should be safe).
  • Change ID of existing game states (adding new game states is fine).
  • Changing flow of game states (for example, if you change 1 -> 2 -> 3 -> 4 to 1 -> 3 -> 2 -> 4, players at state 2 will skip state 3)

Of course, as a rule of thumb, you should avoid to introduce changes that break a game in progress. Sometimes however, you do not have any other choice. In this case:

  • Try to group all your updates in one version, thus we won't have to block your game several times.
  • Tell us explicitly that you introduce some update that can break games in progress so we can block the game during a short time.

Note: in the near future, we will introduce the possibility for you to block/unblock a game directly from your Control Panel in order to perform all the process by yourself.

Updating game options

  • If you add options, you should let us know which value should be used for the arena mode, so that we can update the arena configuration.
  • If you remove an option or change a option ID, it will break the arena configuration and prevent creating new arena games, so you should let us know so that we can synchronize to update the configuration at the same time as you deploy the new version.
  • Do not change option IDs once the game is in production, it will break ongoing games and audience option statistics.

Updating Statistics

You should be careful when updating a statistics:

  • If you want to add a new statistic, please be aware that for ongoing games this statistic won't always be correct since it has not been counted from the start of that game.
  • If you want to update a statistic, please update it and do not remove/create another one. Otherwise, the statistic won't keep the same ID and players will lose all the historical statistics data.
  • If your game is published on BGA, please don't remove any statistics (historical data will be lost).

Updating the database schema

If you want to update the database schema of the game (dbmodel.sql) and your game is already open to everyone on BGA (from BETA onwards), you should inform us before releasing the new version (see "changes that breaks the games in progress").

Any modification in dbmodel.sql should also appear in your nameofyourgame.game.php, in a function

 function upgradeTableDb( $from_version ){
 
 if( $from_version <= YYMMDDHHMM ){ // where your CURRENT version in production has number YYMMDD-HHMM
 
           // You DB schema update request.
           // Note: all tables names should be prefixed by "DBPREFIX_" to be compatible with the applyDbUpgradeToAllDB method you should use below
           $sql = "CREATE TABLE DBPREFIX_xxxxxxx ....";
 
           // The method below is applying your DB schema update request to all tables, including the BGA framework utility tables like "zz_replayXXXX" or "zz_savepointXXXX".
           // You should really use this request, in conjunction with "DBPREFIX_" in your $sql, so ALL tables are updated. All utility tables MUST have the same schema than the main table, otherwise the game may be blocked.
           self::applyDbUpgradeToAllDB( $sql ); 
 }}

Note1: of course you need to change your dbmodel.sql accordingly, so that new games get your updated scheme.

Note2: this is always risky to modify the DB scheme, so:

  • if your game is already open to everyone on BGA (from BETA onwards), it may be worth contacting us before, so we can stop the realtime games during the update (this way, only turn based games are concerned by the DB live upgrade).
  • if you can avoid it... try to avoid it :)

Note3: testing on the studio is possible by following the following procedure:

  • make sure the current state of your project is correctly committed
  • revert to the revision currently in production using the version control tools ("Display commit log" -> find the revision matching the current version in production, then "Overwrite working copy with this revision" to get back the matching code)
  • launch a game with this code
  • revert to your code latest version using the version control tools (use "Overwrite working copy with this revision" with "head" for the revision)
  • access the game database
  • in the "global" table, find the row with id 300. Its value is 999999999 by default on the studio. Change it to the current production version number
  • hit refresh to reload your game page. Your upgradeTableDb() function will be run and the global value will be updated again to the studio value
  • check the database to see if your changes have been correctly applied.

Note4: consider that if your game has some undo support capability through 'db_undo_support' => true,' in the gameinfos.inc.php, calling the undoRestorePoint() could restore to a prior game version and the upgradeTableDb() could be called again. In that case, it's better to secure the SQL Alter Table Request with something like:

      function upgradeTableDb( $from_version ){
        if( $from_version <= YYMMDDHHMM )
        {
          // ! important ! Use DBPREFIX_<table_name> for all tables
          // test first the new column existance since it can exists from a previous call to upgradeTableDb while an undo was performed
          $result = self::getUniqueValueFromDB("SHOW COLUMNS FROM tablename LIKE 'new_column'");
          if (empty($result))
              self::applyDbUpgradeToAllDB("ALTER TABLE DBPREFIX_tablename ADD `new_column` tinyint(4)  unsigned NOT NULL DEFAULT '0';");
        }
      }

Updating string to be translated

When you update a string that has been marked to be translatable, please keep in mind that all current translations done by the BGA community will be lost.

Consequently, when you are about to modify a string to be translated (after release), please ask you the following questions:

  • Is it just an English misspelling? In this case, it is better to fix the English translation of the string than the original string to be translated.
  • Has the meaning of the string changed? If yes, you HAVE to change the original string in order to invalidate all translations that has been done already.
  • Is there a similar string already used elsewhere in my game? In this case, you'd better use it again to enjoy immediately all translations already available.

Tell the community about your changes :)

The player's community is always happy to know that someone is taking care of their preferred game :)

If your are the developer of game XXXX, you are also the administrator of player's group "XXXX's players", and you can publish some news in this group newsfeed.

When you fix a bug or add something, do not hesitate to tell the players about this in this group: you'll get the "thank you" you deserved :)

See for example Werewolves group: https://boardgamearena.com/group?id=2465913

Major changes

If you do some major changes to your game like:

  • Introducing a new expansion.
  • Major code rewriting/refactoring.

... please tell us. In this case, we can:

  • Make your game back from "gold" to "public beta", to incite player to report bugs.
  • And eventually, publish a news about it :)

Avoiding version mismatches

Be advised about the timing of deployments: Your new PHP backend code takes effect immediately, but your new JS/HTML/CSS frontend code does not take effect unless current players reload the page (F5). This can lead to unexpected behavior and difficult-to-reproduce bugs caused by old JS client code interacting with new PHP server code.

Until the BGA framework handles this automatically for everyone (please upvote https://studio.boardgamearena.com/bug?id=106), your game should definitely implement something like BGA Studio Cookbook#Force players to refresh after new deploy.