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.

Cheers!

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? 

Cheers!

The demo server can be reached at http://mud.yunocloud.com:8080/.

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.

Monday, December 24, 2012

Map Editor updates

Last two weeks I've spent quite some time on improving the map editor. Some noteworthy improvements from the last two weeks:

  • I've swapped out KineticJS to use FabricJS instead. FabricJS turned out a little harder to integrate than Kinetic, but it's giving me some real advantages:
    • Export to SVG - you can export your complete maps to SVG now
    • Built-in selection support - I will exploit this further in the future
    • Nicer positioning (items are positioned by center rather than top left corner) - this made it a lot easier for me to implement displaying room names on the map, for example
  • Performance has been drastically improved. Zooming, changing perspective, all are now fine, even with 10,000+ rooms. Only the initial loading may still be slow.
  • Support for Areas. You can easily choose which areas are visible and which are not. Especially useful with areas that (partially) overlap.
  • Z-level filtering. Designing a skyscraper or a cave with multiple floors? Using z-level filtering you can filter out anything not on the current floor so you regain oversight.

Monday, December 17, 2012

PlainText engine going into beta

Hey all, welcome to the new PlainText blog. I'll start with the announcement I sent out last week :)

After many months of refactorings and heavy lifting, my engine PlainText is going into beta. What I mean by this is that the amount of changes to the core engine are expected to slow down from this point, and focus will shift toward fixing bugs, doing high-level work like improving the map editor, and working toward my own game which I may announce at a later date when there's something more concrete to show :)

The main distinctive features of PlainText are:

  • Game events that propagate through multiple rooms. Hear sounds and see visuals as they happen in nearby rooms. Sounds and visuals lose strength and become increasingly blurry over distance and we use a semi-realistic line-of-sight algorithm to determine what you can see and what not. Currently we are just scraping the surface with this, but already it creates a much more immersive, rich and lively game world.
  • Extensibility is provided through JavaScript. Whether it's triggers or other methods for extending game objects, the combat system, session handling, or implementing commands, all can be done with nothing but JavaScript knowledge.
  • HTML5 map editor makes life easy for builders. This is one of the areas that will see a lot of attention during the coming months.
  • High-performance multi-threading C++ core, designed for minimal latency. There's no database involved. While this is a continuous effort, the goal is to be able to contain a game world with about 1,000,000 rooms in memory on a server with 4GB RAM, and to be able to handle potentially hundreds (at least) of concurrent users.

If anyone is interested in building a MUD using the PlainText engine, you might be interested in these resources:

Project page:
https://github.com/arendjr/PlainText

Documentation:
https://github.com/arendjr/PlainText/wiki

Forums:
https://groups.google.com/forum/?fromgroups#!forum/plaintext-core
https://groups.google.com/forum/?fromgroups#!forum/plaintext-gameplay
https://groups.google.com/forum/?fromgroups#!forum/plaintext-tooling

Demo server:
http://mud.yunocloud.com:8080/
(use port 4801 if you want to connect with telnet)