This is a documentation for Board Game Arena: play board games online !
Tools and tips of BGA Studio: Revizyonlar arasındaki fark
Victoria la (mesaj | katkılar) |
Victoria la (mesaj | katkılar) |
||
(2 kullanıcıdan 19 ara revizyon gösterilmiyor) | |||
1. satır: | 1. satır: | ||
== Starting a game in one click == | == Server Tools and Tips == | ||
=== Starting a game in one click === | |||
To start a game: | To start a game: | ||
6. satır: | 7. satır: | ||
* Click on "Express Start". | * Click on "Express Start". | ||
== Stopping a game in one click == | === Stopping a game in one click === | ||
* Click on the "quit" icon on the top right of the screen. | * Click on the "quit" icon on the top right of the screen. | ||
* Click on "Express Stop". | * Click on "Express Stop". | ||
== Switching between users == | === Switching between users === | ||
When running a game on Studio, you can use the little red arrow near each player's name to open a new tab with this player's perspective. | |||
== Access to game database == | === Access to game database and Logs === | ||
At the bottom of the game area, there is section without a title containing 3 useful links: | |||
== Save & restore state == | Go to game database • BGA request&SQL logs • BGA unexpected exceptions logs | ||
* "Go to game database" link is an immediate access to the PhpMyAdmin tool to view/edit the tables of the current game | |||
* BGA request&SQL logs - link to your studio PHP log - all tables, all severities. Anything you print using debugging and tracing functions from PHP and some framework logs | |||
* BGA unexpected exceptions logs - same log as above but only severity warning and higher | |||
See [[Practical debugging]] for more info about it. | |||
=== Save & restore state === | |||
Using links of this section, you can save the complete current (database) state of your game, then restore it later. | Using links of this section, you can save the complete current (database) state of your game, then restore it later. | ||
32. satır: | 41. satır: | ||
* when you "restore" a situation, the current browser page is refreshed to reflect the updated game situation, but you have to refresh you other tabs/pages manually. | * when you "restore" a situation, the current browser page is refreshed to reflect the updated game situation, but you have to refresh you other tabs/pages manually. | ||
== Input/Output debugging section == | === Input/Output debugging section === | ||
This section shows you: | This section shows you: | ||
40. satır: | 49. satır: | ||
Note: if you click on some notification title, you can resend it immediately to the user interface. | Note: if you click on some notification title, you can resend it immediately to the user interface. | ||
== Run PHP functions from the chat == | |||
=== Run PHP functions from the chat === | |||
On BGA Studio, you can directly run a PHP method from the table chat. | On BGA Studio, you can directly run a PHP method from the table chat. | ||
57. satır: | 67. satır: | ||
giveToActivePlayer(money,2) | giveToActivePlayer(money,2) | ||
== | === Stopping Hanging Game === | ||
'''Edit TPL''' | |||
If game is hanging and you cannot enter it to stop you can type this URL (replace 12345 with your table number), | |||
which should bring you to a place where you can stop it without entering: | |||
<nowiki>http://en.studio.boardgamearena.com/#!table?table=12345</nowiki> | |||
== Desktop and Web Tools == | |||
=== Code Editors and IDEs === | |||
==== Eclipse For PHP Developers ==== | |||
Eclipse PHP package can be starting point for development you need. You may also want to | |||
install Tern JS plugins to understand dojo style JS. All desktops. | |||
https://projects.eclipse.org/projects/tools.pdt | |||
==== Visual Studio Code ==== | |||
Microsoft Visual Studio Code is light weight IDE/Editor. All desktops. | |||
https://code.visualstudio.com | |||
==== Gedit (Ubuntu) ==== | |||
'''Edit TPL''' | |||
To edit TPL with HTML code highlightings in Gedit under Ubuntu: | To edit TPL with HTML code highlightings in Gedit under Ubuntu: | ||
73. satır: | 104. satır: | ||
<property name="globs">*.html;*.htm;*.tpl</property> | <property name="globs">*.html;*.htm;*.tpl</property> | ||
</pre> | </pre> | ||
=== File Sync === | |||
==== File Sync on Windows ==== | |||
Install [http://winscp.net/ WinSCP]. Map a remote directory to a local one and enable continuous sync (one way). You need SFTP password you get when you registered dev account. | |||
==== File Sync on Linux ==== | |||
* Option 1 - Nautilus (file manager) | |||
You can just use Nautilus "connect to a server" function with URL sftp://1.studio.boardgamearena.com | |||
Then you'll get a mounted local folder mapping your studio folder and you can use any editor you like without further need for sync. Downside - if connection goes down you cannot work on source code, no local copy. | |||
* Option 2 - sftp and rsync | |||
<pre> | |||
#!/bin/bash | |||
BASEDIR=`dirname $0` | |||
REMOTE=$BASEDIR/remote | |||
LOCAL=$BASEDIR/workspace | |||
GAME=mygamenamehere | |||
#mount remote | |||
fusermount -u $REMOTE #this unmounts dir | |||
echo LongDevPassword | sshfs -o password_stdin myusernamehere@1.studio.boardgamearena.com: $REMOTE | |||
#this starts auto-sync from local to remote mount | |||
killall lsyncd | |||
lsyncd -delay 1 -rsync $LOCAL/$GAME/ $REMOTE/$GAME | |||
</pre> | |||
This can be able run on startup, so you don't have to do anything manually. However sshfs is not very stable you | |||
have to kill and restart it sometimes. And remote goes away sometimes due to connection issues with studio. | |||
In this case its handy to have a local copy, which is what lsyncd for. | |||
You can also sync on demand (from a build script or editor command) using | |||
rsync -vlrt $LOCAL/$GAME/ $REMOTE/$GAME | |||
=== Debuggers === | |||
Browser is the best tool for JS/HTML5 debugging, see [[Practical debugging]] for details. | |||
=== Version Control === | |||
Studio providers svn for you code on server, there are some limited abilities there to see history and restore. I recommend to keep your code in another repository. I suggest to use git with local repo, which you can sync to cloud or backup. | |||
Other option is to host source code on github, if you do use this convention github.com/<yourname>/bga-<yourgame>. In such case make sure you don't post high-res publisher graphics only web resources, and post a separate license for graphics files. | |||
=== PHP CLI === | |||
Its handy to have php cli (command line) tools install to run php locally, so you can test some stuff without deployment cycle, or create some scripts that generate code or markup. | |||
=== Image Manipulation === | |||
==== ImageMagick ==== | |||
Handy set of image manipulation '''command line''' tools, useful to for example to stitch together bunch of images and re-size, to use as sprite (in Stock component for example). I.e. you got a graphics file from publisher where every tile is 600x600 PNG file in separate file. You want .jpg instead of .png to make it not like 20Mb, and combine all images in one column and re-size to 128x128: | |||
(Linux example) | |||
/usr/bin/montage `ls Tiles*.png` -tile 1 -geometry 128x128+0+0 out/tiles128.jpg | |||
https://www.imagemagick.org/script/download.php | |||
==== Gimp ==== | |||
GUI tool, very complex but will do ALL what you possibly need to do with game graphics | |||
https://www.gimp.org/ | |||
==== Shrinking ==== | |||
Shrink images without loss of quality https://tinypng.com/ or http://www.iloveimg.com/ | |||
==== PDF Scrabber ==== | |||
PDF Scraper - extract images from PDF file (i.e. game rulebook) - http://www.extractpdf.com/ | |||
==== Rename/Copy project ==== | |||
There is a script available in sharedcode project to do the renaming which can be called in command line if you have php command line installed. | |||
You need to have php clt (command line interface) installed, then you can download script and run it. | |||
https://github.com/elaskavaia/bga-sharedcode/blob/master/tools/bgaprojectrename.php | |||
Usage: | |||
php bgaprojectrename.php <originalProjectPath> <copyOfProjectRenamedPath> | |||
Example on how to call it in command line if you project name is "heartsmyproject" | |||
php7.0 git/bga-sharedcode/tools/bgaprojectrename.php remote/hearts/ remote/heartsmyproject/ | |||
==== BGA Workbench ==== | |||
PHP library providing tools to help manage BGA Studio projects including deployment and test utilities. https://github.com/danielholmes/bga-workbench | |||
== Client Tips == | |||
=== Speed up game re-loading by disabling Input/Output debug section === | |||
Development UI have few sections for debugging only, such as 'Input/Output debugging section'. Loading this data will significantly slow down | |||
your reload. I did some profiling and my reloading (i.e. F5) took 14 seconds, 12 of which it was dealing with loading this section. | |||
If you not using it you can disable it. In your JavaScript code, in the begging of 'setup' method add this code | |||
dojo.destroy('debug_output'); | |||
That should get rid of this section and overhead associated with loading it (it may have some other side-effects, I have not explored all of them) | |||
=== Speed up CSS development and layout === | |||
Syncing files to server and refreshing is relative fast but still can take up to 20 seconds which is annoying. | |||
If you working | |||
a lot on css/images/layout you can speed it up by coping html in some state of the game to your local folder. | |||
I.e. in your project folder create directory misc/ and save your html as misc/test.html and changing path to css to load from local disk (and it will load your images to from local disk as well). | |||
I.e. find something like | |||
<link rel="stylesheet" type="text/css" href="http://1.studio.boardgamearena.com:8081/data/themereleases/151226-1240/games/mygame/999999-9999/mygame.css"/> | |||
and replace with | |||
<link rel="stylesheet" type="text/css" href="../mygame.css"/> | |||
You project structure will look like this | |||
mygame | |||
img/ <-- your images | |||
mygame.css <-- your original css | |||
... | |||
misc/ | |||
test.html <-- your test html | |||
It is a bit tricky to save html exact state, if you do save as it also pulls all resources sometimes. |
14.50, 21 Mayıs 2018 itibarı ile sayfanın şu anki hâli
Server Tools and Tips
Starting a game in one click
To start a game:
- Create a new table with your game.
- If you want to play a game with 3 players, specify that you want a maximum of 3 players at this table.
- Click on "Express Start".
Stopping a game in one click
- Click on the "quit" icon on the top right of the screen.
- Click on "Express Stop".
Switching between users
When running a game on Studio, you can use the little red arrow near each player's name to open a new tab with this player's perspective.
Access to game database and Logs
At the bottom of the game area, there is section without a title containing 3 useful links:
Go to game database • BGA request&SQL logs • BGA unexpected exceptions logs
- "Go to game database" link is an immediate access to the PhpMyAdmin tool to view/edit the tables of the current game
- BGA request&SQL logs - link to your studio PHP log - all tables, all severities. Anything you print using debugging and tracing functions from PHP and some framework logs
- BGA unexpected exceptions logs - same log as above but only severity warning and higher
See Practical debugging for more info about it.
Save & restore state
Using links of this section, you can save the complete current (database) state of your game, then restore it later.
This is particularly useful when you want to develop a part of the game that is difficult to reproduce: you just have to save the situation just before, and then restore it until this part works fine.
We provide you 3 "slots": 1, 2 and 3. This way, you can save 3 different game situations.
Limits:
- the "restore" function does not work anymore when the game is over.
- a saved situation from a given table cannot be restored in another table.
- when you "restore" a situation, the current browser page is refreshed to reflect the updated game situation, but you have to refresh you other tabs/pages manually.
Input/Output debugging section
This section shows you:
- The AJAX calls made by your game interface to the game server. AJAX calls (outputs) begins with ">"
- The notifications received by your game interface. Notifications (inputs) begins with "<".
Note: if you click on some notification title, you can resend it immediately to the user interface.
Run PHP functions from the chat
On BGA Studio, you can directly run a PHP method from the table chat.
For example, if on your PHP you have this method:
function giveMoneyToPlayer($player_id, $amount) { ... }
You can call this method directly from the chat like this:
giveMoneyToPlayer(2564,2)
Note: this is not a real php statement, you cannot use self::, you cannot use ";" at the end and you cannot use quotes, if you need to pass a string skip the quotes, like this
giveToActivePlayer(money,2)
Stopping Hanging Game
If game is hanging and you cannot enter it to stop you can type this URL (replace 12345 with your table number), which should bring you to a place where you can stop it without entering:
http://en.studio.boardgamearena.com/#!table?table=12345
Desktop and Web Tools
Code Editors and IDEs
Eclipse For PHP Developers
Eclipse PHP package can be starting point for development you need. You may also want to install Tern JS plugins to understand dojo style JS. All desktops. https://projects.eclipse.org/projects/tools.pdt
Visual Studio Code
Microsoft Visual Studio Code is light weight IDE/Editor. All desktops. https://code.visualstudio.com
Gedit (Ubuntu)
Edit TPL To edit TPL with HTML code highlightings in Gedit under Ubuntu:
find gtksourceview directory in /usr/share, depending on your version (2.0, 3.0,...).
Here it's 3.0, then type in a terminal window:
sudo gedit /usr/share/gtksourceview-3.0/language-specs/html.lang
then find 'globs' section, and change:
<property name="globs">*.html;*.htm;*.tpl</property>
File Sync
File Sync on Windows
Install WinSCP. Map a remote directory to a local one and enable continuous sync (one way). You need SFTP password you get when you registered dev account.
File Sync on Linux
- Option 1 - Nautilus (file manager)
You can just use Nautilus "connect to a server" function with URL sftp://1.studio.boardgamearena.com Then you'll get a mounted local folder mapping your studio folder and you can use any editor you like without further need for sync. Downside - if connection goes down you cannot work on source code, no local copy.
- Option 2 - sftp and rsync
#!/bin/bash BASEDIR=`dirname $0` REMOTE=$BASEDIR/remote LOCAL=$BASEDIR/workspace GAME=mygamenamehere #mount remote fusermount -u $REMOTE #this unmounts dir echo LongDevPassword | sshfs -o password_stdin myusernamehere@1.studio.boardgamearena.com: $REMOTE #this starts auto-sync from local to remote mount killall lsyncd lsyncd -delay 1 -rsync $LOCAL/$GAME/ $REMOTE/$GAME
This can be able run on startup, so you don't have to do anything manually. However sshfs is not very stable you have to kill and restart it sometimes. And remote goes away sometimes due to connection issues with studio. In this case its handy to have a local copy, which is what lsyncd for.
You can also sync on demand (from a build script or editor command) using
rsync -vlrt $LOCAL/$GAME/ $REMOTE/$GAME
Debuggers
Browser is the best tool for JS/HTML5 debugging, see Practical debugging for details.
Version Control
Studio providers svn for you code on server, there are some limited abilities there to see history and restore. I recommend to keep your code in another repository. I suggest to use git with local repo, which you can sync to cloud or backup. Other option is to host source code on github, if you do use this convention github.com/<yourname>/bga-<yourgame>. In such case make sure you don't post high-res publisher graphics only web resources, and post a separate license for graphics files.
PHP CLI
Its handy to have php cli (command line) tools install to run php locally, so you can test some stuff without deployment cycle, or create some scripts that generate code or markup.
Image Manipulation
ImageMagick
Handy set of image manipulation command line tools, useful to for example to stitch together bunch of images and re-size, to use as sprite (in Stock component for example). I.e. you got a graphics file from publisher where every tile is 600x600 PNG file in separate file. You want .jpg instead of .png to make it not like 20Mb, and combine all images in one column and re-size to 128x128:
(Linux example)
/usr/bin/montage `ls Tiles*.png` -tile 1 -geometry 128x128+0+0 out/tiles128.jpg
https://www.imagemagick.org/script/download.php
Gimp
GUI tool, very complex but will do ALL what you possibly need to do with game graphics
Shrinking
Shrink images without loss of quality https://tinypng.com/ or http://www.iloveimg.com/
PDF Scrabber
PDF Scraper - extract images from PDF file (i.e. game rulebook) - http://www.extractpdf.com/
Rename/Copy project
There is a script available in sharedcode project to do the renaming which can be called in command line if you have php command line installed. You need to have php clt (command line interface) installed, then you can download script and run it.
https://github.com/elaskavaia/bga-sharedcode/blob/master/tools/bgaprojectrename.php
Usage:
php bgaprojectrename.php <originalProjectPath> <copyOfProjectRenamedPath>
Example on how to call it in command line if you project name is "heartsmyproject"
php7.0 git/bga-sharedcode/tools/bgaprojectrename.php remote/hearts/ remote/heartsmyproject/
BGA Workbench
PHP library providing tools to help manage BGA Studio projects including deployment and test utilities. https://github.com/danielholmes/bga-workbench
Client Tips
Speed up game re-loading by disabling Input/Output debug section
Development UI have few sections for debugging only, such as 'Input/Output debugging section'. Loading this data will significantly slow down your reload. I did some profiling and my reloading (i.e. F5) took 14 seconds, 12 of which it was dealing with loading this section. If you not using it you can disable it. In your JavaScript code, in the begging of 'setup' method add this code
dojo.destroy('debug_output');
That should get rid of this section and overhead associated with loading it (it may have some other side-effects, I have not explored all of them)
Speed up CSS development and layout
Syncing files to server and refreshing is relative fast but still can take up to 20 seconds which is annoying. If you working a lot on css/images/layout you can speed it up by coping html in some state of the game to your local folder. I.e. in your project folder create directory misc/ and save your html as misc/test.html and changing path to css to load from local disk (and it will load your images to from local disk as well). I.e. find something like
<link rel="stylesheet" type="text/css" href="http://1.studio.boardgamearena.com:8081/data/themereleases/151226-1240/games/mygame/999999-9999/mygame.css"/>
and replace with
<link rel="stylesheet" type="text/css" href="../mygame.css"/>
You project structure will look like this
mygame img/ <-- your images mygame.css <-- your original css ... misc/ test.html <-- your test html
It is a bit tricky to save html exact state, if you do save as it also pulls all resources sometimes.