Recent Posts

ExVenture Updates for December 2017

Posted on 26 Dec 2017

The last month of ExVenture mostly saw behind the scenes updates. Lots of small tweaks here and there in the admin interface along with documentation of modules and functions.

The documentation website is You can see the latest additions here on MidMUD, my running instance of ExVenture.

Effects updates

Items that you are wielding are now included in the effects calculation. So if you use a dagger to use a magic skill, the dagger's damage will also be included, but the magic damage can be halved due to a damage/type restriction on the dagger. So wielding the correct weapons will help maximize your damage output.

Also new are continuous damage effects, damage/over-time. These deal immediate damage and then tick every milliseconds, up to a maximum count. This can be used for things like poison.

  'kind': 'damage/over-time',
  'type': 'slashing',
  'amount': 10,
  'every': 1000,
  'count': 4

Finally there is a recover effect that healing was converted to. This is a more generic version that can recover skill points and move points along with health points.

Pagination and filtering

A lot of the admin sections now paginate and have a filter on the side for searching. This started to become required as I filled in more things in MidMUD. Here is the NPC admin:

NPC Admin Filtering

User admin

The User admin got some sprucing up, the index has pagination and filtering now along with displaying more information. The show for a user displays about the same information but does it in a lot nicer way. When someone is signed in you can also see live stats such as which room they are in.

User Admin Index

User Admin Show

Item Admin

I've recently put a lot of work into the item admin. I want to have a more filled in world as people start stumbling across the game. The items index was a simple list before adding fitlering to it. I also renamed ItemTag to ItemAspect to allow a normal tags field to sit on items. Item cloning was also added (pre-fill the new form) to help speed up sets of items, such as a full leather armor set.

Item Admin Index

Use items

A new command was added use which uses an item in your inventory on yourself. There is no ability to target yet, it simply applies the effects to yourself, good or bad. That means you can use sword on yourself and take damage.

Shop command interface

I log commands that people try to use and get a parse error. A lot of these were related to the shops command. I tried updating that to make it more usable. Most interfacing with shops will now be a lot more smooth when there is only one shop is the room. I also added a final parse catch to display help information if the command starts with shop. Hopefully there will be less troubles with this part of the game in the future.

Small tweaks

  • Game inventory collapses duplicate items
  • Edit game name and MOTD from the web panel
  • Slightly nicer prompt output for dealing continuous effects/using effects

Social Updates

I posted about someone finding the game and playing around for 15+ minutes on twitter, and included a photo of their stats. That was retweeted by @elixirlang and a lot of people found the project because of it. Welcome new people!

Next Month

I will copy last months goals here as I didn't get around to doing a range of damage. I have a few small tweaks I'd like to make, such as mass adding spawners. For a big goal I think adding in a general item listing to the public side of the app would be good. I think it makes sense to add it in because you can view the stats of any item in World of Warcraft, so letting people look around for cool things to hunt out seems like a good addition.

ExVenture Updates for November 2017

Posted on 28 Nov 2017

The last month for ExVenture has seen a lot of NPC changes and lots of documentation. The documentation website is You can see the latest additions here on MidMUD, my running instance of ExVenture.

NPC Events

I have expanded a lot on the event system for NPCs. You can see a full list at

NPCs wandering around, and triggering aggro

The most exciting thing that happened was NPCs can now fight back! They will also wander around near where they spawned and aggro players if they stumble into any. This is all stored and edited in a huge JSON array right now, but I would like to eventually make it a nice interface. This is the bandit's events on MidMUD:

    "type": "room/entered",
    "action": {
      "type": "target"
    "type": "combat/tick",
    "action": {
      "weight": 10,
      "type": "target/effects",
      "text": "{user} slashes at you.",
      "effects": [
          "type": "slashing",
          "kind": "damage",
          "amount": 2
      "delay": 2.0
    "type": "tick",
    "action": {
      "type": "move",
      "max_distance": 2,
      "chance": 25


I have finished a first pass at the documentation site. All of the large systems in the admin panel have documentation at this point. There are still a few small things with rooms and NPCs that need documentation.

Item instances

Items now create instances, and are tracked as such. This allows extra data to hang out with the item id. Right now only created_at is included with the id.

Minor Tweaks

A few minor tweaks that make life nicer:

  • Registration can be via the web
  • Registration will display errors if any come up
  • Commands parse a little better, backend code could be deduplicated
  • Common mistakes such as kill target and point users towards the help system
  • Set a target when using a skill, magic missile target
  • Ask for optional email, and allow registering via the home page

Next Month

Next month I'd really like to continue with combat. Right now there is a static amount of damage you will do, it might be nice to do a range of damage. I also want to add in some kind of dodge mechanic. Items also don't affect combat at all either.

ExVenture Update November 2017

Posted on 01 Nov 2017

The last month for ExVenture has seen mostly metrics improvements and some client additions. There is also a new website for it at You can see the latest additions here on MidMUD, my running instance of ExVenture.


Grafana Dashboard

I started looking into Prometheus for work and started adding in metrics for various aspects of ExVenture. Some of the metrics include:

  • exventure_command_parsed_in_microseconds
  • exventure_command_ran_in_microseconds
  • exventure_command_bad_parse_total
  • exventure_player_count
  • exventure_session_total
  • exventure_login_total
  • exventure_login_failure_total
  • exventure_new_character_total


The server also supports GMCP now, either through normal telnet or the web client. The web client has it pushed over as a special websocket event. GMCP Modules now supported are:

  • Character
  • Character.Vitals
  • Room.Info
  • Room.Characters.Enter
  • Room.Characters.Leave
  • Target.Character
  • Target.Clear
  • Zone.Map

More information about these can be found on the wiki.


New Client

The updated web client uses the new GMCP pushes to allow stat bars and a side bar with room information and a mini map.


Maps got a fairly big update in that multiple layers are supported, there are doors now, and you can go up and down. Multiple layers allow things like going under a bridge or heading up to the second floor of a house.

Doors are now in place and prevent movement between rooms if they are closed, obviously. They are indicated with a = for closed and / for open states.

Finally up and down are movement directions. There isn't map indication yet, but I want to add something similar to this:

|[ >|
|   |
|< ]|

Next Month

I want to add more in terms of NPC interaction. I started on an event system for NPCs that can really only respond to things it hears and when a character enters a room. I want to add in targetting and combat back from NPCs.

A few people have signed into the game and I get to see what they attempt to do and failed at. I think a goal every month will be to continue to smooth out things that people are attempting to do.

Links from ElixirConf 2017

Posted on 09 Sep 2017

These are the links I gathered while watching talks at ElixirConf 2017.

Adding Phoenix to an OTP Elixir App

Posted on 05 Sep 2017

For my side project, ex_venture, I wanted to add a web client that allowed players to connect not just via normal telnet. This meant I needed to add Phoenix. I was excited to try this out because the phoenix devs keep saying how you should just think of it as a layer for your app, not the app itself. Since I had an app already this was the perfect trial.

Brief note: ex_venture is a MUD engine, the protocol up until now was only telnet.

Adding Phoenix

Adding phoenix was a pretty simple affair. It took about 2 hours to get it up and running in a simple form. Here is the commit that adds it entirely. I mostly copied from a new phoenix project and took what I wanted.

The fun part was the TelnetChannel that talked with my session module similar to the normal telnet socket.

Phoenix <-> OTP communication

Another interesting part of this addition was I could add a web admin panel to the game. With this I wanted live updates to the game. If I added a new room to a zone, then I should see it reflected immediately in the game. I achieved this by creating bounded contexts that talk to the data layer then push the update into the OTP layer.


Updating a zone

This shows off updating a zone and pushing the change live into the game. The controller knows nothing about the OTP. Web.Zone is a layer between Phoenix and the game.

alias Web.Zone

def update(conn, %{"id" => id, "zone" => params}) do
  case Zone.update(id, params) do
    {:ok, zone} -> conn |> redirect(to: zone_path(conn, :show,
    {:error, changeset} ->
      zone = Zone.get(id)
      conn |> render("edit.html", zone: zone, changeset: changeset)
alias Data.Zone

def update(id, params) do
  zone = id |> get()
  changeset = zone |> Zone.changeset(params)
  case changeset |> Repo.update do
    {:ok, zone} ->
      Game.Zone.update(, zone)
      {:ok, zone}
    anything -> anything
# pid expands to the elixir Registry
def update(id, zone) do
  GenServer.cast(pid(id), {:update, zone})

def handle_cast({:update, zone}, state) do
  {:noreply, Map.put(state, :zone, zone)}

Adding a new room to a zone

This shows off how the Room admin will spawn a new room in a zone after being created. The controller knows nothing about OTP. Web.Room is a layer between Phoenix and the game.

alias Web.Room

def create(conn, %{"zone_id" => zone_id, "room" => params}) do
  zone = Zone.get(zone_id)
  case Room.create(zone, params) do
    {:ok, room} -> conn |> redirect(to: room_path(conn, :show,
    {:error, changeset} -> conn |> render("new.html", zone: zone, changeset: changeset)
alias Data.Room

def create(zone, params) do
  changeset = zone |> Ecto.build_assoc(:rooms) |> Room.changeset(params)
  case changeset |> Repo.insert() do
    {:ok, room} ->
      Game.Zone.spawn_room(, room)
      {:ok, room}
    anything -> anything

When the Room.Supervisor comes online it lets the zone know it's PID to spawn new rooms in.

def spawn_room(id, room) do
  GenServer.cast(pid(id), {:spawn_room, room})

def handle_cast({:spawn_room, room}, state = %{room_supervisor_pid: room_supervisor_pid}) do
  Room.Supervisor.start_child(room_supervisor_pid, room)
  {:noreply, state}

The Room.Supervisor starts the new room in the supervision tree.

def start_child(pid, room) do
  child_spec = worker(Room, [room], id:, restart: :permanent)
  Supervisor.start_child(pid, child_spec)


Adding Phoenix to an regular OTP app was incredibly simple and the Phoenix team did what they set out to. I hope you explore the rest of the app to find more examples of Phoenix <-> OTP communication.

Eric Oestrich
I am:
All posts
Creative Commons License
This site's content is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License unless otherwise specified. Code on this site is licensed under the MIT License unless otherwise specified.