Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Server communication

Author
Message
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 21st Nov 2017 09:38 Edited at: 21st Nov 2017 09:50
Hi all,

Can anyone recommend (via having used it themselves) the best method of communication between an AppGameKit app and a centralised server of some kind? For example, if players were able to interact with a server to add/remove/edit data from a server. What I'm after is sort of a post/get method such as accessing a MySQL server or something similar. Think creating logins and such. All in Tier 1, though - I know Tier 2 can pretty much just bring in whatever you want.

I've made this work before by placing PHP files on a server which can then execute calls to access a MySQL database on that same server, and then fire off the PHP files using HTTP calls to access the file on the server and pass in data as required, but this method is a total hacky kludge and it's slow and insecure I hate it. I'm certain that there must be a cleaner, faster and more secure way to achieve this that I've totally been missing... Something that works neatly with AGK...

Can anyone offer suggestions to help?
Help out a fellow dev! Download and rate my games! They're free!

Wizzed Off! - (Android) (iOS)
God of Thunder - ()Android ([URL=https://itunes.apple.com/au/app/god-of-thunder/id1224878246]iOS)
Extreme Lawn Mowing - ()Android ([URL=https://itunes.apple.com/us/app/extreme-lawn-mowing/id1231847480?ls=1&mt=8]iOS)
Drunken Heroes - ()Android ([URL=https://itunes.apple.com/au/app/drunken-heroes/id1286500445?ls=1&mt=8]iOS)

And you can get Fluffy Knuckleduster merchandise at our new store!
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Nov 2017 10:14
I use the PHP method you described. It's safe, secure, and can be used by multiple platforms. (Apps, websites etc)
Click here for VR Legend of Zelda stuff
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 21st Nov 2017 10:40
I use PHP scripts called via the HTTP commands also.

Security wise, I always use SSL and have tried my best to remove any potential risks relating to the PHP code.
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 21st Nov 2017 10:57 Edited at: 21st Nov 2017 10:59
You can take a look at this code I shared which uses the XTRALIFE.CLOUD backend as a service system.

https://forum.thegamecreators.com/thread/219843

This could be improved a lot now that we have built in JSON support.
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 21st Nov 2017 11:09
This is all good stuff. Thanks guys. Just had a dynamite idea for something and wondered if I'd be hampered before I even began. Looks like not!
Help out a fellow dev! Download and rate my games! They're free!

Wizzed Off! - (Android) (iOS)
God of Thunder - ()Android ([URL=https://itunes.apple.com/au/app/god-of-thunder/id1224878246]iOS)
Extreme Lawn Mowing - ()Android ([URL=https://itunes.apple.com/us/app/extreme-lawn-mowing/id1231847480?ls=1&mt=8]iOS)
Drunken Heroes - ()Android ([URL=https://itunes.apple.com/au/app/drunken-heroes/id1286500445?ls=1&mt=8]iOS)

And you can get Fluffy Knuckleduster merchandise at our new store!
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 21st Nov 2017 11:12
Damn it, I just noticed my signature is broken. I wonder how long that was like that...
Help out a fellow dev! Download and rate my games! They're free!

Wizzed Off! - (Android) (iOS)
God of Thunder - (Android) (iOS)
Extreme Lawn Mowing - (Android) (iOS)
Drunken Heroes - (Android) (iOS)

And you can get Fluffy Knuckleduster merchandise at our new store!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 21st Nov 2017 11:29
because i not like fiddling around with php,
i have a cheap online hosting with asp.net on iis server + one domain with https,
using web api in visual studio 2017 and database access via linq to sql
it can be tested local and just published with a click.
AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.11.2) Radeon R7 265 : Mac mini OS High Sierra (10.13)
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 21st Nov 2017 12:42
But can it link in with Tier 1 AppGameKit alright?
Help out a fellow dev! Download and rate my games! They're free!

Wizzed Off! - (Android) (iOS)
God of Thunder - (Android) (iOS)
Extreme Lawn Mowing - (Android) (iOS)
Drunken Heroes - (Android) (iOS)

And you can get Fluffy Knuckleduster merchandise at our new store!
Dybing
13
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 21st Nov 2017 14:28 Edited at: 21st Nov 2017 22:38
Yes - in AppGameKit tier 1 the HTTP commands will provide you with all you need to communicate with a RESTful API over the interwebs. Very easy to use. Here's an example of some code of mine to get a hash from my server:



Though mind you, there is quite a lot going on in there to keep track of potential errors and forward status, plus ofcourse storing the server address in a datastructure which is populated at start-up from external JSON files - different ones on dev and server. Even an entire mock-up framework for automated tests.

Server-Side, it is a bit more complex, but for this API call, the important bits are (and written in Go obviously):



...and that is just a portion of my API code. But as you can see, it is fairly straight forward. Search for "Golang Restful API tutorial" and you'll find plenty of blogs, videos and websites going through different methods to make APIs in Go fairly well explained and step-by-step.
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 21st Nov 2017 22:35
Sounds cool! Thanks Dybing!
Help out a fellow dev! Download and rate my games! They're free!

Wizzed Off! - (Android) (iOS)
God of Thunder - (Android) (iOS)
Extreme Lawn Mowing - (Android) (iOS)
Drunken Heroes - (Android) (iOS)

And you can get Fluffy Knuckleduster merchandise at our new store!

Login to post a reply

Server time is: 2024-11-24 05:22:51
Your offset time is: 2024-11-24 05:22:51