Monday, May 27, 2013

PlainText announces Windows support

The PlainText engine has been going around for a while now, but up until now I could never list Windows as a supported platform next to Linux and OS X. The simple reason being that neither at work nor at home I use Windows.

However, thanks to a helpful user I can now list Windows 7 as another tested platform. It turned out there was only a minimal change needed to the build files. In addition, thanks to Chris I have now included instructions in the README and the Wiki that should help to get Windows users started with PlainText.


Thursday, February 7, 2013

PlainText Demo + Mini-Quest

After some heavy development of the past weeks, I have updated the demo world and created a little mini-quest to introduce the new functionality. But first let's see what's new:

  • Rooms have dynamic descriptions now, which include spatial relations. This started after a discussion on MudBytes.
  • Looking at items or portals can reveal other items or portals that are in close proximity.
  • Looking into arbitrary directions, and turning to directions is now properly supported and shows generated descriptions of whatever's nearby in the direction you're looking.
  • Some heavy updates to the map editor. Not visible on the demo server unless you got an admin account, but look at the screenshots to get an idea.
  • Lots of bugfixes.
Okay, now onto the mini-quest. Remember it's not really a quest with a storyline or anything else, it's just a little teaser to invoke some participation, give an idea of the new features, and gather feedback...

Alright, the demo world contains part of a little city called Middle Port. There's a city wall which you can get on top of after a little bit of effort. From the city wall you can see the roofs of various buildings, and you will be able to see a man on those roofs. Normally, this man is a little too far to see much details about, but nonetheless there is a way to get close-up view of him. If you manage to do this, you will be able to answer the following question: What's the sigil of the man on the roof? Anwers can be posted in the comments :)

If you've done the mini-quest, or maybe get stuck, I'd be interested to hearing your feedback! What did you like best about the experience? What did you like least about the experience? Specifically, how do you experience being able to see and hear events from other rooms? 


The demo server can be reached at

Wednesday, January 16, 2013

Two-way data-binding with Laces.js Tie

This post will sidetrack a bit from the conventional PlainText blog, to cover a JavaScript library I wrote to assist with the map editor. If you have no interest at all in JavaScript, feel free to skip this post :)

The PlainText map editor is an HTML5 application that has to maintain a complete model of the game world on the client. On startup, it fetches all Areas, Rooms and Portals from the server, and keeps them in its own model, feeding changes back to the server.

Apart from feeding back changes, there are various views that all need to properly reflect the model. There's the main canvas view showing a graphical layout. There's the sidebar showing information of the selected Room. There's an Areas menu and an Areas editor. There's a Portal editor. Keeping all these views in sync meant that I needed to have a proper model, with proper data bindings so that various modules could be notified of changes. For this purpose I created my own model micro-framework: Laces.js.

Laces.js by itself provided just the model that I needed, but why stop there? With Laces.js any module could bind to the model, so that they could update their view. But why not create a direct binding between the model and the view, so that no (or at least less) manual updating is necessary? And what if changes to the view could directly be fed back to the model? This is called two-way data-binding, and it's traditional territory to MVC frameworks. But I didn't want a full-fledged MVC framework*, yet I did want two-way data-binding.

Meet the Laces.js Tie add-on.

Let's say we have a model variable that has a selectedRoom property. selectedRoom can by null, but it may also be a Room object, with properties such as id, name, description, etc.. This model itself could be created like this (we'll ignore any other useful things the model might have for now):

Now let's say we will want to show the name and description of the currently selected room. We can do this using a Laces.js Tie:

The above code will literally tie the HTML fragment to the Laces.js model, making sure the HTML stays up-to-date when the selectedRoom property or its subproperties change. But we can take it further by allowing inline editing of the properties:

Now when someone double-clicks one of the properties, it will turn into an input field, and when they make changes, those will be automatically saved to the model. Of course you can customize what event you prefer to use for editing. So if you want to enable editing through single click:

Besides plain HTML strings, you can also tie your model to a multitude of template engines. Laces.js Tie has already been confirmed to work in tandem with Handlebars.js, Hogan.js and Underscore.js' built-in template engine.

If you want to know more about Laces.js or the Laces.js Tie add-on, just check the project page.

*) Check the Rationale on the Laces.js project page for why I didn't want this.