loading

If you see this message, it means that your browser failed to load this file.

You should try the following : check your connection, disable ad-blocker, clear your browser cache, try in private mode, try from another browser/computer/connection.

Home »
BGA Studio
(for web developers)

• You are a web developer fluent in server side (PHP, SQL) and client side (HTML, Javascript) languages

So this presentation looks easy and fun to you.

• You want full access to the BGA development stack to develop complex games (but we still advise you to start with something simple for your first game!)

Check the documentation and tutorials to get started!

What is BGA Studio?


Getting started

4 slideshare presentations to get ready to use BGA Studio in 30 minutes:

Reference Documentation

This page comes from BGA wiki, and has been written by BGA players community. Feel free to edit it!

Game File Reference

Overview



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

Bga studio small.jpg

Note: Please DO NOT translate Studio Documentation, so that there can be one place where you can find the latest information available.

What is Board Game Arena Studio?

Board Game Arena Studio is a platform to build online board game adaptations using the Board Game Arena platform.

It is open to any gamer with software development skills :)

BGA Studio website: http://en.studio.boardgamearena.com

Original announcement on BGA forum: http://forum.boardgamearena.com/viewtopic.php?f=10&t=1973

How to join the BGA developer team?

Please see this page: How to join BGA developer team?

Great, I'm in! ... How should I start?

If you didn't already, check the presentations at the top of this page to get the basics.

Then, you should checkout the First steps with BGA Studio to make sure that runs fine.

After that, we strongly advise you to take one of these game creation tutorials:

Then start editing files and see what happens! ;)

Once you're done with tutorials, you can start a real game (or join existing project)

If you have any questions, please check out the Studio FAQ first, then if you didn't find the answer you were looking for, please post your question on the development forum.

BGA Studio documentation

BGA Studio Framework reference

This part of the documentation focuses on the development framework itself: functions and methods available to build your game.

File structure of a BGA game

Game logic (Server side)

Game interface (Client side)

Other components


BGA Studio game components reference

Game components are useful tools you can use in your game adaptations.

  • Deck: a PHP component to manage cards (deck, hands, picking cards, moving cards, shuffle deck, ...).
  • Counter: a JS component to manage a counter that can increase/decrease (ex: player's score).
  • 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)

  • Draggable: a JS component to manage drag'n'drop actions.
  • ExpandableSection: a JS component to manage a rectangular block of HTML than can be displayed/hidden.
  • Wrapper: a JS component to wrap a <div> element around its child, even if these elements are absolute positioned.

Reference for classes in game class hierarchy

  • Table: a PHP class that you inherit from for the game php

BGA Studio user guide

This part of the documentation is a user guide for the BGA Studio online development environment.

Lifecycle


Tools and Advice

Sharing

Login


Please remember me




Join the BGA Studio developers team

To start developing on BGA Studio and get access to development environment, you need to create an account below.

Personal infos provided in this form is NOT shown to anyone but BGA Studio admin, and is NOT used for any other purpose that BGA Studio organization.




