In-game Promo code

Discussion and help for Easy Save 3
Post Reply
sulokutty
Posts: 5
Joined: Fri Sep 06, 2019 3:02 pm

In-game Promo code

Post by sulokutty »

Hello !

I like to have an feature which allows players to unlock some in-game items by entering promo code. Let's say an in-game item can be unlocked by entering any one code from 20 codes. Codes can be obtained from website only. When Generate button pressed, 1 out of 20 code will be displayed. How can I validate on game that user entered correct code which we manually stored in database ?

New to Networking Stuff. And I have a Linux DigitalOcean VPS

Thanks.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: In-game Promo code

Post by Joel »

Hi there,

Easy Save's ES3Cloud functionality is only intended as a data store, so it's not designed to do this. The only way to do this without downloading all of the promo codes to the users device (which would make the codes insecure) would be to modify the ES3Cloud.php so that instead of outputting the codes, it checks whether the code provided matches any of the ones in the database, and then output TRUE or FALSE depending on whether it matches.

Then when you download the data to a local file, use ES3.LoadRawString and check whether the contents are "TRUE" or "FALSE". As this isn't the intended purpose of Easy Save and is a very specific use case, I wouldn't be able to assist with this.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
sulokutty
Posts: 5
Joined: Fri Sep 06, 2019 3:02 pm

Re: In-game Promo code

Post by sulokutty »

Hello !

Now this is what I planned to do. This is just Webgl game.

I generate random User ID and 3 Random promo codes when game launched. And save them locally and as well as to Database.
In my website, I ask user to enter User ID and generate Codes. So, from Website, I will lookup database for codes assigned to that user ID and show them.

Will save Game data like Level, Coins locally only.

Will this Work ?
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: In-game Promo code

Post by Joel »

Hi there,

ES3Cloud is only intended as a data store, so you would need to write your own code to add these codes to the database from the form and look up these codes in the database (I won't be able to assist with this). However, assuming that you're using the tables included with ES3Cloud, this is possible. You would just download the data for that user ID as described here: https://docs.moodkie.com/easy-save-3/es ... -es3cloud/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply