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

Joraanpe

  • Posts: 287
Hello Joraanpe,

For 3.3 the only thing you need to do is to edit the ScoreBoard.hx and replace the 'nme'  import text to 'openfl'
example: import nme.net.URLRequest;  would become: import openfl.net.URLRequest;
Since 3.3 is not the official available version yet so I didn't change it in the source files but left it to nme so it compiles under > 3.0

There are two things to remember with 'freezing' when you connect to a server/resource on the internet.

1. Sometimes referred to as Blocking I/O or non-blocking I/O : this is in the core of the library calls that Stencyl uses. Haxe uses blocking I/O for HTTPS calls which means whatever you do it always waits for data before the client can continue.
Non-Blocking I/O is used for HTTP requests which means that the client can continue to do things and have a callback when data has arrived.

2. Apart from the blocking mechanism the Extension that I wrote uses wrapper blocks. Wrapper blocks are blocks that look like :
+=== Do something === and then  do:
|
|     Code inside this block gets called from the 'wrapper' function
|
+===========================
I use wrapper blocks to ensure that the data has been loaded before Stencyl goes further and you use the blocks to get data for example.

My guess is that the latter is causing you 'the freeze'.
The connection to the free server that I provide is poor, not guaranteed and could be unstable : hence FREE service :)
When you use the wrapper block to get data my guess is that it takes quite a bit of time to retrieve the data.

My suggestion would be to use a kind of loading actor that displays during the time it takes to request the data and to display the data.

Something like this

1. setGameAttribute WAIT to true
2. wrapper block: request score
3. inside wrapper block: setGameAttribute WAIT to false
4. Make a draw event on the 'loading' actor
5. Inside draw event: if getGameAttribute WAIT   draw text 'loading'

Hope this helps!

Best regards from
M.E.

Hi M.E thanks again for your reply and time!

1) about the freezing issue and the suggestion, yes, thats exactly how i have it, ive setted a bool that turns on and off the loading hud... whats weird is that while testing on flash it does the job no problems, but when testing on mobile is when it might show the freezes (when i touch the scoreboard actor it freezes the whole game 1-2 secs, then shows my loading hud and then shows the scores)

I might add that this freeze issue seems to only happen when i freshly opened the game and try to open scores the first time.... but the second, third, and coming times it opens it just fine.


2)  I have some doubts about the new block for requesting the player's position.... I've settled it inside a request score from player wrapper, right at the end of the codes for requesting the scores in general we talked before. Then i save this new block for position inside an attribute and try to show it inside a drawing event, even though  it shows "0" all the time.... any idea why could it be?

Thanks again

mdotedot

  • Posts: 1654
Hello Joraanpe,

Do you initialize the Server URL at the start of the game?
My guess is that the initialization is taking the bulk of the time. Once it has verified your secretID+Application ID it caches it and it should be faster.

Can you show me a block-example how you have made your position-checking ?

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

Joraanpe

  • Posts: 287
Hello Joraanpe,

Do you initialize the Server URL at the start of the game?
My guess is that the initialization is taking the bulk of the time. Once it has verified your secretID+Application ID it caches it and it should be faster.

Can you show me a block-example how you have made your position-checking ?

Best regards from
M.E.

Sure, im attaching here the image of the full behaviour of the actor that deals with the scoreboard, let me know if you catch anything wrong in general, but specially with the new block to get the player position

porkwaffle

  • Posts: 10
Hey M.E. thanks for your quick reply.

I followed your suggestions and my leaderboard is now working :)  How would I go about adding a second leaderboard for my games additional game mode?  Is it as simple as changing the level # on the 'Set Score' block & 'Request List' block  to a different number?

thanks again!
Asteroid Survival - FREE


   Android
   Amazon

FranAlt

  • Posts: 169
Is there a way to add more fields? Like Score, Level, Expereience, etc... under the playername?
Swipe - FREE          Cloud Run - FREE              
                                  
         iOS                                Android
    Android

mdotedot

  • Posts: 1654
Hello Joraanpe,

Sorry, I’m not able to test in-depth.

Few suggestions:
Put the Server URL block on another event, like Created event
Put the request score from player name BELOW the request list instead of inside of it
Use different ID for the two request-blocks. So the list with ID 12 and the request score from player with 13 and name the position 13 as well

Let me know if these fix your issue. If not I have to delve into it deeper and try the blocks you are using myself.

Hello Porkwaffle,

Initially my intention was to have different scoreboards, but I have to admit that I didn’t tested it very much.
Your suggestion using another level is certainly a possibility to simulate different scoreboards even if you do not use levels in your game.

Hello FranAlt,

You might ‘hack’ the scoreboard to do something different than it is supposed to do.
The extension isn’t meant as a real-time database since there is no locking involved. It will just do what
you ask it to do and when you have two client-connections with the same player name you end up overwriting each other values.

You could however do something like this:
set score to X for playername&experienceX type text

So that the scoreboard contains player name&experienceX and the score is X
Example:
PlayerName: MdotEdot
Experience:   WizardSpellSleep
Value:            YES

set score for appid [xxxxx] level [1] type: Text PlayerName: MdotEdotWizardSpellSleep score: YES

