My concern is regarding codes and coders, but I want to get the viewpoints of everyone involved in a MUD, from other coders, to builders and admin.

Situation: I am assistant coder for 2 different muds, and have been asked to work on mud #3. In addition, I maintain the generic version of the engine used by all three muds.

Mud#1 has explicitly stated that I may use some of the code I develop for them in my generic engine. Mud#2 has asked that "not too much" code go back into the generic engine, implying that I can add the code I develop for them. Mud#3 has stated that nothing I do for them can be used elsewhere.

I am only talking about using code that I write being put into my generic engine, and it would be altered into a generalized form. All changes to the generic version are freely available to anyone, including rival MUDs that may be in competition with the MUDs that I used as inspiration for the code.

So the issue I am concerned with, is how much of my code is mine? The ideas that inspire the code are dependent on the individual MUDs, so in a way, the code is theirs, but I am the one doing the work. Each bit of code makes that particular MUD unique from others, but since they are all using the same engine, the main distinction between the three MUDs is in the building and the theme of the MUD. The benefit to the MUDs is in having someone who knows the engine inside and out. They get a coder with experience and I get a deeper knowledge of the code base that I can use to make the generic engine more robust.

What do people here think? Should I focus on the generic version, and look for inspiration elsewhere?

Any code you write is yours, end of story. You write it, you own it. Unless you signed a contract stating otherwise, that's really all there is to it.

If you want to make sure you're completely legally free of any potential license wrangling, then I'd suggest that you make all changes to your stock upstream codebase, and then push those changes into the individual MUDs, instead of doing it the other way around.

Any code you write is yours, end of story. You write it, you own it. Unless you signed a contract stating otherwise, that's really all there is to it.

While I agree with what you've said, there is one potential pitfall I can think of: If his code is a derivative work (i.e., changes to someone else's existing code, rather than an original work of authorship) then his copyright would only extend to his own changes.

If you write feature X, you can do whatever you like with it, unless you've signed your rights away. But if you modify Bubba's feature X to create feature Y, you're not going to be able to do anything with feature Y without Bubba's permission.

The title of your post was ethics question, but it is mixed with a legal issues in your narrative.

Legally, you have to read the licenses of each of the code bases you altered to determine what you legally can do.

What you ethically should do is remove yourself from the tangled web of expectations of several different muds that appear to be competing. If it is important to you to put the code into a root codebase, make each mud agree to allow you to put your ideas in the root codebase. Make it clear with an amendment to their codebase license. If they don't allow it, stop coding for them. They will likely change their tune once they don't have your help.

This will let you clear your conscience and keep you out of any legal or ethical dilemmas.