tkMOO-light

Experiments with graphics

a futuristic domea biplane

I'm interested in knowing how to produce simple and useful graphical representations of a room, or of objects in that room. In this simple experiment the graphical representation of two rooms of my home MOO are coded in a private data structure (no data is held on the objects themselves) which is interrogated each time I enter the room.

On entering the room described by the futuristic domed structure the client receives the following burst of XMCP:

$#$xmcp-room 20971564 id: #295 url: /User/Andrew.Wilson/dome.300x200.gif 
$#$xmcp-object 20971564 id: #1234 coords: "0 150"
    url: /User/Andrew.Wilson/left.50x50.gif events: e1 callback1: "go n"
there are really only two lines of text here. the xmcp-object message has been broken for reasons of clarity

The room has a backdrop image of a futuristic dome and contains a single object which is represented by an image of a button pointing to the left. The button image is active and will respond to a click from mouse-button-one (called 'e1'). This example shows that the button also carries a callback string which the client logic will send back to the server when the user clicks on the button.

In the distant future the object represented by the 'left arrow' could be a child of $generic_gui_aware_object which would define trusted verbs for implementing callbacks of the form:

    @xmcp_guievent #1234 e1
or some variation on this theme. For now, I'll just acknowledge that transmitting untrusted callback strings back to the server is utterly wrong and stupid.

Clicking on the left arrow causes the user to walk to an adjacent room, with the backdrop of a biplane. This room also contains a button, this time a 'right arrow' which is defined so that clicking on it will cause the user to walk to the first room.

The client extracts the 'url' component of the XMCP message and gets the image from a local webserver using the normal HTTP protocol, caching the Tk image internally so that revisiting a room results in faster rendering of the scene. Right now the full URL is assumed to be http://127.0.0.1<whatever> but it could easily be any remote URL.

The objects in the room can be put to many uses. Exits might be represented as carefully placed doors or windows embedded in the backdrop image. Similarly a range of other events can be envisaged, so that for instance you might click on the image of a light switch, causing an illuminated backdrop to be loaded. An extra degree of interraction is possible if players too are represented as graphical objects... it's about here that we get into the realms of Fujitsu Habitat and it's many variants.

a simple room with interesting objects

Future thoughts