Syncing Google Sheet data to/from GameSalad Tables

tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,944
edited September 2019 in Working with GS (Mac)

So this is exciting news. After years of customers struggling to get the network behaviors to work and the downfall of AppFormative and the failed promise of other entrepreneurial folks offering similar services, @adent42 pops in with a casual "here ya go" and gives us a way to do this fairly simply:

https://forums.gamesalad.com/discussion/comment/611542/#Comment_611542

If you can't tell, I have mixed feelings about this but on the whole, I'm thrilled. I have an app that's been needing this to take it to the next level and if this works... OH MAN.

So thank you @adent42. I'm giving this a separate thread so it doesn't get buried and also in the hopes that the process will benefit from additional eyes and minds.

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Comments

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 1,927

    To be fair, I only discovered this was possible fairly recently :)

    I would also warn that there are limits to what google will allow (it is free after all), so I wouldn't go using this for anything big. This is best for either internal apps or apps that occasionally pull and data for updates.

    If you you are strictly pulling data, you may be able to proxy the results behind cloudflare to scale for bigger games (i.e. you use google docs for notifications or core game stats that only need occasional changing).

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,944

    Thanks, this is a pretty infrequent use... probably once a year to update an app's tables. :)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • solnikasolnika Member Posts: 57

    Hello all,

    I have a few questions about the google sheet solution.

    I mange to sent a table from the game to the sheet but I couldn't figure how to get a table from the sheet to the game (the viewer crash every time).

    I understand from anther post that I need to change the tableID in the script for the table I want to send? but I don't really know where to edit this? @adent42 @tatiang any advice on that?

    Also I tried to look at the limits that the free account has but I don't really know under what type of action to look?

    Basically I'm trying to figure out how many request I can make per hour/day maybe someone can help?

    Thanks in advance and sorry for my bad English

  • solnikasolnika Member Posts: 57

    P.S

    I named my table "test" but on the sheet it shows as "id357792" is this how it suppose to be?

  • solnikasolnika Member Posts: 57

    Hi again, so I figure the answer to my first question, ?table="tableID" needs to be add at the end of the HTML string in the network beaver.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,944
    edited November 2019

    @solnika said:
    Hi again, so I figure the answer to my first question, ?table="tableID" needs to be add at the end of the HTML string in the network beaver.

    I haven't looked at this in a while but I believe that's right.
     

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • solnikasolnika Member Posts: 57

    Yep it's working, thanks.

    Any ideas about the limits?
    Also did you mange to figure how to post/add only one line ?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,944
    edited November 2019

    No, I haven't done any more with it.

    I did attempt to but got nowhere fast.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • solnikasolnika Member Posts: 57

    @tatiang Hi, I can't answer in the pro section so I'm answering here.

    I played with it a little and mange to add 1 row to google sheet without override existing rows, that was what I needed and it was simple to do I just edited the script to create a new row and then post the table (1 row).

    I'm a bit concerned with using google sheet as I don't understand their limit system and it doesn't seems there is a way to buy more usage .

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,944

    @solnika Sorry about that. I moved the thread to this category so you should have access now:

    https://forums.gamesalad.com/discussion/97487/current-server-options-august-2019#latest

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 1,927

    As an FYI, it looks like google script apps can handle only 30 simultaneous connections.

  • solnikasolnika Member Posts: 57

    @adent42 What does it mean; "30 simultaneous connections"?
    Can you please give example how it affect the use of gamesalad network with google sheet?

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 1,927

    So a connection is a single request to google sheets as long as that last (usually a few 100ms). So if 30 people hit your google sheet at literally the same time, then the 31st person will get an error.

    What this means for your app depends on how often people need to access it. If it's just a background update or a pre game start update, it's fine since you can just keep retrying until they can get the data. But if you're polling the system in a multiplayer turn based game, then it could mean you have too many people polling and some will get errors.

    If your game is mostly pulling data, I would put it behind a proxy or a CDN (i.e. another service that caches the response). That would reduce the load to google sheets and let you scale up. Only the proxy server would hit your google sheet and everyone else would be pulling data from the proxy server.

    The next thing to consider is to create your own service using the javascript code in the gist i provided. Following that you can use it in another service like Amazon Lambda or Google Firebase Cloud Functions to process an incoming table and do stuff with it there.

  • solnikasolnika Member Posts: 57

    Thank you very much for the info, I need to do a deep research and learn this staff can't get off easy here.

    Thanks again

  • solnikasolnika Member Posts: 57

    Hello all,

    So I'm facing a problem, every time that the script fails it causes the app to crash.

    I started with calling the script every 1s from two iphones and the app would crashes on one of the phones after a minute or two, so I played with the lock time (increasing it to 2500) which worked for my tests even with 3 phones.

    I can't really tell why it made a different and what made it to crash so much any insight? @adent42 ?

    However I did at one point got for several minutes an error (caught it from trying to run the script from the script editor);

    Lock timeout: another process was holding the lock for too long

    Obviously it also crashes when reached the limit which I guess it's the 50k read/write;

    error Service invoked too many times for one day: properties get. at unknown function

    If anybody @adent42 maybe you can take a look? can help solve the script crashing the app on error problem it will be highly appreciate.

    Thanks and happy holiday all

Sign In or Register to comment.