How can I do something like social energy system with gamesparks?
r
rd Nation
started a topic
over 7 years ago
Hello,
I am developing mobile game which requires to have "energy system" like you see in candy crush, where each lives takes some amount of time to get increase.
So suppose, if you click "play game", 1 live will be deducted.
The timer will be start for 30 minutes.
User then have to wait for 30 mintutes to get another live to play next turn.
Any help regarding, how to implement it via gamesparks will be cool like how to store timer for each lives of particular user in cloud code,once timer ends then sending data back to game etc
Best Answer
C
Customer Support
said
almost 7 years ago
On Registration, store the player's Id into another collection called "playerLives"
The document should look something like: {"playerId" : "5559d90b1b3f58c687edd7f5", "addLifeIn" : "30"}
For energy you can use the currency system.
In Cloud Code, every minute load every playerId from the playerLives collection, loop through every Id and decrement the "addLifeIn" value, once the "addLifeIn" value reaches zero, execute some code to add 1 currency to the player's balance.
On Registration, store the player's Id into another collection called "playerLives"
The document should look something like: {"playerId" : "5559d90b1b3f58c687edd7f5", "addLifeIn" : "30"}
For energy you can use the currency system.
In Cloud Code, every minute load every playerId from the playerLives collection, loop through every Id and decrement the "addLifeIn" value, once the "addLifeIn" value reaches zero, execute some code to add 1 currency to the player's balance.
Shane
S
Steven Ritchie
said
almost 7 years ago
Does this solution apply to updating the "server" state for all currently connected players? For example, I need to compute the resource state of every currently connected player every minute or so. It's going to be a relatively complex computation updating many items in the mongo document for a player (imagine a simcity-like update of the world state but not quite as complex as simcity).
Is this fast enough to work if you were lucky enough to have 100K concurrent users?
rd Nation
Hello,
I am developing mobile game which requires to have "energy system" like you see in candy crush, where each lives takes some amount of time to get increase.
So suppose, if you click "play game", 1 live will be deducted.
The timer will be start for 30 minutes.
User then have to wait for 30 mintutes to get another live to play next turn.
Any help regarding, how to implement it via gamesparks will be cool like how to store timer for each lives of particular user in cloud code,once timer ends then sending data back to game etc
On Registration, store the player's Id into another collection called "playerLives"
The document should look something like: {"playerId" : "5559d90b1b3f58c687edd7f5", "addLifeIn" : "30"}
For energy you can use the currency system.
In Cloud Code, every minute load every playerId from the playerLives collection, loop through every Id and decrement the "addLifeIn" value, once the "addLifeIn" value reaches zero, execute some code to add 1 currency to the player's balance.
Shane
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
On Registration, store the player's Id into another collection called "playerLives"
The document should look something like: {"playerId" : "5559d90b1b3f58c687edd7f5", "addLifeIn" : "30"}
For energy you can use the currency system.
In Cloud Code, every minute load every playerId from the playerLives collection, loop through every Id and decrement the "addLifeIn" value, once the "addLifeIn" value reaches zero, execute some code to add 1 currency to the player's balance.
Shane
Steven Ritchie
Does this solution apply to updating the "server" state for all currently connected players? For example, I need to compute the resource state of every currently connected player every minute or so. It's going to be a relatively complex computation updating many items in the mongo document for a player (imagine a simcity-like update of the world state but not quite as complex as simcity).
Is this fast enough to work if you were lucky enough to have 100K concurrent users?
.
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics