Jump to content

[11827][IN DEV] Creature Linking via Database


Auntie Mangos

Recommended Posts

What bug does the patch fix? What features does the patch add?

Add feature to easily link NPCs together

For which repository revision was the patch created?

11499

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

no

Who has been writing this patch? Please include either forum user names or email addresses.

me

Description

This patch uses a table of the format (npc_entry, mapId, master_npc_entry, flag)

to link npc_entry to master_npc_entry (on a map with mapId)

The linking (which actions of slave on events for master) is described by the flag.

History:

http://getmangos.eu/community/topic/14050/feature-spawn-despawn-mobs-depending-on-other-mobs-or-instancedata/

http://getmangos.eu/community/topic/15654/how-are-creatures-linked/

Currently supported:

-- (V2) (original version here)
FLAG_AGGRO_ON_AGGRO         = 0x0001, the "slave" aggroes when the "master" aggroes
FLAG_TO_AGGRO_ON_AGGRO      = 0x0002, the master aggroes when the slave aggroes
FLAG_RESPAWN_ON_EVADE       = 0x0004, the slave respawns when the master evades
FLAG_TO_RESPAWN_ON_EVADE    = 0x0008, the master respawns when the slave evades
FLAG_DESPAWN_ON_DEATH       = 0x0010, the slave despawns when the master dies
FLAG_SELFKILL_ON_DEATH      = 0x0020, the slave goes suicide when the master dies
FLAG_RESPAWN_ON_DEATH       = 0x0040, the slave respawn when the master dies
-- (V3)
FLAG_RESPAWN_ON_RESPAWN     = 0x0080, the slave respawns on master respawn
FLAG_DESPAWN_ON_RESPAWN     = 0x0100, the slave despawns on master respawn (TODO: check for slave != master)
FLAG_FOLLOW                 = 0x0200, the slave follows the master, very basic, see TODO notes in commit, or post below
-- (V5)
FLAG_CANT_SPAWN_IF_BOSS_DEAD    = 0x0400, the slave cannot respawn while boss is dead
FLAG_CANT_SPAWN_IF_BOSS_ALIVE   = 0x0800, the slave cannot respawn while boss is alive

Full Patch

http://paste2.org/p/1627967 (V5 for 11783) - Fix recently introduced issues, add prevent respawning

or

https://github.com/Schmoozerd/mangos/tree/CreatureLinkingMgr

Implementation:

- class CreatureLinkingMgr - hold the static information that is directly related to the table

- class CreatureLinkingHolder - holds the dynamic information (GUIDs) of every map (every map has a member of this class)

Discussion

Further planned work:

- Improve flags for following

- support for DB-guid (needed for some fine-linking and following)

- Possible some speed-optimation (?)

Any input (style, naming, better ideas^^^) or hints for needed features are very welcome

--

V3 a few improvements, including (very) basic following

V4 Move to use ObjectGuid instead of uint64, replace naming to not-hungarian

V5 Fix recently introduced issues, add prevent respawning

Link to comment
Share on other sites

  • 41 years later...

added basic support for following,

see also the TODO messages :)

Would be cool if some guys would do carefull rereading, such that I don't make serious logic mistakes

-- TODOs

TODO: On Death of followed some action is needed - must be discussed what will best way to go

TODO: Better check, ie uniqueness of follower (well, currently this is checked, but only by DB-selects, so maybe improve in speed)

TODO: Also need better check for ie Despawn on Respawn, (only direct self->self filtered currently)

TODO: Re-Following on Evade is needed

this means: _where_ do we want to set the following, we could use the evade place, or we could modify motionMaster MoveTargetHome to set into following.

The second is a bit more work, though perhaps more convinient

Link to comment
Share on other sites

  • 3 weeks later...

hmm, I started to ask around about how following works on retail, and I was told, that:

I believe that one of the remaining ones leads the group

[This suggest not following, but similar waypoints] or that waypoints are on a group level, not an NPC level

NPCs dont have waypoints, groups have waypoints, whoever leads the group gets to follow them

So, this means that I either need information how mobs behave who are following a single boss (in case the boss is dead and they evade) or that maybe I should dropt the idea of following for now, untill the current waypoint system is more flexible..

Would be nice if anyone who knows about this, can give some say!

Link to comment
Share on other sites

  • 1 month later...

I believe that one of the remaining ones leads the group

In general this statement is wrong.

In instances (and this was tested by my girlfriend in SSC just last week on retail) whenever you have a group of mobs that all come together on pull...

...whenever you whipe and at least one mob is still alive, then the whole group respawns and you have to do the whole group again.

This results for mob groups that no "leader change" is needed because on enter evade all respawn and the default leader is available again to link the other mobs.

I can't imagine a case where you kill just a part of a group and the rest needs to choose a new leader and continue their path - either you defeate them or they defeat you -> no mob left or all respawn and reset.

This grouped respawn (and also grouped aggro; means that you can define mobs standing together and you can never just pull one or a part of it) behaviour is missing for MaNGOS. If you take these challenges as seperate tasks and implement these first... you don't have to worry about the behaviour when patrolling mob groups just die partly.

