top | item 42053031

Show HN: Lyceum – An MMO game built with Zig and Erlang

148 points| schonfinkel | 1 year ago |github.com

Hey HN, this is a small project myself and closer friends have been building on our free time (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.

Most of the developers are NixOS users, so the tooling heavily relies on Nix as well, including a Postgres running our devshell as well.

69 comments

order

Closi|1 year ago

Pretty 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!

bitterblotter|1 year ago

This definitely has a GPT smell, at no fault of the creator. Reminds me of a PR i reviewed about a simple security patch, where the description said "The following changes have been implemented to strengthen our role-based access policies and system security" - Like yeah, it's security patch. A small tweak to his prompt would probably do the trick

skulk|1 year ago

It'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.

nonethewiser|1 year ago

It's a style thing. Fantasy writing often does this deliberately.

I've thought about this before when I revisited fantasy after years of being in the CS domain which helped me abhor ornate writing. I definitely think there is such thing as TOO ornate but dead-simple language also feels bad. It feels wrong to just say its an exception with fantasy - simplicity is good because it conveys the same thing more clearly and with less effort. I would think that transcends all domains. Still not sure how I feel about this. I guess there is a baseline non-styled language that is all about communicating raw info and then there is style that can be applied to writing which makes it feel more natural in different domains.

Having said all this, I actually do like your example more.

Kinrany|1 year ago

The short version is better.

wyldfire|1 year ago

Maybe we could throw a "lurgid bee" in there somewhere?

dgfitz|1 year ago

The colorful version is better.

mtlynch|1 year ago

What'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/

fluidwizard|1 year ago

So, 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.

diath|1 year ago

The 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|1 year ago

Given 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|1 year ago

If 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|1 year ago

it 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.

racenis|1 year ago

Do 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|1 year ago

Sounds like an awesome idea for when we introduce the Server Browser! Thank you!

mapcars|1 year ago

Its 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|1 year ago

We 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.

fluidwizard|1 year ago

Also, Erlang makes it bizarrely simple to have a single process per user (and it's actually what we did for the demo).

mysterydip|1 year ago

I'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|1 year ago

Former case. Just testing things out. We will for sure have to either learn Blender and this ecosystem or find someone with this skill set.

canadiantim|1 year ago

Seems cool, would love to see a couple more videos of gameplay, but otherwise looks really cool. I would definitely consider playing

pmarreck|1 year ago

Props for using Nix.

lovegrenoble|1 year ago

Will the game evolve further, and what is its future?

DuLR10|1 year ago

The 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|1 year ago

Yeah, 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.

newobj|1 year ago

is Lyceum a reference to Ultima?

lionkor|1 year 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|1 year ago

It's just a superlative to give praise to the two libraries they are using to develop their game.

xyzzy4747|1 year ago

It just means they like raylib and Zerl and used them.