So if you want to check if a player has some achievement you could check the scoreboard :

Request score from player name: MdotEdotWizardSpellSleep Appid: xxxx Level x get Type Text
If you have a result in the list of 0 entries you know it hasn’t got the achievement
If you have a result you could check the result for the value YES. If it is NO or REVOKED or something like that you know
that the achievement is also not available.

Hope this is what you are looking for and otherwise you have to wait for the extra online blocks that will become available in the future.
Among others the Achievement/Property System where you actually do get a lock from the system is on the ToDo-list.

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

Joraanpe

  • Posts: 287
Hello Joraanpe,

Sorry, I’m not able to test in-depth.

Few suggestions:
Put the Server URL block on another event, like Created event
Put the request score from player name BELOW the request list instead of inside of it
Use different ID for the two request-blocks. So the list with ID 12 and the request score from player with 13 and name the position 13 as well

Let me know if these fix your issue. If not I have to delve into it deeper and try the blocks you are using myself.

Hi M.E. thanks again for your time, its very valuable and appreciated.
I did what you suggested me but unfortunately still no luck...
Let me know if there is anything else we should do, or if i may send you the package of this game scene for you to check it on your side.

Jose

FranAlt

  • Posts: 169
Thanks for the quick reply :D I can see that method you described working for me. One thing, Im having trouble installing the extension, have you tried it with the latest build? When I select the .zip file nothing happens, its like something is missing (I also tried unzipping it and dropping the folder at the extensions path, no luck). Thanks again for your time! :P

« Last Edit: February 28, 2015, 08:17:39 pm by FranAlt »
Swipe - FREE          Cloud Run - FREE              
                                  
         iOS                                Android
    Android

mdotedot

  • Posts: 1654
Hello FranAlt,

Today I downloaded the latest build (made 17 hours ago) and I removed the ScoreBoard directory and extracted the .zip manually into the engine-extensions folder and it worked just fine. What I did do was to uncomment the openfl lines and commented out the nme.* ones.

Then I started Stencyl and I could open games with extension and even create a new one and Enable the extension.

Can you post your logfile if you keep having problems?

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

mdotedot

  • Posts: 1654
Hello JoraanPe,

With the 3.2 and 3.3 release I can verify that the construction you use fails !!!

It has to do with the nesting. Previously I didn't retrieve the position inside another block but it was a seperate action on an actor.

I need to redesign the Extension to be capable of those inner-nestings but I have hopefully found a workaround. OK, it is not nice but hopefully it will do the trick for you. I am not really sure if the workaround holds up on network problems as I currently seem to have a good connection and cannot tell if that is part of why it is working for me now.

Again, I need to redesign the extension and that will not be happening anytime soon.

All these events are on one actor on one scene:



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

Joraanpe

  • Posts: 287
Hello JoraanPe,

With the 3.2 and 3.3 release I can verify that the construction you use fails !!!

It has to do with the nesting. Previously I didn't retrieve the position inside another block but it was a seperate action on an actor.

I need to redesign the Extension to be capable of those inner-nestings but I have hopefully found a workaround. OK, it is not nice but hopefully it will do the trick for you. I am not really sure if the workaround holds up on network problems as I currently seem to have a good connection and cannot tell if that is part of why it is working for me now.

Again, I need to redesign the extension and that will not be happening anytime soon.

All these events are on one actor on one scene:



Best regards from
M.E.

Nooooooo don't tell me that T.T
I was dreaming with the feature to get the position on scores, its the only feature i was needing left :(

I tried the way you used your blocks, but still no success....

I hope you can get some time to add this on the extension for us the mortals using 3.3 u_u

FranAlt

  • Posts: 169
I managed to install the extension, but I don't have this block. Is it not necessary anymore? Because I don't seem the get connection right.



Swipe - FREE          Cloud Run - FREE              
                                  
         iOS                                Android
    Android

mdotedot

  • Posts: 1654
Hello FranAlt,

It is replaced by the wrapper block (because you might want to set a variable to true if connection is made for instance)
So it is now:
+==== ScoreBoard Server URL: xxxxx AppID: xxxx SecretID: xxxxxx-----
|
+================================
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

Joraanpe

  • Posts: 287
Heya M.E. i know this might be pretty off topic, but didn't know where to ask you about it. I just updated the build of stencyl and your textfield behaviour starting giving some issues for compiling, maybe you know why, and if there is anything we can patch to solve it?

These are the error messages:

Code: [Select]

TextField: Too many arguments
from scripts.Design_68_68_TextField
line: 162
columns: 21-79
TextField: Function 'new' requires arguments : actor
from scripts.Design_68_68_TextField
line: 162
columns: 21-79
TextField: com.stencyl.behavior.ActorScript has no field hideKeyboard
from scripts.Design_68_68_TextField
line: 163
columns: 2-21


mdotedot

  • Posts: 1654
Hello JoraanPe,

The TextField behavior worked for 3.1 and 3.2.
Now 3.3 has again changes in the API.

I've created a TextField3_3 behavior that seems to work on 3.3.
The only thing I tested was Flash and Android, so I hope that native and iOS work too but I can't confirm.

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