• Bubble
  • Bubble
  • Line
Learning Elixir and OTP through a project - Life Beyond Apocalypse
Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2018-01-15T15:38:00Z
  • 4 min to read

So I've recently started to learn Elixir and Phoenix. I've read a few books, I've implemented some sample scripts but I feel it's time to start a full blown project from scratch.

This way I hope to combine everything I've read with previous programming experience. I can say that I really enjoy programming in  Elixir.

It feels different from any other experience. I'll write more about this in another blog post

Since Elixir is perfect for concurrent, high availability and fault tolerant servers we're going to implement a game. Did I just say we?

Yes. I'm going to make it like a sort of tutorial progressing from the beginning to the end. It's meant to organize my ideas and provide a way for newcomers to see the wonders Elixir offers.

I'll spare you of my ramblings, first here is the implementation list:

0x00 - Introduction - A roadmap and Plan
0x01 - Getting Started - Walking
0x02 - Command Line fun
0x03 - Saving State in Processes
0x04 - Introducing Items
0x05 - Testing it out - Polishing certain aspects
0x06 - Modifications to State - Modifying the User module and paving the way for our NPC
0x07 - New Random Map Generation - Road placement
0x08 - Implementing Tinymaps - Prototype
0x09 - Game Database - Importing all JSON files
0x10 - Improved and extended item searching
0x11 - Generating World Maps with other building types and tinymaps
0x12 - Saving and loading our current game status (world, character) - Implementing help files
0x13 - Item Handling reimplementation
0x14 - NPC - Characters and Zombies - Basic Artificial Intelligence
0x15 - Introducing Battle/Combat System

Implementation

First it will be a command line game which we will convert to a client-server model using telnet and/or openssl.
This could even be extended as a JSON service and/or webserver version since we're trying to make it extremely modular.

In the past I've built a few persistent browser based games. One of them was Life Beyond Apocalypse.
It's long been retired, now it's time to create a full playable console game as a tutorial.
You can read more about it on ../../../Articles_Blog/Projects/Life_Beyond_Apocalypse_-_Codru_-_LostMVC_version.txt

So I had spent countless hours researching, working, building a game system in the past.
Even if I had given up on the programming hours done on the past. I wouldn't just give up on a great game system!
Reread, refactor, repurpose, reuse!

The idea is to build a full playable console game in Elixir while keeping it simple and fun.
It's FUNctional programming after all!

I will try to use gen_tcp and then evolve to Ranch, Plug, Cowboy and probably add a Phoenix side to it. But this will be at the end.

Be aware that this will be a HUGE project from beginning to end. View it as a work in progress learning experience.

Expectations

I will try to post updates once every 1-2 weeks unless It has reached a level where I'm bored and no longer interested in maintaining the project.

Although this project will start from 0, it is expected that you at least have basic programming knowledge.
This project will NOT cover any 2D/3D or any graphical client environment.
It's only going to cover the server side of the project and maybe it will be extended to a HTML version as well if time allows.

Mandatory at this point is to have read the elixir-getting-started-guide.epub
Whenever you encounter a new function I encourage you to try it out and go in iex and type
h Module.function_name
And then play around in iex. Modify what I've written and try it out, write tests, break them and extend functionality.

The end result is that you will understand how to create a server side project that scales.

Again, this is a work in progress as I learn to effectively use Elixir/OTP. Follow me in the development process.

The original ideas I've collected during the years are are documented here.

Brand new implementation based on Cataclysm

Since I've been reviewing Cataclysm more and more I though I ought to re-implement all the ideas
Tutorials 0x01 to 0x06 are implemented based on the ideas from the documentation link above. The other modules following 0x07 to 0x10 where also implemented using the old system.

I've decided to start reimplementing everything from tutorial 0x08 using Cataclysm. This means we'll have a longer look at the Items system.
We will also have a look at some functions to generate our world for us, although we will not go to deep into the subject like Cataclysm does.

Another NOTE: If some code is missing from the downloaded file for a certain tutorial download the newer version.

The first 10 tutorials will be about the basics.
From 0x10 to 0x19 we will expand our world.
The next 10 will expand in creating a realistic world

We start off with Proof of Concept implementations which we will modify for each need.

This is my vision of Lean and Agile development. Creating a minimum viable project that works. Extending and adding until it gets more and more features.

Refactoring and rewriting it on the go.

Ah and not not to forget tests.

 

 

Ideas for game based on cataclysm
https://web.archive.org/web/20130212063150/http://whalesdev.com/wiki/index.php?title=Main_Page
Skills/ traits
https://web.archive.org/web/20120714071013/http://whalesdev.com:80/wiki/index.php?title=Traits

Ideas and comments

Andrei Clinciu
Andrei Clinciu

I'm a Full Stack Software Developer specializing in creating websites and applications which aid businesses to automate. Software which can help you simplify your life. Let's work together!

Building Great Software
The digital Revolution begins when you learn to automate with personalized software.

Find me on social media