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

First steps with BGA Studio: Difference between revisions

From Board Game Arena
Jump to navigation Jump to search
m (Main site update: menu is now a hamburger not a gear)
(38 intermediate revisions by 18 users not shown)
Line 1: Line 1:
== Connect to your SFTP folder and to the BGA Studio website ==
{{Studio_Framework_Navigation}}


After your account has been created, you will get by email:
== Connect to the BGA Studio website ==
 
Go to BGA Studio website:
http://studio.boardgamearena.com
 
Use your first dev account (ex: myusername0, password was sent in welcome email), and login into the website - as you would do for Board Game Arena.
 
If you don't have account see [[How to join BGA developer team?]]
 
== Create a new game project ==
 
You can do most of the projects-related operations from "Control Panel / Manage games". In particular, you can create a new project automatically from there.
 
Your first "game" should be one of the tutorials, so your project name should be something like "tutorialbob".
 
At this stage it is too early to create a real game but if you really don't want to start until you have a game in mind, check [[Create a game in BGA Studio: Complete Walkthrough]]
section "Select a First Game"
 
For reference top bar studio links
* AVAILABLE LICENSES - list of all available licenses (not public domain) -  https://studio.boardgamearena.com/licensing
* STUDIO PROJECTS - list of all registered studio projects - https://studio.boardgamearena.com/projects
* CONTROL PANEL - manage projects - https://studio.boardgamearena.com/controlpanel. <br>Note: the control panel is accessible from the player popup menu (top right), with the gear and bargraph blue icon next to the player icon.
 
== Connect to your SFTP folder ==
 
From the initial email from the Studio you get:
* the name of the SFTP server to connect to
* the name of the SFTP server to connect to
* your SFTP login and password
* your SFTP login and password
* ten BGA Studio logins ending with a numeral ranging from 0 to 9 and the password needed to use them.


Using this information:
# Connect to the SFTP server using your SFTP login and password, through your favourite SFTP client software (such as [http://winscp.net/ WinSCP], see [[Tools_and_tips_of_BGA_Studio#File_Sync_on_Windows|File Sync]])
# Check that your remote home folder contains one folder for two example games (reversi, hearts). If you have already created a new game project, one additional folder should be in your "home" folder.
# Note: You have to setup AUTOMATED sync between your folder and remote folder, manually ftp'ing files would be no-starter. For WinSCP you can do this from the file menu (Commands->Keep remote directories up to Date...)
# Note: You can also upload your ssh key via studio control panel to avoid password exchange


Using this information:
== Let's code! ==
# Connect to the SFTP server using your SFTP login and password, through your favourite SFTP client software (such as WinSCP for example)
# Check than in your home folder you have:
#* One folder for each of the three example games (reversi, hearts, gomoku)
#* One folder matching the game you will be developing
#* One 'resources.html' file
# Open the resources.html file, it contains
#* The URL pointing to the BGA Studio website (protected with an HTTP Basic authentication scheme, the login and password are also referenced in the 'resources.html' file
#* The URL pointing to the BGA Studio backoffice (please note that you must first be logged in on the BGA Studio website to be able to access the backoffice, as the authentication is shared between the two)
#* The URL pointing to the web administration tool for the BGA Studio database.
# Click on the URL to the BGA Studio website, enter the HTTP Basic credentials when prompted for them (and have your browser conveniently memorize them for you). Then you get to an home page just like the one of the main BGA website. Enter one of your ten BGA studio logins to connect as a user.


Now, you can try to launch a new game on BGA Studio from the "Play now" menu entry, as you would do on Board Game Arena website.


