RonPenton / KatanaMUD

A web browser MUD. It originally started life as a clone of MajorMUD, but may end up diverging from that vision significantly in the end. Who knows. We shall see!
16 stars 4 forks source link

Have you checked out orleans? #3

Closed adamkittelson closed 9 years ago

adamkittelson commented 9 years ago

I think I saw you mention that you're doing things single-threaded.

I'm writing my MajorMUD remix in the Elixir programming language which is based on Erlang. It uses the Actor model for concurrency which allows you to have thousands or millions of tiny "processes" that are each internally single-threaded but their interactions with each other are concurrent. It ends up being a really nice way to get tons of scalability while being a lot easier to reason about than using threads.

Anyway the reason I mention it is Microsoft has released a project called Orleans that brings that model to .NET and it looks pretty cool. If I was a .NET guy I'd be all over it.

https://github.com/dotnet/Orleans

RonPenton commented 9 years ago

I'll have to look into it. It looks interesting.

Right now I have sort of a hybrid model, where communications are handled on separate asynchronous threads (well, incoming is, right now. Outgoing is still synchronous but I'll fix that eventually), and game logic is on its own separate thread.

Eventually the game is going to support fully custom C# scripts attached to certain game events, and when that happens I imagine novice developers are going to be writing their own custom mods for the game. The single-threading decision was based primarily on that (I seriously don't want to have to require mod authors to learn the intricacies of sync locks, or open ourselves up to deadlocks).

Additionally there's the fact that a MUD typically won't need so much computing power that we'll be spilling over more than a single CPU core at todays speeds; though if this were to ever scale beyond a few dozen players then perhaps. I'll have to keep it in mind.