Ajax request not working when using Remote/Normal Preview

0 favourites
  • 6 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • My game have an HighScores table. I get/set highscores on my server with Ajax request. On C2 previews it was working beautifully but it's not anymore on C3.

    Is there a way to allow Ajax request in previews?

    Thanks

  • lapinchatware Hi This is interesting but I would love to find out how you did you highscore table code etc because id love to do this in my game to!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Of course You need to prepare these things:

    - a database on your server.

    • some scripts on your server to read/write scores
    • a simple interface in C2/C3

    -=WARNING=- I did not implement something fancy, it's fairly simple so there is some security stuff to address. I've cleared some basic consideration about this security, but I definitely did not cover everything. I'm not an expert. It's also important to know that someone wise enough can definitely inject score in the database without playing the game. So, you've been warned. -=/WARNING=-

    Database

    You need a place to record your scores.

    • Create your database. (I personally did it through my CPanel.)
    • Create a table. (I did it manually with PHPMyAdmin). Mine have four columns : id, section, name, score.
    • Give your DB a strong password.

    PHP

    Here are the files I'm using. I will not explain them, if you don't know how it works, you will have to do some research. But basically, in each text file, replace the DB username, password, DB name and table name with your own. Those files can be placed anywhere in your project files export. Just take note of where you put them.

    PHP files

    Using this setup in C2/C3

    Here's a basic capx exemple: exemple

    NOTE: I haven't test this capx, but it should work.

    I hope it helps you. Have fun.

  • Thanks ill try it!

  • My game have an HighScores table. I get/set highscores on my server with Ajax request. On C2 previews it was working beautifully but it's not anymore on C3.

    Is there a way to allow Ajax request in previews?

    Thanks

    Simple answer Yes

    You need to be secure to view preview/remote preview

    You need to secure your server with https

    Most servers will do this free with an add-on called Let's Encrypt

    The link to the add-on is below with the list of servers that will comply.

    https://community.letsencrypt.org/t/web-hosting-who-support-lets-encrypt/6920

    Maybe this information needs to be added to the C3 manual ?

    Good luck

    Cheers

  • HI lapinchatware I have uploaded the php to my site and change the variables in the .capx but it doesent seem to work my site is bedfordgames.com

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)