Monthly Archives: June 2011

Quest 5.0 Beta 2 released

It’s been another busy month of Quest development, and I’ve just released Beta 2.

The main change in this release is a substantial redevelopment of the Editor UI – it is now written in WPF, which has made laying out dynamically sized controls much easier. In particular, this is what has enabled me to implement the new-look Script Editor, as described in last week’s blog post.

Aside from that, all bugs that were logged against Beta 1 have now been fixed, and I have also implemented a few other features:

Static Picture

You can now keep a picture at the top of the screen, while the text scrolls beneath. This has been a common request for years, and I’m glad to have finally implemented it. Using HTML means that you can use any picture size you like, and the frame will resize accordingly. It means that it works the same wherever your game is being played – whether in the Quest desktop software, or online via the WebPlayer. It also means that in upcoming versions I’ll be able to extend this functionality to enable things like using a YouTube clip in the static frame instead.

Timers

Timers are now implemented, and you can use them in a couple of different ways. First, you can use them in the same way as in earlier Quest versions, where you can run a script at specified intervals. But there’s a new simpler way of creating a “one off” timer, which will run one time only, after a certain time period has elapsed. This creates a timer object behind the scenes, so even if the player saves the game and reloads it later, the timer will still be triggered at the correct time.

Turn scripts

Turn Scripts are analogous to timers, but instead of running a script at specified time intervals, you can run a script every time the player enters a command. You can create multiple turn scripts in the game or in different rooms, and enable/disable them at will, so it’s a bit more flexible than the “afterturn” scripts from previous Quest versions. Also, just as you can now run a script after X seconds have elapsed, you can now run a script after X turns.

Random Numbers and Expression Templates

I’ve added functions to generate an integer in a range (say, from 1 to 10) and to generate a random floating point number (between 0.0 and 1.0). With the new Expression Templates (covered in the previous blog), I was able to easily add some nice templates to the editor:

  • When adding an “if” script, you can choose “random chance” from the dropdown. You can then enter a percentage between 0 and 100, and that script will then have X% chance of running.

  • When setting a variable value, it’s very easy to say you want to choose a random number:

Packaging games

In Beta 1 you could save your game as an ASLX file, but there was no safe way to distribute your game. Beta 2 comes to the rescue with a new “.QUEST” file format, which is similar to the CAS format in previous versions. It will take your game, including all libraries and external sound, picture files etc., and output one .QUEST file. This will be the file format you’ll have to use to upload your game to textadventures.co.uk. This will ensure that games written for one version of Quest will still work in future versions, as the entire Core library will be included within the .QUEST file, so there won’t be any incompatibility problems as features are added and changed in the Core library.

Other features

You can now put what the player types next into a string variable, ask the player a “yes or no” question, and there’s a full-screen option if you want to go completely old-school and get your Windows taskbar out of the way.

Download now

You can download Beta 2 now from the Quest 5.0 Downloads page.

You can subscribe to the Quest announcements mailing list, and get updates on Twitter via @TextAdv and @alexwarren.

If you have any questions or problems, please ask in the Quest 5 Forum or check the Quest 5 documentation wiki. Please report any bugs on the forum or the Issue Tracker, or email me at alex@axeuk.com.

Programming visually – the Script Editor in Quest 5.0 Beta 2

I’ve often described Quest as allowing you to create text adventure games “without programming”, but of course that’s not strictly true. While you could create a game without using any scripts at all, you’d only be able to tap into very basic, default behaviour, so it would be quite a boring game.

What Quest has always aimed to do is to make creating scripts easy, by taking a different approach to programming. You still enter commands, use variables, functions and so on, just as in “real” programming, but the Script Editor guides you through the process and tries to make it as intuitive as possible. There’s no need to remember syntax, type in strange punctuation or even remember the names of commands, because the Script Editor shows you all the available commands, and guides you through entering their parameters.

