Hacker News new | ask | show | jobs
by bcrosby95 1713 days ago
I've coded MUDs for about 25 years now, and I use a lot of these patterns in my code. Nice to see someone else thinks its useful.

I think a key strategy that is not touched on too much in the talk is flexibility in your effect system, whatever your effect system may be. It should be trivial to take an effect (heal, damage, stat boost, etc) and let anything in your game apply it to actors with just a few lines of code: items, spells, tiles, regions, the whole game, etc.

As an example, lots of games will specifically give certain classes hps/mana/better chance to hit/new skills as they gain levels.

I just use my effect system for this. Now I can have items that give skills too, because items use the same effect system.

1 comments

Do you know of any articles or resource that go into your style a bit deeper? I'd love to hear more on how your effects system works and how that compares to a component-based or ECS architecture.
I wouldn't call it an architecture, more a goal. When I say effect system, I just mean how you apply various effects to your players/npcs. I wouldn't prescribe how to get there - it could just be your component system.

For myself, I go at it from a baseline approach: effects are one of the fundamental building blocks of the game. As much as possible, if something in the game does something, I try to do it through effects. This includes skills, spells, weapons, armor, commands, AI, systems, etc.

If everything does everything through these effects, you can make anything do anything in response to anything without having to special code it.

I don't make it that flexible for various reasons. But I think it's a good place to be philosophy-wise for something like a MUD.

As an example from the video, there is an Attack, Use, and Defense class that Items use, with specific attributes assigned to them (armor, dodge bonus, min damage, max damage, etc). With effects, you might have a list of effects that trigger on wear, on attack, on activate, etc.

A common effect is a damage effect. You could make an item that damages someone you hit with it (typical weapon), damages you when you wear it, or damages a target when you activate it. But you could do this with literally any effect you programmed for any spell or command. You can make an item heal you when you wear it. Or provides a heal over time when you wear it. Or heals your target when you hit them with it.

You can even combine them. I could make an item that, when worn, transfers everyone in the game to the wearer's location and kills them. I could do the very same thing for a spell. Or when someone enters a tile. Or a command. Etc.

I can do this because there is an admin command that can transfer everyone in the game to a location. It does this by effects. I have an admin command that can insta-kill anyone. It does this by effects. I can assign these effects to any place that uses effects.

I arrived at this solution because, when working long term on MUDs, I found myself coding the same thing over and over for different subsystems for different content creators. Ultimately my mantra turned into "non coders shouldn't need coders to build new, cool things" and this is how I went about doing that.

Thanks for elaborating!

I've actually tinkered with MUD development in the past and that actually does make a lot of sense.