RL: Lockdown day 4, Isolation day… 10ish? Maybe. I hope you are all safe.
Over in SL: I’ve made some progress exploring what data I can get about users visiting my location. Essentially by getting a list of avatars in the parcel, and then for each of them using llGetObjectDetails I can get some basic info about avatars who visit.
The unit I’ve built keeps track of who has been there before and either says “Welcome” or “Welcome back” when they appear. Yes this is essentially a greeter and yes I know there are a thousand scripts for this or free units I could have got on the marketplace… but I wanted to make my own for two reasons:
- As a learning exercise
- Because my version does more than just saying Hi.
Below this inworld unit I’ve built a REST API on my web server. The ‘greeter’ checks in with this, when it loads and whenever someone arrives at or leaves the parcel. Anonymised data is then stored in a database and we can start to derive some stats, including some real-time stats.
The reason I wanted this outside of Second Life is that I wanted to enable some interesting real-world-linked stuff that consumes this data. Eventually this will feed back to sounds streamed back to the parcel, and also interactive objects in the region can respond to it too. But for now we just have some raw stats. And basic at that.
The raw API URL being used here (which is public) is https://api.lostware.uk/1.0/sl/guests/stats – this returns the raw JSON data, not really intended for displaying in a web browser.
Incidentally most of the API methods are authenticated i.e. not public. However this specific URL only returns anonymised statistical data so can be safely made public without the need to authenticate.
- avatars_all_time is unique avatars. i.e. The same avatar coming back is not counted again. avatars_current is how many are there right now.
- avatars_body_shape_type_percent represents the user’s gender expression in their avatar shape. See here. Essentially 0 is a female body type, 100 is male (I have scaled it into a percentage) and anything in between is a customised shape deemed by SL to be intermediate. So far users appear to be either 0 or 100 on this scale.
- Average ages (for current and all-time) are currently null. This is because ‘avatar date of birth’ is not available via llGetObjectDetails. I need to update the greeter to fetch this just once per new user using llRequestAgentData which is an asynchronous request. Once this is hooked up the unit will post that data separately and update the visitor records in the database with their birth date (if those users come back).
- There is a 30 second in-memory cache on this to avoid the chance of some rogue script overloading the database.
- Before it goes into my public venue I will implement some kind of opt-in to having your avatar data collected. However it is only going to be used for artistic purposes.
Visitor numbers are currently low because this is just code running in my houseboat in Bellisseria, and there is nothing to come and see! Nobody knows about it apart from my small number of friends (noob, remember). But eventually I will build some kind of public venue.