Core/Misc: implement a way to specify a range (in yards) at which a creature or gameobject becomes visible to players.#18067
Conversation
| if (ToPlayer()->GetCinematicMgr()->IsOnCinematic()) | ||
| return DEFAULT_VISIBILITY_INSTANCE; | ||
| return GetMap()->GetVisibilityRange(); | ||
| return GetMap()->GetVisibilityRange() * 5; |
There was a problem hiding this comment.
Hacky, needs a better solution.
There was a problem hiding this comment.
Implementation aside, are there any big reasons against having players activate nearby grids rather than only the one they're currently in?
Would solve this issue as well as make waypoint movement more realistic (right now every npc only starts movement when someone can see them).
Could be a configurable option, since it would more than double the amount of grids loaded. Opinions?
There was a problem hiding this comment.
Simple multiply which makes more performance loss than a DDOS :)
There was a problem hiding this comment.
@Palabola yeah, that's just here to show that "it works". Not meant to stay there when (if) this is merged.
There was a problem hiding this comment.
Not yet. Haven't been able to find a good way to update a specific creature without having to keep the whole grid loaded.
There was a problem hiding this comment.
@SnapperRy Any thoughts on what I mentioned to you on IRC about it?
| Tokenizer tokens(fields[6].GetString(), ' '); | ||
| if (creatureAddon.visibilityRange > MAX_VISIBILITY_DISTANCE) | ||
| { | ||
| TC_LOG_ERROR("sql.sql", "Creature (Entry %u) has invalid value %u for visibilityRange field in `creature_template_addon`. Value cannot exceed %u.", entry, creatureAddon.visibilityRange, MAX_VISIBILITY_DISTANCE); |
There was a problem hiding this comment.
/home/travis/build/TrinityCore/TrinityCore/src/server/game/Globals/ObjectMgr.cpp:552:199: fatal error:
format specifies type 'unsigned int' but the argument has type 'float'
[-Wformat]
...%u.", entry, creatureAddon.visibilityRange, MAX_VISIBILITY_DISTANCE);
~~ ^~~~~~~~~~~~~~~~~~~~~~~
%f
| } | ||
| } | ||
|
|
||
| if (uint32 visibilityRange = cainfo->visibilityRange) |
There was a problem hiding this comment.
No, it's declaring a variable inside the if and assigning it the value of cainfo->visibilityRange
|
Also there are some Type of gobs are always seen very far away, specially quest gob's. |
|
Yep, there are a good amount of them. Also creatures, mostly some Northrend rares and the giants meant to gank low level people. |
| if (creatureAddon.visibilityRange > MAX_VISIBILITY_DISTANCE) | ||
| { | ||
| TC_LOG_ERROR("sql.sql", "Creature (Entry %u) has invalid value %u for visibilityRange field in `creature_template_addon`. Value cannot exceed %f.", entry, creatureAddon.visibilityRange, MAX_VISIBILITY_DISTANCE); | ||
| creatureAddon.visibilityRange = MAX_VISIBILITY_DISTANCE; |
There was a problem hiding this comment.
/home/travis/build/TrinityCore/TrinityCore/src/server/game/Globals/ObjectMgr.cpp:553:45: fatal error:
implicit conversion from 'float' to 'uint32' (aka 'unsigned int') changes
value from 533.33331 to 533 [-Wliteral-conversion]
creatureAddon.visibilityRange = MAX_VISIBILITY_DISTANCE;
~ ^~~~~~~~~~~~~~~~~~~~~~~
/home/travis/build/TrinityCore/TrinityCore/src/server/game/Entities/Object/Object.h:38:37: note:
expanded from macro 'MAX_VISIBILITY_DISTANCE'
#define MAX_VISIBILITY_DISTANCE SIZE_OF_GRIDS // max dista...
^~~~~~~~~~~~~
/home/travis/build/TrinityCore/TrinityCore/src/server/game/Grids/GridDefines.h:39:34: note:
expanded from macro 'SIZE_OF_GRIDS'
#define SIZE_OF_GRIDS 533.3333f
^~~~~~~~~
|
Alright, after testing things out on retail again. I want to document them a bit here. This PR is wrong at the moment. Some NPCs && Game Objects can been seen zone wide. Few examples I have come across:
|
|
@Kittnz you need to take one more thing into account, namely, cross realm zones. Sometimes (not always) adjacent zones are hosted on two different servers and if the new server does not have any instance of your old zone under its control then it also has no spawns (prevents exploits such as blocking things with firewalls to camp rare spawns). |
|
Putridus the Ancient used to set off my NPC_Scan all the time in Dalaran. He is located in Icecrown. http://wowrarespawns.blogspot.com/2011/11/putridus-ancient.html#more - Nov 4, 2011 |
Closes TrinityCore#4207 The set active will be removed once this PR TrinityCore#18067 merged Spells cooldown is a generic issue
|
In sniffs we can see [0] UpdateType: FarObjects ServerToClient: SMSG_UPDATE_OBJECT (0x00A9) Length: 16 ConnIdx: 0 Time: 03/10/2010 00:21:45.000 Number: xxxxxx |
|
@Kittnz The definition of 'FarObjects' from WPP is UPDATETYPE_OUT_OF_RANGE_OBJECTS in the core which 'unloads' the object. |
|
Oh ok, didn't really look into it much. |
|
https://youtu.be/Js8GbzFzOMk?t=157 |
|
Someone can take over this ? |
|
I will need some assistance with this one. I thought I had grasped the concept of replacing |
There was a problem hiding this comment.
This commit reverted what SnapperRy came up with as a workaround. Is it 100% sure that it's intended or a side-effect of conflict solving?
…reature or gameobject becomes visible to players. Also remove unneeded CONFIG_SIGHT_MONSTER.
|
Rebased to fix conflicts and reduce changeset |
|
There are different levels of range that you will be able to see gobs or npcs. Maybe there is a flag somewhere to know how far the specific gob can be seen in the zone. |
|
Need fix conflicts again @ariel- :) |
|
Pretty pointless to do until main logic is redone to not use "x 5" hack |
|
Yeah, very much noped this one. |
Closes TrinityCore#4207 The set active will be removed once this PR TrinityCore#18067 merged Spells cooldown is a generic issue (cherry picked from commit 0df7d22)
Changes proposed:
This can be used to make creatures like Fel Reaver and Putridus the Ancient, as well as gameobjects like the Wintergrasp walls and towers, visible from a very far distance (up to maximum grid size).
Also remove unneeded CONFIG_SIGHT_MONSTER, since it was just used as an alternative to already used variables.
Target branch(es): 3.3.5
Tests performed: tested and working.
Known issues and TODO list:
Basic way to test: