jpw1991 / chebs-necromancy

Cheb's Necromancy adds Necromancy to Valheim via craftable wands and structures. Minions will follow you, guard your base, and perform menial tasks.
The Unlicense
10 stars 4 forks source link

Add "patrol" behaviour for mobs to roam within a configurable distance of their starting point #174

Open okwelp opened 1 year ago

okwelp commented 1 year ago

Currently mobs set to Roam pick a spot randomly and walk to it. This means mobs can end up roaming a very large distance from their starting point.

It would be cool to have a setting for mobs to roam within a set distance of their starting point. For example, a 10m radius from their initial position. This would result in a neat patrolling behaviour ideal for mob guards which would make bases feel more, er, "alive".

Whether this is a change to existing Roam behaviour or a new "Patrol" behaviour - not sure, up to you!

jpw1991 commented 1 year ago

Response

This is a cool idea.

Technical Implementation Proposal (for myself, or for an interested collaborator)

There are two sides to this:

For the second part, this overlaps with another issue because I think that the proposed solution there is a good one here as well. Please read the Cycler idea.

Implementing the Patrolling

  1. Player configures patrol distance B
  2. Minion is told to patrol
    • Minion stores current location as A
    • Minion is then allowed to roam, same as normal, however when getting the next roam location, it will be checked for distance
    • If it is too far from A, it will shorten the point's distance so that it falls within B's radius centered on A
    • Periodically, the distance from minion to A is checked and if it becomes too far, the minion will be told to follow a new point within that radius

Implementing the UX

That's the hard part. See cycler idea.

Zeinath commented 1 year ago

To avoid having to use more keys/buttons, mayhaps have another wand introduced, perhaps a 'Wand Of Command' where it uses the same keys/buttons to do different things than the other wands do.

I was finding myself wishing there was a wand specifically to select a minion, then select a spot on the ground, might spawn an anchor point only visible while the wand is held, that the minion could be told to guard, so it always leashes back to said anchor. For patrolling, have it set to go between two anchors, again, only visible when the wand is held.

Also, the Cycler idea is great, isn't that what is already in use for choosing which type of minion is spawned?

jpw1991 commented 1 year ago

To avoid having to use more keys/buttons, mayhaps have another wand introduced, perhaps a 'Wand Of Command' where it uses the same keys/buttons to do different things than the other wands do.

Could be done, yeah.

Also, the Cycler idea is great, isn't that what is already in use for choosing which type of minion is spawned?

Thank you and yes, that is a cycler implementation. It used to be a different button per minion in old versions of the mod.