On-line ScoreBoard [Not maintained .. new extension available ]

cabinfever

  • Posts: 159
Numbers can not hold decimal values (MySql integer value type?). So to store those sub-seconds accuracy values either:
* multiply time-values with 100
* use text and see how sorting goes with those values

However, now that I try to connect into Scoreboard, I see on Stencyl log after initScoreboard line, this:
[Flash] ScoreBoard#onError(178): onError called: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://mdotedot.net78.net/stencyl/stencyl.php?a=1"]

And I get no more connection into it??!?
Also from PC, connecting into: http://mdotedot.net78.net/stencyl/stencyl.php
gives 'Connection timeout'

« Last Edit: January 11, 2015, 10:25:00 am by cabinfever »

cabinfever

  • Posts: 159
And for some unknown reason, the connectivity now works again!

Joraanpe

  • Posts: 288
Yes, getting the player position with one query would be very nice enhancement!

second one would be: total number of players within particular level. Then I could show something like:
* Your position is 123 of 2345 players

@mdotedot
That would be an awesome feature, actually i was trying to do something like that, but with raw attributes and didn't end well lol..
Are you guys planing on implementing it here?

mdotedot

  • Posts: 1568
Hello Joraanpe,

Indeed CabinFever made a very nice point and this will be implemented later after other multiplayer stuff that I'm working at!

Best regards from
M.E.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

cabinfever

  • Posts: 159
Hi,

What would be the right way of doing this?
* check if player already has score on level
* If there was no score, or it was lower than current one stored on phone, then upgrade scoreboard

Why do like this? If player has multiple devices and using same name, then only the highest score (on his devices),
would be updated into the Scoreboard.

How do I dectect, if <Scoreboardm Get list of Scores from ID: x> returned nothing, if player did not exist on Scoreboard at all?
Should I populate a list with foobar content and then after <Request score from playername>, test if this list is:
* empty (no scores for the player at all)
* has that foobar content (Scoreboard did not return anything)
* has some proper content (Player did exist and had score on Scoreboard)

(This also relate to test on how would I detect if certain playername is already in use in the Scoreboard.)

mdotedot

  • Posts: 1568
Well, HIGHscore is pretty much dependent on your game/level. Could be that your game involves around getting the highest score or the lowest :)
So it is up to you, the scoreboard programmer, to check the score.

If you want to check if a player has a score request score list with  ' Request score from playername: X '
You can check if a list is empty. So if you don't receive anything from the get list of scores then you don't have any scores!
The '<list> contains no items' block is in the list panel.
So if you request a list with name X and you receive an empty list : no score

If that is not the case, please upload a screenshot of the codeblocks you are trying.

Best regards from
M.E.



Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

cabinfever

  • Posts: 159
I am mystified with this issue that I have...
Question:
* Within Stencyl code (scene/behaviour/etc), can I use only ONCE the <Scoreboard: Server URL: ...> block?

I have tried splitting handling of personal score functions from general top-10-list functions into different custom events within my HighScore -scene. And no matter what I do, the personal side never runs. It is like, the code which is inside of second <ScoreBoard: Server URL...> block is not running at all.  Even commands like, <Print> block do not produce any output to log-file, etc...

« Last Edit: January 14, 2015, 12:19:57 am by cabinfever »

mdotedot

  • Posts: 1568
You have a 'debug [on]' block to get information from the extension..

I have to investigate how to have multiple scoreboards. I did intend for it to be possible, but I do realize that I never tried it myself, so it could be that it does not work with multiple scoreboards in one game!

Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

cabinfever

  • Posts: 159
Just two different connections into same ScoreBoard.
I'll try to re-organize the code into single <ScoreBoard: Server URL...>
--------------
Update:
Yes, I got this working. The key was not to have two <ScoreBoard: Server URL:>  blocks active at same time.
Once I put some delay between the two operations, then it worked ok.
(now I need to build some better logic here to handle unknown delays from ScoreBoard, but that is another issue.)

The <ScoreBoard: isConnected> was the obvious choice, but it returns true, even outside the ScoreBoard-blocks. So I have no easy way of knowing, if previous ScoreBoard functionality (writing) is done, before opening a new session into it.

« Last Edit: January 14, 2015, 08:48:19 am by cabinfever »

cabinfever

  • Posts: 159
Hi,

Something strange going on...
When using:
<ScoreBoard: Request score from playername> , I get the expected score (8)
[Flash] ScoreBoard#onData(243): received List : [U2F1bmF0YXItdGVz#8!]