(Must be valid. We may remove accounts from developers we can't contact.)




(3 to 20 characters. No space, no number, no special characters)




(The exact username you are using on BGA)




Important: we need your REAL name to attribute your work on the Studio & to send you stuff by Post when needed.




Important: we need your REAL name to attribute your work on the Studio & to send you stuff by Post when needed.





Please enter the security code you see
???


I agree to the Terms & Conditions for developers on BGA Studio.


Register


Looking for a trigger after logs are loaded

I've got a function that will pretty up the logs a little. Ultimately, it adds HTML elements into the output display of the logs without cluttering up the logs on the back end.

I'm quite impressed with how well it works, but the trouble is the setup function is called BEFORE the logs are loaded. So calling it from setup results in absolutely nothing happening.

The first solution I can think of is starting a timer and then calling the function after an arbitrary length of time. Trouble is, too little time and the function could call before the logs are displayed. Too long and the beautification is laggy.

The next solution was maybe imbedding script tags into the first log, and calling it from there. I haven't tried that yet, so I don't know whether or not there is security protocol specifically designed to stop me doing stuff like that. Maybe there is. Also, writing script into a log feels a bit inelegant. (Also, if it runs the risk of executing while someone is browsing my logs from a different system, and maybe doing damage unintentionally if there's a namespace clash.)

The third solution, and probably the one I'll end up using if no one can think of something cleaner, is to just write the pretty html directly into the logs. Still a bad solution, but the least bad available.

What other solutions are there? The ultimate solution would be finding a way to have my function trigger as soon as the logs have loaded.
08/02/2021 4 comments

First actions are missing from In-Game Replay

Hi. I encounter a situation where the first actions are missing from the in-game replay mode. This can leads to missing information for turn based game mode.

It's related to a bug report on splendor's module : https://boardgamearena.com/bug?id=43474.
Despite It looked like to work fine initially, I would says finally it's reproductible 50% (or 1/$nb_players % ;p).

What happens :
- the very first notifications are missing from the replay

How to reproduce it :
:arrow: Starts a game in 2 players, it's important (don't know why) to remember who is table creator / admin.
:arrow: The first player performs it's first action which adds some simple message in the gamelog through NotifyAllPlayers() API
:arrow: The first player actions is listed in the second player gamelog (expected behavior)

:!: When the second player requests a replay from the very first move (through Replay From This Move button in the game logs, linked to url like https://studio.boardgamearena.com/1/abo ... er=2310418), then the first move is missing from the gamelog.

Unfortunately (or not), I was able to reproduce this issue each time the first player is the table creator/admin. :?
When the second player to join the table is the starting player, it works fine... :shock:

I was able to produce a dedicated project from scratch which reproduces this issues (100% success based on luck of starting player).
You can get access through https://studio.boardgamearena.com/gamepanel?game=above

There is really not big change from the template projects : add some empty actions and minimal statemachine and run the game.
08/01/2021 Comment on this

My template works, but I think I'm doing it the wrong way

The documentation is very clear on how to use a code block any number of times, and the technique works for any large number.

But it's not clear on the correct usage when the number can only range from 0 to 1.

The two player game is extremely unique, with a lot of HTML for the two player game. I need to show that HTML once in a 2 player game, or zero times in a 3-6 player game.

.tpl

CODE: Select all

<!-- BEGIN game2p -->
//20 lines of HTML, including a nested code block with another code block inside that
<!-- END game2p -->
.view.php

CODE: Select all

if($players_nbr == 2){
    $this->page->begin_block( "name_name", "innerBlock" );
    $this->page->begin_block( "name_name", "outerBlock" );
    $this->page->begin_block( "name_name", "game2p" );
    for($i = 1; $i <=4; $i++){
        $this->page->reset_subblocks( 'innerBlock' );
        for( $j=1; $j<=4; $j++ ) {
            $this->page->insert_block( 
                "innerBlock", array(
                    //args
                )
            );
        }
        $this->page->insert_block(
            "outerBlock", array(
                //args
            )
        );
    }
    $this->page->insert_block(
        "game2p", array()
    );
} else {
    $this->page->begin_block( "name_name", "game2p" );
}
So it all runs... fine. It does exactly what I intended it to do. But it feels... improper. Like anyone reading through my code would be left scratching their head saying "what is... oh I see, but why didn't you do it the NORMAL way?"

Is there a normal way? Or was that it?

The BGA documentation is literally the only thing I know about .tpl files. I know absolutely nothing about them outside of what's written there.

Thanks in advance

Edit:

Attempt 2, not sure if the code just got more proper or less proper:

.view.php

CODE: Select all

$this->page->begin_block( "name_name", "innerBlock" );
$this->page->begin_block( "name_name", "outerBlock" );
$this->page->begin_block( "name_name", "game2p" );
if($players_nbr == 2){
    for($i = 1; $i <=4; $i++){
        $this->page->reset_subblocks( 'innerBlock' );
        for( $j=1; $j<=4; $j++ ) {
            $this->page->insert_block( 
                "innerBlock", array(
                    //args
                )
            );
        }
        $this->page->insert_block(
            "outerBlock", array(
                //args
            )
        );
    }
    $this->page->insert_block(
        "game2p", array()
    );
} else {
    //3+ player code
}
07/23/2021 1 comment


Application loading... ...
THANK YOU : You are one of our most loyal players!
Get the best from Board Game Arena for only €2 / month.
1
2
3
4
5
6
7
8
9
10
11
12