This is a documentation for Board Game Arena: play board games online !
Tools and tips of BGA Studio : diforc'h etre ar stummoù
Diverradenn ebet eus ar c'hemm |
|||
Linenn 68: | Linenn 68: | ||
== Desktop/Client Tools and Tips == | == Desktop/Client Tools and Tips == | ||
=== | === 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: | ||
Linenn 83: | Linenn 96: | ||
<property name="globs">*.html;*.htm;*.tpl</property> | <property name="globs">*.html;*.htm;*.tpl</property> | ||
</pre> | </pre> | ||
=== 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 -deplay 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. | |||
You can also sync on demand (from a build script or editor command) using | |||
rsync -vlrt $LOCAL/$GAME/ $REMOTE/$GAME | |||
=== Version Control === | |||
Studio providers svn for you code on server, however there is no way to access history, restore or do anything | |||
with it unless you ask admins. If you want to keep your code in another repository. I suggest to use git with local repo, which you can sync to cloud or backup. | |||
=== 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. | |||
=== 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 time is 600x600 PNG file with every time in separate file. You want .jpg instead of .png to make it not like 20Mb, all images in one column with size 128x128 | |||
/usr/bin/montage `ls Tiles*.png` -tile 1 -geometry 128x128+0+0 ../out/tiles128.jpg |
Stumm eus an 29 Gou 2016 da 03:17
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)
Desktop/Client Tools and Tips
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 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 -deplay 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.
You can also sync on demand (from a build script or editor command) using
rsync -vlrt $LOCAL/$GAME/ $REMOTE/$GAME
Version Control
Studio providers svn for you code on server, however there is no way to access history, restore or do anything with it unless you ask admins. If you want to keep your code in another repository. I suggest to use git with local repo, which you can sync to cloud or backup.
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.
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 time is 600x600 PNG file with every time in separate file. You want .jpg instead of .png to make it not like 20Mb, all images in one column with size 128x128
/usr/bin/montage `ls Tiles*.png` -tile 1 -geometry 128x128+0+0 ../out/tiles128.jpg