Finally went to finish the server code (well the part that communicates with emulators), if anyone is interested on modifying an emulator and/or coding a lua script that checks for an "achievement" to complete the thing I wont bite. At one point I was thinking on checking how lua is done on snes9x but don't have vs2008... Anyway
First the player logins:
http://domain/ach.bin?exec=login&login=mylogin&pass=mypass
returns:
'B' -> Banned
'T' -> Tempbanned
'F#' -> Warning #, if # reaches max then tempbanned, max is 10 iirc
'S
username=?
sessionid=?
timebetweenpings=?
failedattempts=?' -> Success, returns data
Then they load a game, ie. Mario Bros. The emulator must have a file that translates roms to "game id", ie. 100. The emulator has a zip file 100.zip containing whatever it needs (lua scripts). If it doesn't it checks if it exists in the server or if its copy is outdated and redownloads if required
http://domain/ach/<gi>.zip, haven't thought of how should the emulator check if the zip files are outdated, don't know all the possibilities, can always return a date on the function down there.
With this the emulator knows what achievements are available to the game. It is only missing the state of those achievements for the player.
http://domain/ach.bin?exec=gameload&gi=100&si=5
si = sessionid received at login
gi = gameid, the emulator must know this on its own
returns:
'B' -> Banned
'T' -> Tempbanned
'O' -> Session over, login again
'F' -> game id doesn't exist
'S
a,b,c,d,e
a,b,c,d,e
a,b,c,d,e
...' -> Success, returns an extra line per achievement state
a=achievement id
b=total players
c=total players achieved
d=achievement "value" stored for player
e=date it was saved
f=date of the start of play session back then
Now the emulator can display a screen with all achievements and their progress if they want to. To keep the session alive the emulator pings (the server's expected ping time was sent at login).
http://domain/ach.bin?exec=ping&si=5
si = sessionid received at login
returns:
'B' -> Banned
'T' -> Tempbanned
'O' -> Session over, login again
'F#' -> Warning, # is the warning level, right now if 10 it tempbans the ip/player, raised when the ping is sent too early (has to be sent from 75% to 100% of "timebetweenpings").
'S' -> Success
When the local lua scripts decide an achievement is to be updated/awarded, they contact the server and send data to be verified. Right now I'm working with integer values so they can be sent as GET. But I suppose it should be sent as POST so the data to verify can be more complex.
http://domain/ach.bin?exec=playdata&gi=100&ai=1&si=5&d=23154
si = sessionid received at login
gi = gameid, the emulator must know this on its own
ai = achievementid, the emulator knows because the lua scripts have the value
d = data
returns:
'B' -> Banned
'T' -> Tempbanned
'O' -> Session over, login again
'S#' -> Success data verified (regardless of the outcome of the verification), # is the current achievement value on the server, the local scripts have to decide if the achievement is awarded and play an animation
So an emulator could have an offline mode if they just dont connect at all or just goes for the zip files, and store the achievement values in local files. The guy that coded the achievement would be free to do everything clientside or write code to validate serverside, or do both, I'd say this code would have to be written in javascript since that's something anyone can understand, but whatever is fine.