== Launch your game and check how to update it ==
# To launch your game from Studio go to CONTROL PANEL -> Manage games -> <your_game> -> <your_game_page> -> Play (see how to access control panel above)
# Find your game in the 'Play now' section and launch a table
# Press Create to create a table
# Use the 'I want between X and X' players to tick down the maximum players number to the minimum
# Select number of players and select Training mode in game configuration panel
# Click 'Express start': your game launches with the maximum number of players specified. It shows an empty canvas: in the game zone you just have a sentence 'This is your game interface. You can edit this HTML in your ".tpl" file.'.
# Click '''Express start'''. Do not use "Start game" buttons in studio - it adds unnecessary complexity of logging it from multiple accounts. When using '''Express start''' your game launches with the maximum number of players specified using your own dev player accounts (dev0, dev1, dev2, etc). If you don't see '''Express start''' button make sure you are in Manual mode for game creation.
# Switch to your SFTP home folder, go into your game folder. Edit the game_game.tpl file, and change this sentence to 'Hey, this is my first game!', then save.
# Game will open with an empty canvas: in the game zone you just have a sentence 'This is your game interface. You can edit this HTML in your ".tpl" file.'.  
# Switch to your SFTP home folder, go into your game folder. Edit the game_game.tpl file, and change this sentence to 'Hey, this is my first game!', then save (this assumes you mount or sync the folder).
# Go back to your browser and refresh, check that the game zone has updated.
# Go back to your browser and refresh, check that the game zone has updated.
# Click on the 'Exit game' icon on the top right, and in the popup choose 'Express game stop'. The game ends automatically and you are brought back to the table screen for this ended game.
# Click the red arrow next to a test account's name in the player panel to view the game from that player's account <br/>[[File:Change_active_player.jpg]]
# Switch to your game folder, go into the img folder and overwrite your game_box.png file with another image.
# Open the menu (three-line "hamburger" icon at the upper right) and choose 'Express STOP'. The game ends automatically and you are brought back to the table screen for this ended game.
# Go back to your browser, '''empty your browser cache''', then refresh the page, and check that the game box image has been updated.
 


Then you can modify the provided skeleton and begin to develop your game :)


== Commit your changes ==
== Commit your changes ==


