Click here to Skip to main content
15,890,438 members
Articles / All Topics

Zork for Lync - Part 1

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
19 Jan 2015CPOL4 min read 6.9K   2  
Zork for Lync - Part 1

zork1_osx

Ok, maybe not only Zork for Lync specifically, but a Z-Machine interpreter for Microsoft's Lync platform.

But first, a little history...

Back in the 1970s, Joel Berez and Mark Blanc created the Z-Machine, the virtual machine used by games company Infocom to deliver its text adventure games, such as Zork, Planetfall and the Hitchhikers Guide to the Galaxy.

These types of games are known as Interactive Fiction, simulated environments in which players use text commands to control their characters as the game plays out. This was before the days of colour graphics, animation and Xboxes!

One of the first computer games I ever played was Zork, on my old Apple ][e (which still runs great today!), so I gave myself a challenge of creating a Zork clone using Lync as the console.

zork

Zork was written in 1977, and utilizes a specialized virtual machine created specifically for the game, interpreting the ZIP (Zork Implementation Language) code.

Today, there are many different Z-Machine interpreters, for a number of different platforms, but as I spent a large amount of my day inside Lync, it seemed logical to extend the capabilities of the UC platform to include non-business application.

Building a Z-Machine

Creating a Z-Machine interpreter is not a simple task, however the standard is well documented, and many people have accomplished this in the past. For the purposes of simplicity, and to allow my interpreter to utilize a large catalogue of games, I'll be working with the .z5 format, and testing using games compiled by Infocom in the 1990s using Zilch.

The application will parse and interpret a decompiled instance of the .z5 files. The output resembles assembly at first glance.

l0007:         jeg57 #84 ~l0008 
               jeg48 #15       rfalse 
               print_ret      "Why don't you just walk like normal people?" 
l0008:         jeg57 #63 ~l0009
               print_ret      "How romantic!"
l0009:         jeg57 #3b ~rfalse
               get_parent     "mirror" local0
               get_parent     "mirror" sp
               jeg6b local0 sp ~l0010
               print_ret "Your image in the mirror looks tired."
l0010:         print_ret "That's difficult unless your eyes are prehensile."

Where Does Lync Fit Into This?

Traditionally, Z-Machine interpreters utilize simple text-based consoles for interacting with the player. This can be via a Java or html5 app, an iOS app, or other desktop applications for a variety of operating systems.

Lync, in its simplest form is an Instant Messaging client having the ability to send and receive text messages between Lync or Skype users.

My Z-Machine interpreter passes its output to the Lync application, and receives commands from the user simultaneously.

One of the great advantages of this is persistence and continuity in normal console games, the user needs to leave the console open to continue playing.

With Lync, gameplay is controlled by the Z-Machine interpreter, and can be continued at any time without having to open a console or other application. Players can move between Lync clients across their devices (PC s, tablets, smartphones) and continue their game at any time.

Communicating with Lync

Lync is complex Unified Communications platform, providing Instant Messaging (IM), Audio and Video conferencing, Application sharing and more.

Microsoft has made available a number of APIs for Lync, and I have chosen UCWA (Unified Communication Web API) as the means to communicate with the Lync client.

zork4lync

Component Description
Hosted Lync Service The beta system is based on telewebica s hosted Lync platform, a multi-tenant Lync 2013 service.
Virtual Lync Client (UCWA Endpoint) Each player communicates with a virtual Lync client, or endpoint, that is dynamically created and connected by the Z-Machine interpreter. As players exit the game, endpoints are disposed of, re-creating themselves when a player returns.
Z-Machine Interpreter Windows server application
SQL Server 2014 Stores game state and analytics
Z5 File Zork 1 game file (or any other ZIL-based game)

Progress So Far

Basic command and text processing is working, my next step is to start creating a simulation of the ZIL memory and stack subsystems to persistently track location and inventory. Whilst still in a very early form, it’s starting to come together.

capture1 Capture2

Get Involved

Interested in helping test this app? Contact me via email or on Lync, and I'll send you details on how to connect to the Interpreter.

Once it's a little more stable, I'll publish details of it here for people to play.

What's Next

Part 2 of this series will show more detail on the UCWA conversations required to build this project.

References

This article was originally posted at http://www.matthewproctor.com/zork-lync

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO Kutamo and ErrLog.IO
Australia Australia
Pluralsight Author, .Net Developer, Writer & Blogger

http://www.kutamo.com/
http://www.errlog.io/
http://www.matthewproctor.com/
http://www.pluralsight.com/author/matthew-proctor

I am an Australian IT professional based in Melbourne, Victoria, Australia.

I'm a polyglot programmer, being proficient in a number of languages and frameworks including C#, VB.Net, F#, Javascript, Perl, Powershell and Z80 & 6502 assembly. Smile | :)

Comments and Discussions

 
-- There are no messages in this forum --