But when using :
<ScoreBoard: Request list AppID .... number of rows 10 ...>, I get the OLD score (7) for this user:
 [Flash] ScoreBoard#onData(222): Received text from server: After decode :[RETURNID3DINRUTERRETURNVALQ2FiaW4tZHVkZQ..#106!QmVsdXNoaTQ.#31!Sm9lUGVzaDM.#30!VHVwdTE.#30!U2F1bmF0YXItdGVz#7!QWJib2E1#5!SHV1bGlvMg..#4!SmVQZXNoMw..#2!VGFrdTI.#2!VGlrdTI.#1!]

(that decoded username and score: U2F1bmF0YXItdGVz#7 )

But when I close the application and re-run it (flash), then I get correct scorelist for top 10 players!!

Is there some caching or something on the ScoreBoard server side?!??
But this happens only when I have first updated the persons highscore. So I have used the command
<ScoreBoard: Set score for AppID ...> in my Stencyl app. If I have not used that command, then all is OK.

« Last Edit: January 19, 2015, 12:25:10 am by cabinfever »

mdotedot

  • Posts: 1568
Hello CabinFever,

Currently I haven't got the time to really delve into this, but there is certainly caching going on.
After a request the data gets overwritten by the data you pull from the server.
You mentioned somewhere that you used two scoreboards : Do not do this before I investigate the code carefully on dual or more scoreboards in one game !!!

Again, I need to look into this to really give you any better feedback and I could be mistaken with the statement above!

Best regards from
M.E.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

cabinfever

  • Posts: 159
Hi,

The issue is with another game, which only uses single scoreboard. The AppID starts with: CKFO

The strangeness is:
1) I check if I should upgrade persons highscore (get person's highscore from ScoreBoard)
2) Yes, Highscore was lower in the ScoreBoard, then I upgrade ScoreBoard with person's NEW highscore (which I verify)
3) Then get top-10 highscore list from ScoreBoard, but this one still shows the OLD highscore for this person !?!??

-------------
Udpate:
Even more strange is, that when I run same Stencyl (Flash-app) twice at the same time on this pc:
* First one that did the player high score update, sees the OLD value in top-10 list
* Second application that has NOT done player high score update, sees the right value in top-10 list (that first application updated there).

I even see from ScoreBoard debug (and my own traces) that ScoreBoard returns different values (top-10) for same query!
So clearly on the ScoreBoard-server side, there is some 'snapshot' or buffering done for each connection. Individual writes get through to database, but 'mass' requests get served by some cache element.


« Last Edit: January 19, 2015, 10:06:16 am by cabinfever »

mdotedot

  • Posts: 1568
Thank you for your well-described information.
But unfortunately I don't have time to investigate this right now. Maybe I find some time the coming week!

Best regards from
M.E.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

cabinfever

  • Posts: 159
One more (shot in the dark) time about this,

Yes:
* I've looked through the server side code and I find no evidence of any MySql buffering/caching.
* I've looked through the Stencyl side code and that one also looks good to me.

The difference with this game and the earlier one, where I got the ScoreBoard working is:
* that on working game, I can only test it on mobile since it uses multitouch
* this one, that is giving me bad time, I can test on pc (no-multitouch)

--> Now, I've looked with Wireshark what is sent/received from/to ScoreBoard server and....
* Most of the time I see NO packets sent/received, even when Stencyl Log-file shows them being sent/received!!!!??!?!

This gives me a VERY strong suspect that Flash-player is doing some caching somewhere. And that's why I always get
same results for same query and it is never really sent to your ScoreBoard server at all!

mdotedot

  • Posts: 1568
Hello CabinFever,

What I know is that if the URL matches from a previous query, a browser can decide that the page it has loaded contains all the valid data.
That is among the reasons that each time you access the on-line (scoreboard) it generates a unique encoded string.
So that the string you send is each time different. Based on that I would not suspect a browser to do caching.

But I do not know how Flash decides it is a new URL or that it can cache it?! If I search in Google for it I indeed find causes of caching and that is due to the URL method I described above.

Ah, wait a minute. I generate unique URL when changing the board, not requesting it!

So, please replace all lines with call:String to:
Code: [Select]
  var call:String=""+url+"?a="+Base64.encode(encoded)+"&date="+Base64.encode(""+Date.now());

Good catch and thank you for your investigations into this.

Hopefully this will solve your problem!

Best regards from
M.E.
Hanging out in the Chat:  http://www.stencyl.com/chat/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.