Committing uploads your changes on our [http://en.wikipedia.org/wiki/Revision_control revision control] system. This is an extra assurance not to lose your code, and to have the possibility (by asking BGA administrators) to get a previous version of your code if you need to backtrack. It also helps us to follow your progress (we get an email when you commit). So you should commit from time to time, when you hit some landmark in your development.
Committing uploads your changes on BGA's [http://en.wikipedia.org/wiki/Revision_control revision control] system. This is an extra assurance not to lose your code, and to have the possibility to get a previous version of your code if you need to backtrack. It also helps us to follow your progress (we get an email when you commit). So you should commit from time to time, when you hit some landmark in your development.
 
You can automatically commit your sources in the repository from "Control Panel / Manage Games / Your game / Commit my modifications now". Then:


Here is how to go through your first commit:
# Enter your commit comment (such as 'My first commit') then hit the 'Submit' button;
# Go back to your browser tab showing the 'resources.html' file. Click on the URL pointing to the BGA Studio backoffice (do not log out of the BGA Studio website before doing so, or you will get a '''Not authorized''' error message as the authentication is shared);
# Click on the 'Sources' menu entry to show the commit form. Enter your game name (under the same form as the name of your game folder: lowercase, no spaces), enter your commit comment (such as 'My first commit') then hit the 'Submit' button;
# Check the log for errors, it should end with the following lines:
# Check the log for errors, it should end with the following lines:


Line 44: Line 66:
   HAL says: done.
   HAL says: done.


NB: you should also commit each time you make an change to your gameoptions.inc.php file or to your stats.inc.php file, as an extra deployment action is needed from us for these files to take effect. Please mention in your commit comment that you need us to deploy those files, or send us an email to ask us to do it.
NOTE: committing the code is currently not working until admin commits it manually the first time. Even if it does you cannot automatically deal with this version control system except for committing. Therefore its recommended to use another means of storing the code in version control system, such as local git repo or github, see [[Tools_and_tips_of_BGA_Studio#Version_Control|Version Control]]
 


== That's all! ==
== That's all! ==
Line 51: Line 72:
Now you know about the basics of updating your game on BGA Studio and testing your changes.
Now you know about the basics of updating your game on BGA Studio and testing your changes.


For more information on the specifics of each file, please check out the [[Studio#BGA_Studio_documentation | reference documentation for the framework]].
Now you can select one of the tutorials to play with and start coding.
 
For links to tutorials and ALL studio documentation see [[Studio]].
 
[[Category:Studio]]

Revision as of 17:01, 25 January 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

Connect to the BGA Studio website

Go to BGA Studio website: http://studio.boardgamearena.com

Use your first dev account (ex: myusername0, password was sent in welcome email), and login into the website - as you would do for Board Game Arena.

If you don't have account see How to join BGA developer team?

Create a new game project

You can do most of the projects-related operations from "Control Panel / Manage games". In particular, you can create a new project automatically from there.

Your first "game" should be one of the tutorials, so your project name should be something like "tutorialbob".

At this stage it is too early to create a real game but if you really don't want to start until you have a game in mind, check Create a game in BGA Studio: Complete Walkthrough section "Select a First Game"

For reference top bar studio links

Connect to your SFTP folder

From the initial email from the Studio you get:

  • the name of the SFTP server to connect to
  • your SFTP login and password

Using this information:

  1. Connect to the SFTP server using your SFTP login and password, through your favourite SFTP client software (such as WinSCP, see File Sync)
  2. Check that your remote home folder contains one folder for two example games (reversi, hearts). If you have already created a new game project, one additional folder should be in your "home" folder.
  3. Note: You have to setup AUTOMATED sync between your folder and remote folder, manually ftp'ing files would be no-starter. For WinSCP you can do this from the file menu (Commands->Keep remote directories up to Date...)
  4. Note: You can also upload your ssh key via studio control panel to avoid password exchange

Let's code!

Now, you can try to launch a new game on BGA Studio from the "Play now" menu entry, as you would do on Board Game Arena website.

  1. To launch your game from Studio go to CONTROL PANEL -> Manage games -> <your_game> -> <your_game_page> -> Play (see how to access control panel above)
  2. Press Create to create a table
  3. Select number of players and select Training mode in game configuration panel
  4. Click Express start. Do not use "Start game" buttons in studio - it adds unnecessary complexity of logging it from multiple accounts. When using Express start your game launches with the maximum number of players specified using your own dev player accounts (dev0, dev1, dev2, etc). If you don't see Express start button make sure you are in Manual mode for game creation.
  5. Game will open with an empty canvas: in the game zone you just have a sentence 'This is your game interface. You can edit this HTML in your ".tpl" file.'.
  6. Switch to your SFTP home folder, go into your game folder. Edit the game_game.tpl file, and change this sentence to 'Hey, this is my first game!', then save (this assumes you mount or sync the folder).
  7. Go back to your browser and refresh, check that the game zone has updated.
  8. Click the red arrow next to a test account's name in the player panel to view the game from that player's account
    Change active player.jpg
  9. Open the menu (three-line "hamburger" icon at the upper right) and choose 'Express STOP'. The game ends automatically and you are brought back to the table screen for this ended game.


Then you can modify the provided skeleton and begin to develop your game :)

Commit your changes

Committing uploads your changes on BGA's revision control system. This is an extra assurance not to lose your code, and to have the possibility to get a previous version of your code if you need to backtrack. It also helps us to follow your progress (we get an email when you commit). So you should commit from time to time, when you hit some landmark in your development.

You can automatically commit your sources in the repository from "Control Panel / Manage Games / Your game / Commit my modifications now". Then:

  1. Enter your commit comment (such as 'My first commit') then hit the 'Submit' button;
  2. Check the log for errors, it should end with the following lines:
 Transmitting file data .
 Committed revision #revision number#.
 HAL says: done.

NOTE: committing the code is currently not working until admin commits it manually the first time. Even if it does you cannot automatically deal with this version control system except for committing. Therefore its recommended to use another means of storing the code in version control system, such as local git repo or github, see Version Control

That's all!

Now you know about the basics of updating your game on BGA Studio and testing your changes.

Now you can select one of the tutorials to play with and start coding.

For links to tutorials and ALL studio documentation see Studio.