I got asked about how you maintain live data connections to many opponents at the same time. What is the looping stratergy to iterate over multiple records and setup everything in construct 2? Here is the best solution I came up with:
place each JSON player record as a child of "/users/" in your Firebase e.g.
/users/fred/
/users/john/
Create a container object in construct two that associates all the separate graphical elements together (like the label that displays the name). Mine is ui_card, and ui_name, ui_status etc. This example was for a lobby, hence the construct 2 GUI elements were fairly boring sounding objects.
We will use RexRainbow's HashTable (https://www.scirra.com/forum/viewtopic.php?t=65765&start=0) to parse JSON objects coming back from Firebase.
Now to keep all players game objects synced we maintain a list of player data by:
1. register a *child_added* callback to Firebase ref("/users"). This will get called every time a new record is available (including for initialization)
2. create the child_added callback.
2a Create the construct 2 container and register its UID into a player_list dictionary (handy for name lookups later).
2b register a *value* callback on the specific player's record
3. create the callback for when the value of a specific player's record changes. When a networked player's data changes you can load the new data into your graphical representation so it affects the game world immediately.