well after a taking a break to push out a few updates I'm back looking at this. Thanks to @stormystudio's great thread it got me motivated to take this to the next level.
Step 1 is going to be using the system to gather game metrics. Since we don't have access to an attribue for OS Type / Version (ehem @codewizard ), some of this will be just attributes that I create.
I am planning on logging the following:
UUID
OS via an attribute I create for each build
Device Width
Device Height
gameID
Date
Time
With the above data I should be able to get a good idea of how many people are downloading a game, what they are playing it on, and most importantly, how often them come back. This could be pushed in an update to all my existing applications with minimal work.
Step 2 is going to be adding some game specific logging. Each game will have it's own table in the database, and I'll use it to track stuff like levels completed, time to beat the level, how many times they died, etc. This should allow me to see where any problems are, how far people get before quitting, what features are used/unused.
Step 3 is going to be a self hosted multiplayer server. This is going to be a doozy. I've been following Stormy's progress over the past weeks and taking notes . This is not something that will be easy. But I'm up for the challenge.
While my original tutorial was based on PHP, I'm dipping my toes back into the Ruby on Rails pool to see if that will suit my needs. A few years ago I had 4 ruby on rails websites, one of them had a ton of user accounts and user generated data, so the framework should fit perfectly, if I can pick it backup where I left off.... time will tell.
@jonmulcahy thanks for all the work you have done on this. I have got my app to the point where I need to import tables and am trying to get my head around your php code.
Could you explain the code "Properties":[{"Name":"rowCount","Value":'.$arrlength.'},{"Name":"columnCount","Value":3} on line 136?
In particular what is "Value":3? I noticed the playerID and playerName have a value of 1 and playerstats is 2 is this for data type 1 for Text and 2 for Integer?
I'm not at home, but I think that's just the number of columns I'm sending. The number of rows is dynamic since that's changing, but the columns in the example is static, so we keep it at 3
@jonmulcahy Ahh! that makes sense but (There is always a but ) in the code following this, for what I now assume is the column number, playerID and playerName is "Value":1 and playerstats is "Value:2 which doesn't make sense. Both playerID and playerName can't be in the same column.
Depending on whether the column count starts at 0 or 1 shouldn't it be playerID "Value":0 (Or 1), playerName "Value":1 (Or 2) and playerstats "Value":2 (Or 3)?
@colander said:
jonmulcahy Ahh! that makes sense but (There is always a but ) in the code following this, for what I now assume is the column number, playerID and playerName is "Value":1 and playerstats is "Value:2 which doesn't make sense. Both playerID and playerName can't be in the same column.
Depending on whether the column count starts at 0 or 1 shouldn't it be playerID "Value":0 (Or 1), playerName "Value":1 (Or 2) and playerstats "Value":2 (Or 3)?
ok, lets see here. I haven't looked at this in a few weeks (month?) since working on my new game, so I'm a little rusty...
actually, it's not too bad, I know what you're talking about. let me break the line down so it's easier to read. Each column has two attributes. 0-X-name and 0-X-type (whereX is the column number. The Value:1 is the type of column it is, integer/text/boolean. That's why they both have a value of 1, they are both text where stats is an int. does that help?
@jonmulcahy that link really would have been handy a while back for you. That's what you get for being on the cutting edge. Your like a gamesalad gold pioneer, I still have no idea how you figured it out on your own.
@jonmulcahy thanks that is a big help. I have your project working now I just have to get mine to work so far no luck. I think I will start again form scratch I must have some stupid little typo somewhere I just can't see.
@jonmulcahy could you explain what "id911451" is in the json footer statement on line 136. I don't know what it is and I couldn't find it anywhere in your app.
// this is the footer of the JSON return. Again it will have to be adjusted to match whatever your app is expecting.
Ok everyone stop looking I found it . For those who don't know it is in your project file. Right click it and select "Show package contents" then Tables.
@colander, you won't see the id in the creator unless you look at the XML.
However, the correct way would be to send something to your server with the network Post behaviour before sending anything from server to app. You can then read the id from this first JSON file that your server receives.
@Hopscotch I am not sure where to find it on MAMP. This is all new to me and I am fumbling my way around so I grabbed it from the package file. I now have it all working, thanks for your help.
@jonmulcahy got the earlier problem sorted thanks to @Hopscotch now I've got another one I can't work out. I know enough to about code to figure out some things and this is my first experience with php so I am struggling to say the least.
I have two tables I need to import at the same time, one after the other. If I could combine them into one table that would solve my problem but they have different data types so I can't. Can you help me change your script to do this?
Id just create a 2nd set of variables for the second table info, you're gonna have to double almost all of them.
For a first timer it might be even easier to have 2 copies of the script, one for each table, then you customize each one for each table. Then just create a second behavior for the second table to go to the second url
I copied and pasted the Get section and added a "2" to all the variable and tested both sections separately and they work but I haven't been able to combine them to work as one script.
I thought about creating two databases in MAMP and two scripts and will probably end up doing it that way. But I wanted to try and do it on one database first an you know learn something new.
Anyway it's late now I will try again in the morning.
Got it all working and tested in Ad Hoc. It imports two tables a 20r x 16c and a 14,000r x 17c in 35 sec in Creator and 125 seconds in Ad Hoc on an iPad 5. I will test it on an iPad 2 later and hopefully it will be similar. I don't see the downloading time as an issue. This is for a business app and users would expect a large amount of data to take some time.
This is an awesome feature it opens up GameSalad for use in apps which weren't possible before. Now if we could just import images @CodeWizard@BlackCloakGS for business specific advertising it would be mega awesome.
At the moment I will have to pump as many adds as I can into the app before submission and use a table to stop individual ads from running and an update to add any new ads. I can probably use a browser in the app to display ads but the users has to remain connected to the internet for that to work.
Is this only for table text data etc, or can images be used, for instance making your own ad service?? Or is there another way to send images or display images using your own server?
@CodeCell, you can use the URL behaviour to call up a webpage on your server. Server side you could then randomize or control which ad you want to display. You can send some identifying parameter with the URL call to not duplicate ads.
@Hopscotch yeah we tried experimenting with that with a partner, but were not too fond of the idea of taking the user out of the app.
If we had a daily deal, or a competition, would it be possible to just call in an image, download an image, or display an Image from a server. Without exiting the app. I am still working on getting this process working on in this thread, but it just seems text output.
@CodeCell said:
Hopscotch yeah we tried experimenting with that with a partner, but were not too fond of the idea of taking the user out of the app.
If we had a daily deal, or a competition, would it be possible to just call in an image, download an image, or display an Image from a server. Without exiting the app. I am still working on getting this process working on in this thread, but it just seems text output.
yea this only works for sending table data, nothing else. You could preload a bunch of images, or have just text ads along the bottom.
@jonmulcahy or anyone can you tell me what I need to change here to get the script to work on Windows MAMP beta version $link = @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'root', 'root');
I have tried several things and I am guessing it is something like 'C:\blahblah', 'root', 'root'. I think this is all I need to change to get it to work on a windows PC. Then I hope my iPad will connect to it the same as it does to MAMP on my Mac. If someone know different please tell me.
I am trying to figure out how to update your script for this configuration and it has me baffled. Mostly because I really don't know what I am doing and I've just been taking shots and getting know where .
In the windows version there is no "tmp" folder and I'm not sure where or how to point it.
I am trying to figure out how to update your script for this configuration and it has me baffled. Mostly because I really don't know what I am doing and I've just been taking shots and getting know where .
In the windows version there is no "tmp" folder and I'm not sure where or how to point it.
interesting, never heard of that.
I'd try using this, it's been around for a long time and you'll find better support i think online. http://www.wampserver.com/en/
I finally got "MAMP Windows Beta" working. I had given up and downloaded WAMP then thought I'll give one more go and cracked it .
For anyone who wants to do this here are the steps I took. Assuming you have downloaded and installed the Windows version, installed your php scripts and setup your database and tables. I noticed you can't use capital letters in the database and table names which makes reading them a bit difficult if some names are similar.
I am not sure if all these steps are necessary but I am not going back to try and find out. It works so that'll do me.
In MAMP go to Preferences/Ports and click "Set Apache & MySQL ports to 80 & 3306"
In the PHP Script (yourscriptname.php) change @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'root', 'root'); to mysql_connect('localhost', 'root', 'root'); This also works for the Mac version.
In yourscriptname.php change your database and table names to lowercase if they aren't already to match your database
It should work. If you are importing a csv file into MAMP and it is timing out (The default limit is 300 sec) you will need to change the timeout limit.
Go to MAMP\bin\phpAdmin and open config.inc.php and add this line $cfg['ExecTimeLimit'] = 0; below $cfg['SaveDir'] = ''; this increase the timeout limit to infinity.
I also changed these values you might not need too but it doesn't hurt. Go to MAMP\config\php5.5.7 and open php.ini and
Find:
post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M
and replace with:
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 300
max_input_time = 540
memory_limit = 1000M
Save and restart Mamp
I don't understand a lot of this so there is no point in asking me to explain any of it. With my limited knowledge and a bit of study I basically tried different things and did a lot of Googling for answers until I got it to work. Someone who knows what they are doing could probably of had it all up and running in half an hour instead of the days it took me .
Comments
well after a taking a break to push out a few updates I'm back looking at this. Thanks to @stormystudio's great thread it got me motivated to take this to the next level.
I am looking at three avenues for this, all of which require me to generate a Unique ID (but the first two don't require a user account). I demo'd a process on how to do that here: http://forums.gamesalad.com/discussion/66786/generating-a-unique-id-for-asyc-metrics-whatever#latest
Step 1 is going to be using the system to gather game metrics. Since we don't have access to an attribue for OS Type / Version (ehem @codewizard
), some of this will be just attributes that I create.
I am planning on logging the following:
UUID
OS via an attribute I create for each build
Device Width
Device Height
gameID
Date
Time
With the above data I should be able to get a good idea of how many people are downloading a game, what they are playing it on, and most importantly, how often them come back. This could be pushed in an update to all my existing applications with minimal work.
Step 2 is going to be adding some game specific logging. Each game will have it's own table in the database, and I'll use it to track stuff like levels completed, time to beat the level, how many times they died, etc. This should allow me to see where any problems are, how far people get before quitting, what features are used/unused.
Step 3 is going to be a self hosted multiplayer server. This is going to be a doozy. I've been following Stormy's progress over the past weeks and taking notes
. This is not something that will be easy. But I'm up for the challenge.
While my original tutorial was based on PHP, I'm dipping my toes back into the Ruby on Rails pool to see if that will suit my needs. A few years ago I had 4 ruby on rails websites, one of them had a ton of user accounts and user generated data, so the framework should fit perfectly, if I can pick it backup where I left off.... time will tell.
wish me luck!
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Good luck! The metrics gathering sounds incredibly useful. Never thought about it a great deal before but very very cool.
Also. First one to build there own working multiplayer server With game launched owes the other guy a beer :-)
Challenge accepted![;) ;)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/wink.png)
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@jonmulcahy thanks for all the work you have done on this. I have got my app to the point where I need to import tables and am trying to get my head around your php code.
Could you explain the code "Properties":[{"Name":"rowCount","Value":'.$arrlength.'},{"Name":"columnCount","Value":3} on line 136?
In particular what is "Value":3? I noticed the playerID and playerName have a value of 1 and playerstats is 2 is this for data type 1 for Text and 2 for Integer?
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
I'm not at home, but I think that's just the number of columns I'm sending. The number of rows is dynamic since that's changing, but the columns in the example is static, so we keep it at 3
@colander
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
@jonmulcahy Ahh! that makes sense but (There is always a but
) in the code following this, for what I now assume is the column number, playerID and playerName is "Value":1 and playerstats is "Value:2 which doesn't make sense. Both playerID and playerName can't be in the same column.
Depending on whether the column count starts at 0 or 1 shouldn't it be playerID "Value":0 (Or 1), playerName "Value":1 (Or 2) and playerstats "Value":2 (Or 3)?
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
ok, lets see here. I haven't looked at this in a few weeks (month?) since working on my new game, so I'm a little rusty...
actually, it's not too bad, I know what you're talking about. let me break the line down so it's easier to read. Each column has two attributes. 0-X-name and 0-X-type (whereX is the column number. The Value:1 is the type of column it is, integer/text/boolean. That's why they both have a value of 1, they are both text where stats is an int. does that help?
also, I found this the other day:
https://help.gamesalad.com/hc/en-us/articles/202099666-7-10-Networking-Behaviors
has some very useful information that would have made my day easier when I first started playing around![:) :)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/smile.png)
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
@jonmulcahy that link really would have been handy a while back for you. That's what you get for being on the cutting edge. Your like a gamesalad gold pioneer, I still have no idea how you figured it out on your own.
@jonmulcahy thanks that is a big help. I have your project working now I just have to get mine to work so far no luck. I think I will start again form scratch I must have some stupid little typo somewhere I just can't see.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@jonmulcahy could you explain what "id911451" is in the json footer statement on line 136. I don't know what it is and I couldn't find it anywhere in your app.
// this is the footer of the JSON return. Again it will have to be adjusted to match whatever your app is expecting.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@colander, that is the table id in your app.
When you send data back to your app, this id needs to be included and match up to the table receiving the data.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch where do I find the table id number? All I can see when I open the table is the name I gave it.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Ok everyone stop looking I found it
. For those who don't know it is in your project file. Right click it and select "Show package contents" then Tables.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@colander, you won't see the id in the creator unless you look at the XML.
However, the correct way would be to send something to your server with the network Post behaviour before sending anything from server to app. You can then read the id from this first JSON file that your server receives.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch I am not sure where to find it on MAMP. This is all new to me and I am fumbling my way around so I grabbed it from the package file. I now have it all working, thanks for your help.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@jonmulcahy got the earlier problem sorted thanks to @Hopscotch now I've got another one I can't work out. I know enough to about code to figure out some things and this is my first experience with php so I am struggling to say the least.
I have two tables I need to import at the same time, one after the other. If I could combine them into one table that would solve my problem but they have different data types so I can't. Can you help me change your script to do this?
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Id just create a 2nd set of variables for the second table info, you're gonna have to double almost all of them.
For a first timer it might be even easier to have 2 copies of the script, one for each table, then you customize each one for each table. Then just create a second behavior for the second table to go to the second url
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
I copied and pasted the Get section and added a "2" to all the variable and tested both sections separately and they work but I haven't been able to combine them to work as one script.
I thought about creating two databases in MAMP and two scripts and will probably end up doing it that way. But I wanted to try and do it on one database first an you know learn something new.
Anyway it's late now I will try again in the morning.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Got it all working and tested in Ad Hoc. It imports two tables a 20r x 16c and a 14,000r x 17c in 35 sec in Creator and 125 seconds in Ad Hoc on an iPad 5. I will test it on an iPad 2 later and hopefully it will be similar. I don't see the downloading time as an issue. This is for a business app and users would expect a large amount of data to take some time.
For those who want to test in Ad Hoc and don't know how to connect from their device to MAMP on their computer replace "localhost" with your IP address. For example http://localhost:8888/MAMP/dbMyDatabase.php with http://xxx.xxx.x.xx:8888/MAMP/dbMyDatabase.php
This is an awesome feature it opens up GameSalad for use in apps which weren't possible before. Now if we could just import images @CodeWizard @BlackCloakGS for business specific advertising it would be mega awesome.
At the moment I will have to pump as many adds as I can into the app before submission and use a table to stop individual ads from running and an update to add any new ads. I can probably use a browser in the app to display ads but the users has to remain connected to the internet for that to work.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Is this only for table text data etc, or can images be used, for instance making your own ad service?? Or is there another way to send images or display images using your own server?
@CodeCell, you can use the URL behaviour to call up a webpage on your server. Server side you could then randomize or control which ad you want to display. You can send some identifying parameter with the URL call to not duplicate ads.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch yeah we tried experimenting with that with a partner, but were not too fond of the idea of taking the user out of the app.
If we had a daily deal, or a competition, would it be possible to just call in an image, download an image, or display an Image from a server. Without exiting the app. I am still working on getting this process working on in this thread, but it just seems text output.
yea this only works for sending table data, nothing else. You could preload a bunch of images, or have just text ads along the bottom.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
@jonmulcahy or anyone can you tell me what I need to change here to get the script to work on Windows MAMP beta version $link = @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'root', 'root');
I have tried several things and I am guessing it is something like 'C:\blahblah', 'root', 'root'. I think this is all I need to change to get it to work on a windows PC. Then I hope my iPad will connect to it the same as it does to MAMP on my Mac. If someone know different please tell me.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
so you installed WAMP (windows/apache/mysql/php)? If so you're right, you should just have to update the script.
If you just copied the MAMP folder over, that wouldn't work. You'd need to install WAMP and then updated the script for that configuration
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
@jonmulcahy no this is "Windows MAMP Beta" see https://www.mamp.info/en/mamp_windows_beta.html
I am trying to figure out how to update your script for this configuration and it has me baffled. Mostly because I really don't know what I am doing and I've just been taking shots and getting know where
.
In the windows version there is no "tmp" folder and I'm not sure where or how to point it.
$link = @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'root', 'root');
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
interesting, never heard of that.
I'd try using this, it's been around for a long time and you'll find better support i think online.
http://www.wampserver.com/en/
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
I finally got "MAMP Windows Beta" working. I had given up and downloaded WAMP then thought I'll give one more go and cracked it
.
For anyone who wants to do this here are the steps I took. Assuming you have downloaded and installed the Windows version, installed your php scripts and setup your database and tables. I noticed you can't use capital letters in the database and table names which makes reading them a bit difficult if some names are similar.
I am not sure if all these steps are necessary but I am not going back to try and find out. It works so that'll do me.
It should work. If you are importing a csv file into MAMP and it is timing out (The default limit is 300 sec) you will need to change the timeout limit.
Find:
post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M
and replace with:
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 300
max_input_time = 540
memory_limit = 1000M
Save and restart Mamp
I don't understand a lot of this so there is no point in asking me to explain any of it. With my limited knowledge and a bit of study I basically tried different things and did a lot of Googling for answers until I got it to work. Someone who knows what they are doing could probably of had it all up and running in half an hour instead of the days it took me
.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Would it be possible to use this kind of setup to create Apple Receipt Verification?
https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1
@moik it would take some fancy backend server code, but it should be able to work i think. I only took a quick glance but seemed ok
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left