craidencool Posted June 23, 2016 Share Posted June 23, 2016 Hey guys. do you know any tutorial or how to create a game where it is connected through the internet and stores high score in a server that shows the ranking of the high score in the application. thank you so much Link to comment Share on other sites More sharing options...
gnoof Posted June 23, 2016 Share Posted June 23, 2016 I'd recommend learning at least the basics of a server-side language like PHP, Ruby or Node.js as there probably won't be a quick copy/paste "it just works" solution. You'll need a server and a database set up (you can set it up locally for testing with something like XAMPP). Essentially, on the client side, when the player gets a new high score, you probably want to send that data (in your case, score and probably a username) to an endpoint through an AJAX POST request. On the server, you would need some code that would grab that data and add it to a database. (http://www.w3schools.com/php/php_mysql_insert.asp) To display it as a high score table, you'd need a second endpoint, where you'd perform an AJAX GET request. On the server, you would need some code that would return all the items stored in your database in JSON format. (http://www.w3schools.com/php/php_mysql_select.asp) Once this is returned, you then display this data on screen via JavaScript. This is a simplified explanation. If it sounds complicated, just read up a little on server-side web programming in whatever language you prefer (I gave PHP in the examples as it's probably the easiest to play with locally with XAMPP). Link to comment Share on other sites More sharing options...
craidencool Posted June 23, 2016 Author Share Posted June 23, 2016 1 hour ago, gnoof said: I'd recommend learning at least the basics of a server-side language like PHP, Ruby or Node.js as there probably won't be a quick copy/paste "it just works" solution. You'll need a server and a database set up (you can set it up locally for testing with something like XAMPP). Essentially, on the client side, when the player gets a new high score, you probably want to send that data (in your case, score and probably a username) to an endpoint through an AJAX POST request. On the server, you would need some code that would grab that data and add it to a database. (http://www.w3schools.com/php/php_mysql_insert.asp) To display it as a high score table, you'd need a second endpoint, where you'd perform an AJAX GET request. On the server, you would need some code that would return all the items stored in your database in JSON format. (http://www.w3schools.com/php/php_mysql_select.asp) Once this is returned, you then display this data on screen via JavaScript. This is a simplified explanation. If it sounds complicated, just read up a little on server-side web programming in whatever language you prefer (I gave PHP in the examples as it's probably the easiest to play with locally with XAMPP). do you have sample codes on how to implement this sir? thank you! Link to comment Share on other sites More sharing options...
kikemx78 Posted June 23, 2016 Share Posted June 23, 2016 I would recommend to try this tutorial. If you can understand it, you'll be able to build what you need. http://cwbuecheler.com/web/tutorials/2013/node-express-mongo/ Hope it helps... Link to comment Share on other sites More sharing options...
febifowaj Posted June 7, 2019 Share Posted June 7, 2019 https://www.welookups.com/php/php_mysql_select.html Link to comment Share on other sites More sharing options...
Recommended Posts