Hey guys,
Im trying to work with parse in corona, I’ve read Jen’s tutorials, but its still a bit difficult for me to understand few things…
Im currently making a multiplayer Card Battle Game, each player has its own card stats, that is stored in a single table object.
The desired effect im looking for is:
Each player, once registering (to parse) inside the game, is basically adding a row to the table of “user database” (that is accessible from parse via “dashboard” -> “data browser” -> “user table”) that row holds all of its data, including name, email, and all of his “Cards data table”. Now, when the player chooses to battle, I want to make a search in the parse database, and pick random 10 possible players and send their info to the device, then the user (on his device) can choose an opponent from that list of 10 players and battle against him. (the battle from the opponent side is handled by the device)
What is already done? I already set up the registration form in the game, it also sends all the “Card data table” to the parse database. I’m using this code in corona under the function networkListener( event ) for the registration
[lua]if (request == “signup”) then
– pass player account info to LocalAccount
for k,v in pairs(AccountSetup) do
LocalAccount[k] = v
end
– pass parse response to LocalAccount
for k,v in pairs(response) do
LocalAccount[k] = v
end
– set playeremail table in case password reset needs to be called
playerEmail.email = LocalAccount[“email”]
end[/lua]
And for updating the card stats im using this code under the function networkListener( event )
[lua]if (request == “updateObj”) then
–get response
for k,v in pairs(response) do
LocalAccount[k] = v
end
–now update
for k,v in pairs (updateData) do
LocalAccount[k] = v
end
end [/lua]
Moving on to the questions:
-
What is the code (in corona) for requesting such a search on the database?
-
Since im expecting the database to be quite big, I would think that the “picking 10 random players from the database process” better take place in the cloud, instead of downloading the whole database to the device and make the process on the device itself, im guessing ‘cloud code’ would be involved, any help on how to do this (the code for the search and return result) will be greatly appreciated, cause I have no knowledge other then Lua and c languages, and parse.com doesn’t use them…
Any help will help!
Roy.