MUnique / OpenMU

This project aims to create an easy to use, extendable and customizable server for a MMORPG called "MU Online".
https://munique.net
MIT License
724 stars 309 forks source link

Wandering merchants mechanism #336

Closed sven-n closed 1 year ago

sven-n commented 1 year ago

The game has some different wandering merchants. However, in OpenMU they're not wandering, but are staying on a fixed location.

Wandering merchants change their location every few hours, or just disappear. There are not only merchant NPCs which should change their location, but also the Marlon NPC.

Implementation ideas

As "invasion" plugin per merchant

Probably the easiest way... one implementation (inherited from BaseInvasionPlugIn) for each merchant. Downside: There needs to be code for each new NPC. Also the code for the BaseInvasionPlugIn has to be adapted, since it always creates instances of Monster instead of a NonPlayerCharacter.

One "invasion" plugin

Similar to above, but with configurable NPCs and their possible spawn points. I think this would be easier to extend and customize for admins (without adding more code for new NPCs).

afrokick commented 1 year ago

I would suggest a specific "behaviour" for NPCs. Maybe it is another name for plugins. So, you can attach any number of different behaviors to any npc.

I'm using it in my game to implement different characters.

We can use a state machine like a driver, but the behaviour - navigator.

Also I'm using ECS to handle large numbers of objects with different components combinations.

I know that in .Net interfaces can be like markers(moveable, flyable etc.) but it difficult to add/remove such behaviors in the runtime.

Instead of inheritance let's thinking about another ways)

sven-n commented 1 year ago

I want to keep it simple and fit into the current architecture. After thinking a bit about this problem, I came up with the idea of setting the spawn trigger to a new value 'Wandering'. A new periodically executing plugin can take care of these spawns.