Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This sample is a simple multiplayer text adventure game inspired by old-fashioned, text-based adventure games.
Instructions
- Navigate to the Orleans Text Adventure Game in the samples browser experience.
- Select Browse code to view the source code.
- Clone the source code and build the solution.
- Start the AdventureServer first, then the AdventureClient.
- You are then prompted to enter your name on the command line. Enter it and begin the game.
For more information, see Building the sample.
Overview
The AdventureServer program starts by reading an AdventureMap.json file.
It sets up a series of "rooms" such as a forest, beach, caves, a clearing, etc. These locations connect to other rooms to model the places and layout of the game. The sample configuration describes only a handful of locations.
Rooms can contain "things" such as keys, swords, etc.
The AdventureClient program sets up your player and provides a simple text-based user interface allowing you to play the game.
You can move around rooms and interact with things using a simple command language, saying things such as "go north" or "take brass key".
Why Orleans?
Orleans allows you to describe the game using very simple C# code while enabling it to scale to a massively multiplayer game. For this motivation to be meaningful, the labyrinth of rooms needs to be very large and support many simultaneous players. One value of Orleans is that you can design the service for growth; the overhead of running it at a small scale isn't significant, and you can remain confident it will scale if the need arises.
How is it modeled?
Players and Rooms are modeled as grains. These grains allow you to distribute the game, with each grain modeling state and functionality.
Things such as keys are modeled as plain old objects—they are just simple immutable data structures that move around rooms and among players; they don't need to be grains.
Possible improvements
- Make the map much, much bigger.
- Make the brass key unlock something.
- Allow players to message each other.
- Make eating food and drinking water possible and meaningful.