@msheri24 said:
Great help. Thanks. I have gotten the send.php to work in creator. It sends the table data to byethost perfectly, but once I test this on my phone it does not work. Can anyone help with this? Or does this only work in creator?
Has anyone on this thread gotten byethost to work fully in 2016? I keep getting the -1 no matter what I try when using the get behavior.
@msheri24 said:
Great help. Thanks. I have gotten the send.php to work in creator. It sends the table data to byethost perfectly, but once I test this on my phone it does not work. Can anyone help with this? Or does this only work in creator?
Has anyone on this thread gotten byethost to work fully in 2016? I keep getting the -1 no matter what I try when using the get behavior.
If I remember correctley I had lots of problems with byethost. I got it to work perfectley on both on a regular domain hosting and a VPS.
I followed the videos above (1 to 5) and I think my setup is correct, but at the end when I test it, it stays with 0. And this is my php: (please let me know if I did something wrong)
<?php
// connect to SQL
$servername = "sql313.byethost32.com";
$username = "b32_19670549";
$password = "xxxxxxxxx";
$link = @mysql_connect($servername, $username, $password);
// database connection strings. change these to your DB and Table names.
$dbName = "b32_19670549_game1";
$tableName = "game1";
if (!$link) {
//exit('Error: Could not connect to MySQL server!');
echo mysql_errno($link) . ": " . mysql_error($link). "n";
}
// connect to the table
mysql_select_db($dbName)or die("cannot select DB");
// lets prepare some files to capture what is going on.
$incomingJson = 'json.txt';
//$fullArray = 'fullArray.txt'; // needed if you enable the debugging secton below
$sqlErrorLog = "sqlErrors.txt";
// initialize the string with a blank value
$string = "";
// start GET data
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// initialize the JSON body variable
$jsonBody="";
// get table contents
$query = mysql_query("SELECT * FROM ".$tableName);
// construct an array to hold the data we pull from mySQL
$rows = array();
// loop through the table and drop the data into the array
while($row = mysql_fetch_assoc($query)) {
$rows[] = $row;
}
// get the number of rows in the array. We need this in the JSON return
$arrlength = count($rows);
// set while loop index
$i = 0;
//loop through array node and get row values
while ($i < $arrlength ) {
// tables we are capturing
$playerID = $rows[$i]['playerID'];
$playerName =$rows[$i]['playerName'];
$playerStats = $rows[$i]['playerStats'];
$auto_i = $rows[$i]['auto_i'];
// table row numbers. our index starts at 0, so we want to increment it by 1 to get valid row numbers.
$tableRow = $i+1;
// construct the JSON return from our data
$jsonString = '{"Name":"'.$tableRow .'","Value":"|'.$playerID.'|'.$playerName.'|'.$playerStats.'|'.$auto_i.'|"},';
// append the JSON return with the new data
$jsonBody=$jsonBody.$jsonString;
// increase index and loop again if not at end of array.
$i++;
}
// construct the JSON response
// this is the header of the JSON return. It will have to be adjusted to match whatever your app is expecting. We have to define this here to get the row count above.
$jsonHeadher='{"Properties":[],"Name":"","Children":[{"Properties":[{"Name":"rowCount","Value":'.$arrlength.'},{"Name":"columnCount","Value":3},{"Name":"0-1-name","Value":"playerID"},{"Name":"0-1-type","Value":1},{"Name":"0-2-name","Value":"playerName"},{"Name":"0-2-type","Value":1},{"Name":"0-3-name","Value":"playerStats"},{"Name":"0-4-type","Value":2},{"Name":"0-4-name","Value":"auto_i"},{"Name":"0-3-type","Value":2}],"Name":"id543326_headers","Children":[]},{"Properties":[';
// this is the footer of the JSON return. Again it will have to be adjusted to match whatever your app is expecting.
$jsonFooter='],"Name":"id543326","Children":[]}]}';
// removes an extra comma that the loop above leaves behind
$jsonBody=rtrim($jsonBody, ",");
// constructing the full JSON return
$returnedJson=$jsonHeadher.$jsonBody.$jsonFooter;
// write the JSON data so the app can read it.
echo $returnedJson;
} // end of get
// close the SQL connection
mysql_close($link);
?>}
thanks for sharing. I wonder how to setup a multiplayer game if using the Appformitive leaderboards. Im pretty new on gamesalad with only 2 years experiences. never made a multiplayer game before. would like to know what are all the steps. please if anyone can share the information. trying to figure out online, but most people there only talk about how to setup and run the php and then stopped right there. please thanks so much for the help.
app formative does not support multiplayer game functionalities.
Tough you can send and receive data from different servers you could still use app formative only for the leaderboards and your own server for the multiplayer game functions, lobby, matchmaking etc.
Also there was this gamesparks, which gives you account creation, lobby matchmaking etc
@Hopscotch (appformitive) provides a lot more than just leaderboards. I have had him create custom scripts that are specific to client needs like sharing game data between devices (for things like puzzle games where to may want to save a certain level with specific settings and then share it via social media and allow another user to then down that exact data to there device and then allow the game to use that data to create a specific level based on the data received. If you have a certain need, they are very accommodating and will work closely with you and create a custom script to do the job.
Comments
Has anyone on this thread gotten byethost to work fully in 2016? I keep getting the -1 no matter what I try when using the get behavior.
If I remember correctley I had lots of problems with byethost. I got it to work perfectley on both on a regular domain hosting and a VPS.
My advice it to get something else then byethost.
I followed the videos above (1 to 5) and I think my setup is correct, but at the end when I test it, it stays with 0. And this is my php: (please let me know if I did something wrong)
<?php // connect to SQL $servername = "sql313.byethost32.com"; $username = "b32_19670549"; $password = "xxxxxxxxx"; $link = @mysql_connect($servername, $username, $password); // database connection strings. change these to your DB and Table names. $dbName = "b32_19670549_game1"; $tableName = "game1"; if (!$link) { //exit('Error: Could not connect to MySQL server!'); echo mysql_errno($link) . ": " . mysql_error($link). "n"; } // connect to the table mysql_select_db($dbName)or die("cannot select DB"); // lets prepare some files to capture what is going on. $incomingJson = 'json.txt'; //$fullArray = 'fullArray.txt'; // needed if you enable the debugging secton below $sqlErrorLog = "sqlErrors.txt"; // initialize the string with a blank value $string = ""; // start GET data if ($_SERVER['REQUEST_METHOD'] === 'GET') { // initialize the JSON body variable $jsonBody=""; // get table contents $query = mysql_query("SELECT * FROM ".$tableName); // construct an array to hold the data we pull from mySQL $rows = array(); // loop through the table and drop the data into the array while($row = mysql_fetch_assoc($query)) { $rows[] = $row; } // get the number of rows in the array. We need this in the JSON return $arrlength = count($rows); // set while loop index $i = 0; //loop through array node and get row values while ($i < $arrlength ) { // tables we are capturing $playerID = $rows[$i]['playerID']; $playerName =$rows[$i]['playerName']; $playerStats = $rows[$i]['playerStats']; $auto_i = $rows[$i]['auto_i']; // table row numbers. our index starts at 0, so we want to increment it by 1 to get valid row numbers. $tableRow = $i+1; // construct the JSON return from our data $jsonString = '{"Name":"'.$tableRow .'","Value":"|'.$playerID.'|'.$playerName.'|'.$playerStats.'|'.$auto_i.'|"},'; // append the JSON return with the new data $jsonBody=$jsonBody.$jsonString; // increase index and loop again if not at end of array. $i++; } // construct the JSON response // this is the header of the JSON return. It will have to be adjusted to match whatever your app is expecting. We have to define this here to get the row count above. $jsonHeadher='{"Properties":[],"Name":"","Children":[{"Properties":[{"Name":"rowCount","Value":'.$arrlength.'},{"Name":"columnCount","Value":3},{"Name":"0-1-name","Value":"playerID"},{"Name":"0-1-type","Value":1},{"Name":"0-2-name","Value":"playerName"},{"Name":"0-2-type","Value":1},{"Name":"0-3-name","Value":"playerStats"},{"Name":"0-4-type","Value":2},{"Name":"0-4-name","Value":"auto_i"},{"Name":"0-3-type","Value":2}],"Name":"id543326_headers","Children":[]},{"Properties":['; // this is the footer of the JSON return. Again it will have to be adjusted to match whatever your app is expecting. $jsonFooter='],"Name":"id543326","Children":[]}]}'; // removes an extra comma that the loop above leaves behind $jsonBody=rtrim($jsonBody, ","); // constructing the full JSON return $returnedJson=$jsonHeadher.$jsonBody.$jsonFooter; // write the JSON data so the app can read it. echo $returnedJson; } // end of get // close the SQL connection mysql_close($link); ?>}
why don't u guys use app formative
http://www.appformative.com/implementation_gamesalad_scoresandleaderboards.mox
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de
I agree, Appformitive leaderboards are extremely easy to set up. Certainly my first choice.
GAMESALAD DEV FOR HIRE! - www.gingagaming.com
thanks for sharing. I wonder how to setup a multiplayer game if using the Appformitive leaderboards. Im pretty new on gamesalad with only 2 years experiences. never made a multiplayer game before. would like to know what are all the steps. please if anyone can share the information. trying to figure out online, but most people there only talk about how to setup and run the php and then stopped right there. please thanks so much for the help.
app formative does not support multiplayer game functionalities.
Tough you can send and receive data from different servers you could still use app formative only for the leaderboards and your own server for the multiplayer game functions, lobby, matchmaking etc.
Also there was this gamesparks, which gives you account creation, lobby matchmaking etc
My Apps
https://itunes.apple.com/de/artist/david-zobrist/id733552276
https://play.google.com/store/apps/developer?id=David+Zobrist&hl=de
thanks I will look at that.
@Hopscotch (appformitive) provides a lot more than just leaderboards. I have had him create custom scripts that are specific to client needs like sharing game data between devices (for things like puzzle games where to may want to save a certain level with specific settings and then share it via social media and allow another user to then down that exact data to there device and then allow the game to use that data to create a specific level based on the data received. If you have a certain need, they are very accommodating and will work closely with you and create a custom script to do the job.
GAMESALAD DEV FOR HIRE! - www.gingagaming.com
I'll quickly set this up for anyone that doesn't wish to figure it out themselves: http://gshelper.com/product/network-behaviors-full-set-up-for-cross-platform-leaderboards-with-keyboard-data-collection-etc/