It essentially presents a graphical layer in front of the underlying code. The underlying code is still there, and in Quest 5 it looks pretty much like any other programming language, but the Script Editor shields you from all of that, and displays as much as it can in plain English. The aim of this approach is that you should be able to get started quickly, even if you’ve never programmed before, but also know that you have as much power as you could ever need if you delve a little further.

With the new Script Editor appearing soon in Quest 5.0 Beta 2, I think I have achieved my aim of improving on the design of the Script Editor in Quest 4, making it both quicker and easier to use for beginners, but exposing the full power of Quest 5’s new scripting language for those that need it. At the same time, the Script Editor is flexible enough that new libraries can hook into it to allow the game author to easily use all of the library’s features.

In Beta 2, I have rewritten the Script Editor UI from Beta 1, so it now looks quite a bit different. Here’s an example of the Script Editor showing the kind of script that often appears at the beginning of a game – it prompts the player to enter their name, and then welcomes them to the game:

Behind the scenes, this the script that has been created:

msg ("Welcome! Please enter your name to begin.")
playername = GetInput()
msg ("Welcome, " + playername)

Let’s look at each of these commands in turn, and how the Script Editor helps you to create this kind of script.

First, there’s a command which simply prints a message to the screen. Starting with a blank Script Editor, the only option we have is to expand the “Add new script” section, which gives us a searchable, categorised tree of all the commands we can use:

We can click “Add” or double-click to add this command. Now the Script Editor looks like this:

We can simply start typing the message. No need to worry about closing quote characters, or indeed including quote characters within the message – the Script Editor handles all of that, ensuring the underlying script is created correctly (with any quote characters in the message escaped if necessary).

Next, we want to add a command which will store the next thing the player types in at the command prompt. We click “Add new script” again, and add the “Set a variable or property” command, which can be found in the “Variables” category (or by typing “set” in the search box).

We can type in a name for our variable, “playername” for example. Next we need to enter the value for the variable. We can enter any expression, such as “2”, “foo”, “3+8″, “SomeFunction()” etc. So we could call the function ourselves, but the Script Editor has another trick up its sleeve – expression templates.

Expression templates appear for a number of script commands, and provide access to common functions. They are context-specific, so you see different expression templates for the “set” command than for the “if” command. If you click the “expression” drop-down, you’ll see the available templates. Currently, for “set” you will see this:

(This list may well be expanded before Beta 2 is released, and the templates are defined in the core library, meaning that the list can be easily extended)

Selecting “player input” completes the command, and now we can add the final “print” command to welcome the player. But this time we don’t want to print a static message – we need an expression, so we can include the value of the “playername” variable we created earlier.

A similar dropdown on the “Print” command allows us to switch to an expression:

We can now add the expression “"Welcome, " + playername“, and the Script Editor will give us a bit of help with that, too. The blue triangle to the right of the expression contains a menu which allows us to add things to our expression:

Selecting “Variable” from the menu gives us a drop-down list of all variables in the current scope – in this case, just the “playername” variable we created earlier. Of course, we can simply type the expression too.

To experienced programmers, this may seem like quite a lot of pointing and clicking to create a simple script. You may think that nobody would want to program this way – but the evidence from previous versions of Quest shows that’s not the case. When I first added a visual editor to Quest, way back in 1999, it was far from clear that people would want to program in this way, but people do – the visual editor is by far the most popular way to create games for Quest 4, and while I’ve always supported the ability to “hand code” games using a text editor, pretty much nobody uses Quest in this way. In Quest 5, the Script Editor is even easier to use, and more powerful, so I hope it will allow both experienced programmers and novices alike a way to get started making games quickly. Quest 5 also features a Code View, so the “hardcore” version is just a click away anyway – you can switch back and forth easily.

The new Script Editor will be available in Beta 2, which I’m hoping to release within the next couple of weeks. If you can put up with buggy code and have Visual Studio, you can try it out now by downloading and building the latest trunk code from CodePlex.