5 ms·
Do you use it for server side game logic too? It's not as ambitious as an MMO, but I like to use MUDs to learn new languages. I've been (slowly) working on on
by stevbov 6y ago
Do you use it for server side game logic too?
It's not as ambitious as an MMO, but I like to use MUDs to learn new languages. I've been (slowly) working on one to learn Elixir and I'm actually finding the concurrency model somewhat difficult to use for the MUD - especially the single world that every player connects to.
I ended up writing my own kind of software transactional memory library to help me out: https://github.com/stevbov/stm_agent https://github.com/stevbov/stm_agent
But altogether my design feels fairly un-Elixir-like. It seems like the language would shine more in a problem space with more process isolation. When it comes to the game world, pretty much any process could potentially depend upon any other process. Especially once you get into scripting NPCs.
- QuinnWilton 6y agoYou'd likely be interested in the work done by Eric Oestrich in building MUDs with Elixir. Kalevala: a world building toolkit for text based games, written in Elixir [0] ExVenture: a text based MMO server written in Elixir [1] Grapevine: a MUD chat network [2] [0] https://github.com/oestrich/kalevala https://github.com/oestrich/kalevala [1] https://github.com/oestrich/ex_venture https://github.com/oestrich/ex_venture [2] https://github.com/oestrich/grapevine https://github.com/oestrich/grapevine
- deleted 6y ago[deleted]
- stevbov 6y agoI took a look at ExVenture when I first started working on this. A lot seems to have changed since then, but from what I could tell at the time there were some potential races. For example, movement processing seemed like it allowed for the possibility of players to seemingly move through doors that were closed (at least, from the players' point of view). I could easily have been wrong though since I'm new to Elixir. That said, a requirement for scripting I have is the ability to chain together arbitrary actions in an atomic fashion without any races or deadlocks. Content creators can create really complex scripts that involve arbitrary locations and actions. I wasn't sure how I would achieve this goal with ExVenture.
- iudqnolq 6y agoIf concurrency doesn't help, you can always just not use it. You don't need to run logically separate modules in different processes. What if you put the entire state in a single GenServer? You can still delegate modifying different parts of the state to different modules, just call functions in those modules from a single server process.
- deleted 6y ago[deleted]
- stevbov 6y agoIt does help. Any given action will modify a fairly small part of the overall state (at most around .01% of it). But what part of the state it can modify is fairly arbitrary based upon the action. Your dependency could be dataA, dataB, then dataC. Or dataC, dataV, then dataA. Which, if you isolate into processes could create races and/or deadlocks. They would be very unlikely, but they could still happen. This is why I went with software transactional memory. In the generally unlikely event that there's some overlap, the changes will just be rolled back and re-done.