How to find out the total number of useres in a zone, from the AS3 client sied API
eg. when my user logis in, i want to use the AS3 Api to get the number of players in the users zone
number of users in a zone
Re: number of users in a zone
Hi.
Well, you can't get it from the client-side, but you can use a simple Zone-Level Extension to handle the job. Now it depends on how you want to organize things.
You could, for example, have an Arrival Zone where everyone would initially connect and retrieve from the extension the zones list and their user count.
Another way to accomplish is to set a task to run about every 5 minutes and each time it runs, it gets all zone's user count and updates a database or a xml file of your website.
Well, you can't get it from the client-side, but you can use a simple Zone-Level Extension to handle the job. Now it depends on how you want to organize things.
You could, for example, have an Arrival Zone where everyone would initially connect and retrieve from the extension the zones list and their user count.
Another way to accomplish is to set a task to run about every 5 minutes and each time it runs, it gets all zone's user count and updates a database or a xml file of your website.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: number of users in a zone
Hello!
Please advise me what is a better way: create client request handler or generate xml file for embedded Jetty container with http access?
Please advise me what is a better way: create client request handler or generate xml file for embedded Jetty container with http access?
Re: number of users in a zone
Hi.
Well, the downside of the xml file approach is that the browser tends to cache those kind of files when you access them multiple times. The positive aspect of this approach is that this way you would release some of the pressure from the server, by handling this request outside of it.
The easiest way is to have a Client Request Handler in your Zone-Level extension that returns the value of the current Zone's user count. If you don't need to show such an accurate user count, then you can use a task that runs at a specific rate which, every time it runs, it checks all the Zone's user count and updates a local variable on the extension. Then, when a client asks for the user count, the extension can easily return these stored values, instead of calculating it at every request. The only downside of this approach is when you have multiple zones, as then you would need to connect 2 times to the server before being able to play the game: one for retrieving the Zone's data and the other one for finally logging in.
Well, the downside of the xml file approach is that the browser tends to cache those kind of files when you access them multiple times. The positive aspect of this approach is that this way you would release some of the pressure from the server, by handling this request outside of it.
The easiest way is to have a Client Request Handler in your Zone-Level extension that returns the value of the current Zone's user count. If you don't need to show such an accurate user count, then you can use a task that runs at a specific rate which, every time it runs, it checks all the Zone's user count and updates a local variable on the extension. Then, when a client asks for the user count, the extension can easily return these stored values, instead of calculating it at every request. The only downside of this approach is when you have multiple zones, as then you would need to connect 2 times to the server before being able to play the game: one for retrieving the Zone's data and the other one for finally logging in.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Return to “SFS2X ActionScript 3 API”
Who is online
Users browsing this forum: No registered users and 21 guests