Archive for the 'Development' Category

JSON API Tweaked + example data

I’ve altered the SL Search API to always return the “url” field, and also replaced the “uuid” field for events (which returned incorrect data) with an “id” field that correctly marks the ID.

All current bugs in regards to returning blank or null fields have been fixed. In addition, I have added to the URLs for the search (actually it did this before, but I forgot to document it)

It can now accept the following format:

http://services.katharineberry.co.uk/search/search/(main|teen|mature)[/(all|classifieds|events|groups|people|places|wiki)]/search+term[/page-number]

The new parameter is in bold, and is entirely optional. It sets the category through which to search. Some example URLs:

http://services.katharineberry.co.uk/search/search/teen/test+search – A search for “test search” on the TG
http://services.katharineberry.co.uk/search/search/teen/groups/Group – A search for “Group” in all TG groups
http://services.katharineberry.co.uk/search/search/teen/places/Land/2 – Page 2 (results 11-20) of a search for “Land” in all TG places
http://services.katharineberry.co.uk/search/search/main/test+search – A search for “test search” on the MG
http://services.katharineberry.co.uk/search/search/mature/test+search – A search for “test search” on the MG, with mature results enabled.

Click here for examples of each type

Demotivating

I hate it when my text editor crashes. I really don’t have the motivation to waste my time redoing what I’ve already done. This is even more annoying if it truncates the file while saving, but crashes before writing the new one.

New search for AjaxLife will have to wait until I can be bothered to re-code it. Again.

The code now looks something like this:

AjaxLife.NewSearch = function() {

}();

*sigh*

JSON SL Search API

I’ve made a JSON-based interface to the new SL search, which provides access to all data available (I think).

All the methods have the base URL http://services.katharineberry.co.uk/search/.

Firstly, the search itself. This provides acccess to either MG or TG search, and provides information about all results on the page. It also supports specifying a page.

The format is as follows:

http://services.katharineberry.co.uk/search/search/(teen|main|mature)/search+string[/page-number]

The /page-number must be an integer, and is optional. If you use “teen” you get TG results, “main” gives MG results, and “mature” gives MG results with mature enabled. The output, assuming you know what JSON is, is fairly self-explanatory.

Additionally, you can access a bunch of other data:

http://services.katharineberry.co.uk/search/classified/required-uuid

http://services.katharineberry.co.uk/search/place/required-uuid

http://services.katharineberry.co.uk/search/resident/required-uuid

http://services.katharineberry.co.uk/search/region/required-uuid

http://services.katharineberry.co.uk/search/event/eventid

http://services.katharineberry.co.uk/search/group/required-uuid

Excluding events, all of the above expect a UUID in place of “required-uuid”. They can take both hyphenated and unhyphenated UUIDs. Events expect an Event ID, which are currently seven digit integers.

It can also pick out up to the top 100 popular places (I could do more – up to 50,000 – but capped it at 100 to save my server from certain death). The format for this is as follows:

http://services.katharineberry.co.uk/search/popular/(main|teen)/count

Using “main” gets MG data, “teen” gets TG data. “count” specifies the number of results to be returned.

Finally, as a bonus feature, if you have a key and have no idea what it’s for, put it in like this:

http://services.katharineberry.co.uk/search/unknown-uuid

This will make it search through the classifieds, parcels, residents, regions, events, groups, and textures. If it’s any of the above (except textures) it’ll return the same output as the standard services, with the added property “uuidtype” being set to one of the above. If it was a texture you only get the uuidtype. Please note that this takes several seconds to run, and is a relatively heavy job for my server.

I hope someone finds some use for this. Personally, I plan to use it in AjaxLife.

AjaxLife search

I am aware that Linden Lab have released the new search officially. As such, I will be looking into what I can do about integrating it nicely onto AjaxLife over the weekend.

I suspect my solution will involve PHP, regular expressions, and JavaScript. Although I may make this part of the executable, in order to assist those who would be trying to run AjaxLife themselves (if any are).

Edited to fix myriad typos caused by my posting this from my phone while lying in bed.

AjaxLife teleports broken

The rolling restart appears to have broken AjaxLife’s teleports. Judging by the debug log, it’s also mutilated libsecondlife in some awkward CAPS-related way. (WARNING: System.ArgumentException: Object type System.Int32 cannot be converted to target type: System.Int16)

On another note, I’d just fixed AjaxLife to work with libsecondlife version 0.3 (instead of some semi-outdated svn revision). I’m postponing pushing this out until teleports are fixed.

AjaxLife updated

New AjaxLife features and fixes. Yay.

New features:

  • Minimap display – shows a heightmap of your surroundings, plus marks positions of everyone in the sim in the same way as LL’s minimap.
  • Your position in the top-left corner – because it’s helpful to know where you are. Also, this one is better about updating if you’re involuntarily moved.

Bugfixes:

  • Teleporting to a position no longer consistently fails.

Known issues

  • The minimap displays you twice – once as a yellow indicator and once as a green dot.
  • You rotate on the spot. :P
  • Logging into the Havok4 beta fails unless you have recently done so using an official LL client.
  • The minimap doesn’t work in Internet Explorer – and it never will, given IE doesn’t support the canvas tag.
  • The minimap is completely useless at higher altitudes.
  • The minimap doesn’t display the whole sim unless you teleport around it. It should display everywhere in your vicinity, however.

Also, if the minimap is causing problems for anyone, please let me know! In testing it didn’t have any performance impact, but…

UPDATE: Fixed some potential issues in IE. Also, attached a screenshot I intended to attach but forgot.

AjaxLife updated

UPDATE 2: Fixed a bug causing the map to be offset by 16 pixels metres.

More canvas fun

Here’s a second attempt at rendering a minimap using the <canvas> tag:
High-res canvas minimap

However, rendering this takes my computer a good 1.5 seconds, during which the browser hangs – too long to be practical in an interactive web app with impatient users. :p

This one takes under a second, and is thus more likely to make it into AjaxLife:
Medium-res canvas minimap

Both of those are, however, a significant improvement over the last attempt:
Canvas!
Note that this one was erroneously rotated and flipped.

Of course, the minimap built into SL is significantly better than all of the above. But hey! :p

Playing with canvases

Playing with the HTML <canvas> tag:

Canvas!

This is a test of rendering a sim map inside AjaxLife using JavaScript. The green markers are people – it does the same same above/below/level thing as the client. The whole thing takes a split second to render on my MacBook. I imagine it’d take longer if I included the missing points (that’s being done at a 64×64 resolution).

Not exactly great, is it? Better than nothing though – still working on it. Anyone happen to know how the client puts the sim images together? ;)

On an unrelated note, I’ll be returning from abroad tomorrow.

AjaxLife updated

I have made a couple of improvements to AjaxLife:

  • It now runs in Internet Explorer – mostly. Due to speed issues some of the fancy UI stuff was disabled. The same effects are disabled on the Wii. Additionally the stats window refused to render in IE, so I was lazy and disabled it in IE.
  • Scripts now have syntax highlighting. Woo!

Hooray for updates. Please note that loading inventory is not recommended in IE – it will tend to make it hang for a length of time proportional to the number of items in your inventory – but a folder with more than about five items will have a noticeable delay. I gave up waiting and forcibly terminated it when I opened my textures folder.

UPDATE:

Screenshot:
[Screenshot lost due to WordPress failing]

Also, note that if you click a function, event or type, a new window will open containing the relevant SL Wiki page. (note the status bar in the screenshot. Also note that it capitalises the first letter, as it should for the wiki).

Oh, and I gave the post a title. “Post #124″ just wasn’t doing it.