Closed sven-n closed 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)
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.
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 theBaseInvasionPlugIn
has to be adapted, since it always creates instances ofMonster
instead of aNonPlayerCharacter
.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).