7 ms·
Show HN: Lyceum – An MMO game built with Zig and Erlang
Hey HN, this is a small project myself and closer friends have been building on our free time (https://github.com/Dr-Nekoma/lyceum https://github.com/Dr-Nekoma/lyceum), it finally reached 0.1.0, we are open to feedback!
The original idea was to experiment with Zig + Raylib, eventually we wrote a small server in Erlang as well. We started by first interacting with Erlang via its C bindings, but this eventually led to some of us to prototyping our own tooling to better integrate Zig types with Erlang, we called such tool "zerl" as its avaliable here https://github.com/dont-rely-on-nulls/zerl https://github.com/dont-rely-on-nulls/zerl.
Most of the developers are NixOS users, so the tooling heavily relies on Nix as well, including a Postgres running our devshell as well.
- fluidwizard 2y agoRegarding Zerl, my friend just presented about it in Functional Programming Sweden: https://www.youtube.com/watch?v=5Cuv0WnbZtk&t=795s https://www.youtube.com/watch?v=5Cuv0WnbZtk&t=795s.
- lionkor 2y ago> the client written in Zig (superchanged with raylib and Zerl). What does "supercharged" mean here? I'd guess raylib simply does all the rendering and input handling, what is it "supercharging" here?
- meheleventyone 2y agoIt's just a superlative to give praise to the two libraries they are using to develop their game.
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- xyzzy4747 2y agoIt just means they like raylib and Zerl and used them.
- lovegrenoble 2y agoWill the game evolve further, and what is its future?
- DuLR10 2y agoThe main 3D part of the game is now on pause. We'll implement minigames (2D ones) leveraging all the current game's Zig and Erlang pieces. After getting that done, we may return to developing the main game.
- fluidwizard 2y agoYeah, so the game is kinda in a weird state where a library was born to make it work better, we are planning more features so it stops being a multiplayer walking simulator.
- canadiantim 2y agoSeems cool, would love to see a couple more videos of gameplay, but otherwise looks really cool. I would definitely consider playing
- fluidwizard 2y agoThis version is actually a walking simulator XD, us trying to pull the crazy tooling together until it just works. https://www.youtube.com/watch?v=ejYcWRERetM&t=2758s https://www.youtube.com/watch?v=ejYcWRERetM&t=2758s Here's what the game consists rn
- Closi 2y agoPretty amazing effort, this looks like a great labour of love! I can't give feedback on the code/technology, but on the writing on the lore section, I would try to simplify the writing. For instance the following: > The reverberations of the trumpet stirred the knights from their deep repose, igniting a tumultuous awakening. With swords unsheathed and hearts ablaze, they clashed in a thunderous symphony of war, each seeking to claim dominance over the waking realm. Feels too ornate (purple prose) and could be more directly put as: > The trumpet’s call jolted the knights from their rest. Swords drawn and hearts alight, they clashed in a fierce battle, each striving for dominance. I'm not an author or anything, but a little bit of copy writing could help - although this might just be me as it's probably a matter of personal taste!
- skulk 2y agoIt's definitely a matter of taste. The first version has flavor, the second is flat. The first reminds me of the style of writing that got me hooked on MUDs.
- adamc 2y agoYeah, agree. "Jolted" is not as evocative as "stirred".
- inopinatus 2y agoLOUD MUSIC BROUGHT ALL THESE ANGRY SWORD GUYS TO THE YARD AND YOU WON’T BELIEVE WHAT HAPPENED NEXT
- montedeipaschi 2y agoWe were actually considering a MUD at first, but then we added raylib
- dgfitz 2y agoThe colorful version is better.
- wyldfire 2y agoMaybe we could throw a "lurgid bee" in there somewhere?
- mapcars 2y agoIts always nice to see people experimenting with different technologies. I'm curious about Erlang server, do you see any advantage or features that Erlang provides, compared to for example if the server was running in Python via multiple instances?
- DuLR10 2y agoWe haven't touched the distributed part of the game, but our understanding is that when that time comes, it will be easier to use the BEAM approach given that it was made for this purpose. Given the experience so far, it seems that using Erlang was the correct choice, not only because of the above, but also because Erlang made the server implementation way easier than we thought.
- mapcars 2y agoI see now, you are sending messages directly to Erlang server so you don't have to worry about network sockets. In my experience the issues with Erlang come with working with data structures, records are not flexible and there is not much one can do to abstract the boilerplate.
- DuLR10 2y agoWe are using maps all over the place in the server, and so far nothing has been annoying. I gotta say though that lack of infix custom operators for the monadic bind is a pain.
- klibertp 2y agoTake a look at Erlang's "parse transforms" which would allow you to implement some syntactic sugar. That's what is used to implement qlc, the query language for ETS/Mnesia - that one adds new semantics to list comprehensions, but you can modify any part of the syntax you want. Also, Elixir supports macros and infix operator overloading - have you considered using it? If you know Erlang's stdlib and BEAM, switching to Elixir (and back) is almost painless. Not sure which monads you needed, but `with` macro is built-in, and it's a monadic bind for Option types (well, more or less). Adapting it for other monads shouldn't be hard.
- mysterydip 2y agoI'm confused by the use of a 10,000 poly model for a tile instead of a flat (2 poly) square. I didn't even realize there were changes in its height from the animation on the page. Was it just to test things out and you plan to go to a full terrain later?
- DuLR10 2y agoFormer case. Just testing things out. We will for sure have to either learn Blender and this ecosystem or find someone with this skill set.
- mtlynch 2y agoWhat's your experience been like with Nix? How do you feel about devenv vs stock Nix? How are you getting devenv to work, as I don't see a devenv.nix file. I'm still a Nix beginner and would like to find ways of integrating it more into my development and improving my current techniques.[0] [0] https://mtlynch.io/notes/nix-dev-environment/ https://mtlynch.io/notes/nix-dev-environment/
- fluidwizard 2y agoSo, we've been using devenv for some time now and it's useful for describing a monorepo-like environment that zig-enjoyers can quickly code and test their changes on the latest version of the erlang server. Also, it's incredibly easy to also manage postgres from there. It's great if you like local-first development experience.
- mtlynch 2y agoI looked harder at the code to figure out how you're using devenv without a devenv.nix file. I now see that you're using devenv from within your flake.nix, which I didn't realize you could do.[0] Neat! I'm going to give that a spin in my projects, as my current solution for pinning versions of Go, Zig, etc. is to use nixhub to look up which commit of nixpkgs corresponds to which version of Go (e.g., Go 1.23.2 is nixpkgs version 4ae2e647537bcdbb82265469442713d066675275). That's obviously a pain to look up and performs poorly, so I'm curious to see how devenv goes. Thanks for sharing the source! [0] https://github.com/Dr-Nekoma/lyceum/blob/1b0acf2d4bf295135bb38d12374dfbbd6eb85e1c/flake.nix#L229-L287 https://github.com/Dr-Nekoma/lyceum/blob/1b0acf2d4bf295135bb...
- fluidwizard 2y agoSure! I'm glad the source code helped you! I've actually written about the process that led us to use the following flake here: https://mtrsk.github.io/blog/2024/experiments-with-erlang-and-nix/ https://mtrsk.github.io/blog/2024/experiments-with-erlang-an...
- pmarreck 2y agoProps for using Nix.
- diath 2y agoThe BEAM is made with fault tolerance, scalability, and concurrency in mind at the cost of performance due to immutability and message passing approach among other things, which sounds like a terrible choice for a multiplayer video game that's anything more than a walking simulator. Erlang sounds like a good choice for auxiliary video game services, such as chat/social, guild management, auction house and so on, not so much for the game shard itself.
- DuLR10 2y agoGiven the current state of the game (the one we keep passing around between client and server), I don't think Erlang is a bottleneck in performance for us, and it won't be in the near future. Keep in mind this state is not that huge and it is yet not distributed, so it is totally possible that at some point Erlang will slow us down. I will keep your comment in mind, thank you! Edit: currently with the game running at 60fps, there is no bottleneck from the server side. And we call it every 16ms! I should also mention that Erlang's choice has a learning purpose; we want to try to use the game as a way to learn more about OTP and the BEAM.
- toast0 2y agoIf it comes down to immutability and copies being a bottleneck, a solution is probably to move more of the core game state into native code (like with Zig), but fault tolerance, scalability, and concurrency seem like important things for a MMO. Hot loading is pretty nice too.
- cmdrk 2y agoit really depends on the game. people have been writing large-scale multiplayer games for over 25 years now, with MMOs sporting 2,000 player+ shards on significantly more primitive hardware. There is always this assertion that high-level languages of various flavors are too slow for games, but I suspect that today's hardware more than makes up for it for the right kind of game.
- newobj 2y agois Lyceum a reference to Ultima?
- racenis 2y agoDo you think that you could use that Erlang feature where you can link up several server program instances running on separate physical servers? Maybe you could simulate different parts of the game world on different physical servers. I think this is something like what the Very Large MMOs do, but with Erlang it might be easier.
- DuLR10 2y agoSounds like an awesome idea for when we introduce the Server Browser! Thank you!
- 7bit 2y agoI was clicking the source expecting to see what kind of game Lyceum is. There is no description about the game and no images of the game.
- DuLR10 2y agoThere are images and a gif in the repository: https://github.com/Dr-Nekoma/lyceum https://github.com/Dr-Nekoma/lyceum You can also check it out a little demo: https://www.youtube.com/watch?v=ejYcWRERetM&t=2758s https://www.youtube.com/watch?v=ejYcWRERetM&t=2758s
- subsaharancoder 2y agoDid you happen to tinker with https://machengine.org/ https://machengine.org/ it's a Zig game engine & graphics toolkit?
- fluidwizard 2y agoNope, but damn, this looks awesome!
- subsaharancoder 2y agoI worked with one of the contributors..looked very interesting