Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411480 Posts in 69369 Topics- by 58426 Members - Latest Member: shelton786

April 23, 2024, 09:32:56 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Technical Devblog: GameSparks vs PlayFab, Node.js vs Vanilla JS, Mistakes+Fixes
Pages: [1]
Print
Author Topic: Technical Devblog: GameSparks vs PlayFab, Node.js vs Vanilla JS, Mistakes+Fixes  (Read 3315 times)
Xblade724
Level 0
*



View Profile WWW
« on: July 22, 2016, 01:02:47 AM »

(EDIT: Sorry - I'm new here .. I almost posted this in 'tutorials', but technical seemed to be more relative - move me if need Panda)

Hi, I'm Dylan/Xblade, founder of Imperium42 Game Studio and developer of the Throne of Lies: The Online Game of Lies and Deceit (whew, long name) project for PC, Mac and Linux with Unity/C#. While developing the website with BaaS integration, I learned a lot of things over the past few months, leading up to a 3-minute audio recording:





For those that prefer text, here are the highlights:

Usually our devblogs are much lighter, but this one is aimed towards my fellow indie devs!

I tried both PlayFab and GameSparks. In the end, I'm calling PlayFab the winner -- but barely!:

1. GameSparks is more polished and has more flexibility, however PlayFab won by updating weekly (BIG updates, not just "misc fixes"), having an integrated password/email recovery system with 1 line of code, having fantastic recipes and demos, and having a **working** nodeJS SDK (more explained below)

2. (GameSparks techs are great -- except for this subject. It's unfortunate that they couldn't resolve even the basic setup about their own password hashing mechanics for Node. The docs didn't match the basic setup of "Vanilla" JS. I have a feeling their Node SDK was outsourced). Don't get me wrong, **both GS and PF are fantastic**, but if I can't get the basic setup working, the docs don't tell me, and the techs can't resolve it, how am I expected to resolve it Wink

On your website, DON'T USE ANY JAVASCRIPT SDK WITH A SECRET - Use Node and Ajax to call it:

1. This was discovered too late, after I had already coded it. Not just already coded it, but I coded my own Ajax API, realized they had an SDK then replaced with SDK, then before releasing the version with the SDK I realized that the secret key was exposed (in both PlayFab and GameSparks -- this is normal, don't worry).

2. So to resolve it? Ditch the JS sdk and ONLY use Node. Send an Ajax call to the node PF/GS SDK, process it, and send back the response.

So.. What did I learn?

1. As soon as you start getting live customers, stick with your BaaS you chose and don't look into switching to save yourself headache (although it may be a good experience to know both -- if you can spare the time. I'd love to have my next game with the competitor for a learning experience). Both GS and PF are amazing, just choose your flavor and stick with it (like Chrome vs Firefox). If you can get Node working for GS - maybe later.

2. For pretty much ALL your API's, look into NodeJS SDK's instead and ditch your vanilla JS for security so your secret keys aren't exposed. Don't get hacked like everyone else out of laziness. I barely knew Node but I learned it in a few weeks (Google "node express minimal tutorial 2016". Express THEMSELVES have a great guide, believe it or not -- usually overdetailed, but it's really not).

3. Don't forget, anything you code on your website for your BaaS will have knowledge applied for your coding in Unity or other SDK. It's good practice, regardless.
« Last Edit: July 22, 2016, 01:40:01 AM by Xblade724 » Logged

Founder/Developer of Imperium42 and Throne of Lies: The Online Game of Lies and Deceit 
quantumpotato
Quantum Potato
Level 10
*****



View Profile WWW
« Reply #1 on: July 28, 2016, 02:16:30 PM »

Hey thanks for sharing this!
I'm curious - did you consider rolling your own backend? How much time did a BAAS save you?
Logged

Xblade724
Level 0
*



View Profile WWW
« Reply #2 on: July 30, 2016, 07:28:22 AM »

Hey thanks for sharing this!
I'm curious - did you consider rolling your own backend? How much time did a BAAS save you?

TL;DR = Yes, I thought about it, but no - it was 100% not the answer:

Heya -- It was a firm choice between PlayFab and GameSparks. I'm a big fan of not reinventing the wheel, when it comes to the basics. Similar to Bootstrap - may as well use something that's already free and easily available so you can focus more on your game.

One thing that's really diverted me is wanting a fully-functional website. Our website ( https://www.ThroneOfLies.com ) is fully integrated with our BaaS - and I swapped, then swapped BACK .... oops. Version mgmt for my website ended up being God-Tier ( GitHub / GIT ).

Also, I split off PlayFab and GameSparks functions into separate JS to make it easier - if I end up not using one, I can easily go back without 1000 comment-outs.

You still have to SORT OF have your own back-end though.. you need Node going to secure your API calls or someone can easily get your secret key and leach/modify your db. And speaking of which, cryptology is an entire different subject: That alone will take just as long as your own back-end, when it comes to research and figuring this all out, leading up to this moment:

DO NOT USE "VANILLA" JAVASCRIPT SDK'S OF ANY BAAS! Only node! I wasted quite a lot of time re-coding. Fortunately, it didn't take long to split it off easily for testing -- In the end, I used the JS SDK locally for testing, then forwarded it to node.js SDK 100% to return the result (I don't do anything fancy, just call and return), so it didn't avert things much. But yea, if you do anything with js sdk, your secret key is exposed. I realize I may be repeating myself, but trust me Wink
Logged

Founder/Developer of Imperium42 and Throne of Lies: The Online Game of Lies and Deceit 
quantumpotato
Quantum Potato
Level 10
*****



View Profile WWW
« Reply #3 on: August 16, 2016, 05:41:27 AM »

So you have a Node server that passes along requests to your BAAS?
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic