SlideShare a Scribd company logo
First title line
Second line here
Subtitle goes here — no fancy
color block kthough too fussy
smartly.
smartlogic.io
Writing Game
Servers With Elixir
Eric Oestrich
ElixirConf 2020
smartlogic.io
Who am I?
Eric Oestrich
Engineering Manager
at SmartLogic
Who is
SmartLogic?
We build custom
web and mobile
apps.
Based in Baltimore,
we've built over 150
apps since 2005.
Agenda
● Why MUDs?
● What are ExVenture & Kalevala?
● The pieces of Kalevala
● What does Elixir bring?
● Demo
Why MUDs?
Games for Programmers
No Graphix
Anyone can write text
Writing Game Servers with Elixir
What is ExVenture?
First Foray into OTP
ExVenture was my playground for learning OTP
Not everything was well laid out for Elixir
FP written in an OOP style
What is Kalevala?
An Ancient Finnish Text
Or a World Builder’s Toolkit
ExVenture 3.0
Kalevala is a rewrite of ExVenture’s internals
The third iteration
Pieces of Kalevala
Controllers,
Commands,
& Actions
Commanding Controllers
Input and event processing
Series of callbacks to hook into
Breaks up functionality into smaller pieces
Controllers -> Commands -> Actions
Before & After
Modules are broken up
Session process delegates work
Why is this better now?
The Conn
The Conn Struct
Similar to a Phoenix Conn
Character internals build up intents and then
the foreman plays out the intents
Before & After
Writing Game Servers with Elixir
Why is this better now?
Keeps the core functional
See Gary Bernhardt’s Boundaries
Commands do not interact with the world
Events
The Atom of Kalevala
Everything in Kalevala is an event
A generic struct with specific payloads
Rooms act as local PubSub
Before & After
Why is this better now?
Also passed a Conn, to not directly affect
anything
Views
Think Phoenix Views
Very similar to Phoenix views
Render functions
Builds up iodata lists
Output Processing
Transforms data en route to players
Text is reduced over processors
Before & After
Views
Before & After
Output Processing
Why is this better now?
Commands render views instead of outputting
to the socket directly
Iodata lists are fast
List of processors can be changed
Character
Brains
Behavior Trees
A behavior tree is a mathematical model of
plan execution used in computer science,
robotics, control systems and video games.
Per Wikipedia
Behavior Trees
Simple AI
A tree with branches and leaves
Branches are selectors
Leaves are evaluated and influence the selector
Before & After
Sample Brain
brains "generic_hello" {
type = "conditional"
nodes = [
{
type = "conditions/message-match"
data = {
self_trigger = false
text = "bhib"
}
},
{
type = "sequence"
nodes = [
...
...
{
type = "actions/say"
data = {
channel_name = "${channel_name}"
text = "Hello, ${name}!"
}
},
{
type = "actions/say"
data = {
channel_name = "${channel_name}"
text = "How are you?"
}
}
]
}
]
}
Writing Game Servers with Elixir
Why is this better now?
Nodes are just data
Built with protocols
The World
The World
See my talk from The Big Elixir 2019
All Aboard the State Train
youtube.com/watch?v=YbTzKiZIrv4
What does better Elixir
bring to the table?
Functional Core
Data
Transformation
Piece together
functionality
Events as Structs
Demo
GitHub
https://github.com/oestrich/kalevala
Elixir Wizards - elixirwizards.io
wor.fi
@wor_fi
Reach out for a
sticker pack, I’ve
got ~30 or so
Image Credits
https://www.goodnewsfinland.com/feature/in-pict
ures-the-weekend-wrap-1-3/kalevala/
Q&A
First title line
Second line here
Subtitle goes here — no fancy
color block kthough too fussy
smartly.
smartlogic.io
Thanks!
smartlogic.io
First title line
Second line here
Subtitle goes here — no fancy
color block kthough too fussy
smartly.
smartlogic.io
We build custom web
We’ve built 150+ applications since 2005.
Need a custom web/mobile app? We can help.
and mobile applications.
888-544-SMRT / contact@smartlogic.io

More Related Content

PDF
Functional web with clojure
PPTX
Xcore meets IncQuery: How the New Generation of DSLs are Made
PPT
Overview Of Parallel Development - Ericnel
PPTX
XPDays Ukraine: Legacy
PPTX
Exploring SharePoint with F#
PDF
Rider - Taking ReSharper out of Process
PDF
Fun with Functional Programming in Clojure - John Stevenson - Codemotion Amst...
PPTX
Ektron CMS400 8.02
Functional web with clojure
Xcore meets IncQuery: How the New Generation of DSLs are Made
Overview Of Parallel Development - Ericnel
XPDays Ukraine: Legacy
Exploring SharePoint with F#
Rider - Taking ReSharper out of Process
Fun with Functional Programming in Clojure - John Stevenson - Codemotion Amst...
Ektron CMS400 8.02

Similar to Writing Game Servers with Elixir (20)

PPTX
2 Years of Real World FP at REA
PDF
Compiler2016 by abcdabcd987
PDF
Re-Design with Elixir/OTP
PPT
Code Quality Practice and Tools
PDF
Building frameworks: from concept to completion
DOCX
Interview
KEY
Modular Web Applications With Netzke
ODP
Intro To Spring Python
PDF
Towards a Reactive Game Engine
PDF
Lab practical slide show pdf . deeply amazing
PDF
Fun with Functional Programming in Clojure
PDF
Java EE 7 from an HTML5 Perspective, JavaLand 2015
PPTX
Xuedong Huang - Deep Learning and Intelligent Applications
PDF
Stateful patterns in Azure Functions
PPTX
One Click Provisioning With Enterprise Manager 12c
PPTX
Rsockets ofa12
PDF
支撐英雄聯盟戰績網的那條巨蟒
PDF
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
PPT
SQL Server 2000 Research Series - Transact SQL
PDF
KFServing, Model Monitoring with Apache Spark and a Feature Store
2 Years of Real World FP at REA
Compiler2016 by abcdabcd987
Re-Design with Elixir/OTP
Code Quality Practice and Tools
Building frameworks: from concept to completion
Interview
Modular Web Applications With Netzke
Intro To Spring Python
Towards a Reactive Game Engine
Lab practical slide show pdf . deeply amazing
Fun with Functional Programming in Clojure
Java EE 7 from an HTML5 Perspective, JavaLand 2015
Xuedong Huang - Deep Learning and Intelligent Applications
Stateful patterns in Azure Functions
One Click Provisioning With Enterprise Manager 12c
Rsockets ofa12
支撐英雄聯盟戰績網的那條巨蟒
Simple Single Instruction Multiple Data (SIMD) with the Intel® Implicit SPMD ...
SQL Server 2000 Research Series - Transact SQL
KFServing, Model Monitoring with Apache Spark and a Feature Store
Ad

More from SmartLogic (20)

PDF
All Aboard The Stateful Train
PDF
DC |> Elixir Meetup - Going off the Rails into Elixir - Dan Ivovich
PDF
Monitoring Your Elixir Application with Prometheus
PDF
Going Multi-Node
PPTX
Kubernetes and docker
PDF
Serializing Value Objects-Ara Hacopian
PDF
Guide to food foraging by SmartLogic's Kei Ellerbrock
PDF
Introduction to Type Script by Sam Goldman, SmartLogic
PDF
How SmartLogic Uses Chef-Dan Ivovich
PPTX
A Few Interesting Things in Apple's Swift Programming Language
PDF
Effective ActiveRecord
PDF
An Introduction to Reactive Cocoa
PDF
iOS Development Methodology
PPT
CSS Preprocessors to the Rescue!
PDF
Deploying Rails Apps with Chef and Capistrano
PDF
From Slacker to Hacker, Practical Tips for Learning to Code
PDF
The Language of Abstraction in Software Development
PDF
Android Testing: An Overview
PPTX
Intro to DTCoreText: Moving Past UIWebView | iOS Development
PDF
Logstash: Get to know your logs
All Aboard The Stateful Train
DC |> Elixir Meetup - Going off the Rails into Elixir - Dan Ivovich
Monitoring Your Elixir Application with Prometheus
Going Multi-Node
Kubernetes and docker
Serializing Value Objects-Ara Hacopian
Guide to food foraging by SmartLogic's Kei Ellerbrock
Introduction to Type Script by Sam Goldman, SmartLogic
How SmartLogic Uses Chef-Dan Ivovich
A Few Interesting Things in Apple's Swift Programming Language
Effective ActiveRecord
An Introduction to Reactive Cocoa
iOS Development Methodology
CSS Preprocessors to the Rescue!
Deploying Rails Apps with Chef and Capistrano
From Slacker to Hacker, Practical Tips for Learning to Code
The Language of Abstraction in Software Development
Android Testing: An Overview
Intro to DTCoreText: Moving Past UIWebView | iOS Development
Logstash: Get to know your logs
Ad

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Cloud computing and distributed systems.
PDF
KodekX | Application Modernization Development
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPT
Teaching material agriculture food technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Chapter 3 Spatial Domain Image Processing.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation theory and applications.pdf
PDF
Machine learning based COVID-19 study performance prediction
Approach and Philosophy of On baking technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Review of recent advances in non-invasive hemoglobin estimation
Cloud computing and distributed systems.
KodekX | Application Modernization Development
MIND Revenue Release Quarter 2 2025 Press Release
Teaching material agriculture food technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Network Security Unit 5.pdf for BCA BBA.
NewMind AI Weekly Chronicles - August'25 Week I
“AI and Expert System Decision Support & Business Intelligence Systems”
Chapter 3 Spatial Domain Image Processing.pdf
The AUB Centre for AI in Media Proposal.docx
Encapsulation theory and applications.pdf
Machine learning based COVID-19 study performance prediction

Writing Game Servers with Elixir