Please note: Just take this statement valid for TBC instances as SSC, Eye, ... that I have seen myself working that way. I didn't pay attention to this in the open world area or WotLK/Classic instance content.

Link to comment
Share on other sites

I believe that one of the remaining ones leads the group

In general this statement is wrong.

In instances (and this was tested by my girlfriend in SSC just last week on retail) whenever you have a group of mobs that all come together on pull...

...whenever you whipe and at least one mob is still alive, then the whole group respawns and you have to do the whole group again.

This results for mob groups that no "leader change" is needed because on enter evade all respawn and the default leader is available again to link the other mobs.

I can't imagine a case where you kill just a part of a group and the rest needs to choose a new leader and continue their path - either you defeate them or they defeat you -> no mob left or all respawn and reset.

This grouped respawn (and also grouped aggro; means that you can define mobs standing together and you can never just pull one or a part of it) behaviour is missing for MaNGOS. If you take these challenges as seperate tasks and implement these first... you don't have to worry about the behaviour when patrolling mob groups just die partly.

Please note: Just take this statement valid for TBC instances as SSC, Eye, ... that I have seen myself working that way. I didn't pay attention to this in the open world area or WotLK/Classic instance content.

This is true for all instance contents through WotLK (haven't played Cataclysm but I'd guess its the same). Like FunkyBit said, if your group fails to kill a bunch of mobs, even with only one left, the entire group will respawn.

Link to comment
Share on other sites

This is true for all instance contents through WotLK (haven't played Cataclysm but I'd guess its the same). Like FunkyBit said, if your group fails to kill a bunch of mobs, even with only one left, the entire group will respawn.

From my experience, as far as I can remember, in SFK before Cataclysm, there was a bunch of mobs that would pick a new leader if you killed the old one, and I implemented this behavior in the scripting for it.

Link to comment
Share on other sites

  • 1 month later...

Updated to V4 (use ObjectGuid and remove hungarian notation)

About following

I am not sure if possible not remove this in total (at least for now), as it seems to hard to figure a neat way of generic behaviour.

So I guess I will try to pick myself some time this weekend, to implement the depending (re)spawning (preventing, allowing),

and then try to discuss this patch with any core devs who volonteers (that is, doesn't hide fast enough)

Link to comment
Share on other sites

Updated to V5 (fix issues - add prevent respawning)

Changes:

- Fix logic bug (somehow in one of my rebases I moved the adding of npcs to my holder to some invalid place)

- Fix some minor issue with not used cache variable

* Add support for preventing respawning depening on boss Alive or boss Dead

* Retested stuff ;)

So in my view, the state is:

- Finished in the sense that all I thought of is implemented

- Following is unfinished to the notes above (but could be completely removed ofc)

- Some issues like checking for static spawndata with multiple DB-queries might be to be improved, dunno currently how to handle this best

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 4 weeks later...

I just hat the time to take the first look at the patch.

Do I understand it right, that you used only ENTRYs to link and group creatures? So it is only possible to link a complete species of creatures to an other?

If that is:

That would be not sufficient to cope with all the creature-to-creature respawn relations in all the different instances.

It is often that you find a species bevor and after a boss and if the boss dies the mobs bevor should not respawn but the mobs after him should.

For my opinion the GUID of each mob must be used to link this spawned creature to an other one.

Otherwise I see no way to apply this system for example to Eye of the Storm, SSC, Steamvault, Karazhan, Gruul, Shadow Lab. and many more.

Edit:

Ah sorry, just have re-read the first post and found:

- support for DB-guid (needed for some fine-linking and following)

Well ok... but still... for my feeling and as I mentaly walked through the instances... the total generic solution by using the ENTRYs is the rare one.

Link to comment
Share on other sites

Well, I'll just give my reasons why I did it the way i did:

* Entry based tables are much better to maintain for DB-guys -- hence it should be easier/ faster to get the table filled with values

* Lots of cases can work with entries

* The patch already got big enough as it is (~1000 lines) - guids would have enlarged this again

* Entry support is more complicated as it is dynamic, hence it was necessairy to implement the entry support first

But yes, guid support is planned, but I don't know yet when I will find the time to implement it - ofc I will look into any patch that might be posted for review :)

Link to comment
Share on other sites

I disagree strongly in this case.

Currently the idea is very simple: the mobs follow in the way in which they are spawned. This enables all sort of formationing.

Possible there are some mistakes in the code here in the calculation of angle and distance based on spawn positions.

Also maybe following does not support some formation where the mob that is following is walking 'in front of' the mob it follows. But not even sure if this should be considered as bug/ missing feature from the core or bad logical interpretation of following.

Link to comment
Share on other sites

  • 1 month later...

Maybe for those 2 flags:

FLAG_RESPAWN_ON_EVADE = 0x0004, the slave respawns when the master evades

FLAG_TO_RESPAWN_ON_EVADE = 0x0008, the master respawns when the slave evades

Isn't it better to let the slaves respawn when the master reached home, instead of enter evade mode?

Now it's possible to pull the boss far away, kill the adds quickly and make the boss enter evade mode -> slaves are back and people can pull them already, while the boss is still running "home".

And after that they can kill the boss without his slaves. Just an idea :D

Edit: I remember on retail the slaves respawn once the master reached home.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use