Commit Graph

106 Commits (8aad93b90404f22a2a001471e7d847edbd31bc5d)

Author SHA1 Message Date
David Cernat 3effd5f1ff [General] Update positions for dead players on other clients
Dead players will now show up at the correct cell and position for living players, making server scripts that allow players to revive each other much more functional.
5 years ago
David Cernat f100a660d4 [General] Fix ranged attack sync when using last throwing weapon or ammo 6 years ago
David Cernat 3f304866fd [Client] Use clearer variable names in DedicatedPlayer::setEquipment() 6 years ago
David Cernat b57807407a [General] Implement RecordDynamic packet, part 1
Spell, potion, enchantment, creature, NPC, armor, book, clothing, miscellaneous and weapon record data can now be sent in a RecordDynamic packet. Additionally, the packets include data related to associated magical effects (for spells, potions and enchantments), data related to default inventory contents (for creatures and NPCs) and data related to body parts affected (for armor and clothing).

The server now has associated script functions for setting most of the details of the above, with the main exception being individual creature and NPC stats.

Records can either be created entirely from scratch or can use an existing record (set via the baseId variable) as a starting point for their values. In the latter case, only the values that are specifically set override the starting values. Creature and NPC records also have an inventoryBaseId that can be used on top of the baseId to base their inventories on another existing record.

The client's RecordHelper class has been heavily expanded to allow for the above mentioned functionality.

When players create spells, potions and enchantments as part of regular gameplay, they send RecordDynamic packets that provide the server with the complete details of the records that should be created. When they create enchantments, they also provide the server with armor, book, clothing and weapon records corresponding to the items they've enchanted.

This functionality added by this packet was originally supposed to be exclusive to the rewrite, but I've gone ahead and tried to provide it for the pre-rewrite in a way that can mostly be reused for the rewrite.
6 years ago
David Cernat f52364e05c [Client] Always create new references for new creature disguises
Previously, attempts to reuse the same reference for multiple creature disguises led to movement animation issues, as well as a dynamic_cast error in Creature::getInventoryStore() that made a DedicatedPlayer vanish completely when they first lost their creature disguise, then disguised themselves as a creature that could not hold weapons and then disguised themselves as a creature that could hold weapons.
6 years ago
David Cernat 60bc7447d9 [Client] Rework RecordHelper and add methods for other record types
The usage of const_cast has been replaced with usage of MWWorld::getModifiableStore() and ESMStore::overrideRecord()

Methods whose names started with "update" now start with "override", for consistency with ESMStore's overrideRecord()

New methods have been added for "overriding" enchantment, potion and spell records, which actually leads to them being created with their already set refIds if they haven't been created yet, as per the description of ESMStore::overrideRecord(): "Insert a record with set ID, and allow it to override a pre-existing static record."

Usage of RecordHelper methods has been updated in DedicatedPlayer.
6 years ago
David Cernat 18f8725d33 [Client] Remove tab character that somehow made its way into a comment 6 years ago
David Cernat 038757b91a [General] Temporarily revert to original rotation animation sync
I originally added rotation animation sync as part of commit 068a45be87. Unfortunately, it meant the PlayerPosition packets were now twice as large as they had been before, which was less than ideal for such a frequently sent packet, which is why Koncord switched to a more optimized approach in commits 5f30dfd5db and d67db1a9bd.

Recently, there have since been some rotation animation problems in OpenMW, which have broken the way Koncord's approach looks. My original approach still looks somewhat okay, so I'm switching back to it until we can figure out how to reuse it under the current circumstances.
6 years ago
David Cernat cd1fc590a7 [Client] Differentiate itemPtr from actor Ptr in DedicatedPlayer method
This fixes a mistake from 8f7da49152
6 years ago
David Cernat 892d71ce71 [General] Reimplement weather synchronization to allow soft transitions
Although weather sync was added by Koncord to the rewrite in fd721143e2 in a way that used surprisingly few lines of code, it relied on the server requesting weather states every second from authority players and sending them to non-authority players, while also allowing only very sudden weather transitions across regions, i.e. if there was one player in the Ascadian Isles who had stormy weather, and another player with clear weather in the Bitter Coast Region walked across to the Ascadian Isles, that player was instantly made to have stormy weather with no kind of transition at all.

My approach solves both of those problems. It solves the packet spam by only sending weather updates to the server when weather changes happen or when there are new arrivals to a weather authority's region, and it allows for both sudden weather transitions when players teleport to a region and for soft, gradual transitions when players walk across to a region. It is inspired by my previous actor sync, and uses a WorldRegionAuthority packet to set players as region authorities in a similar way to how ActorAuthority sets players as cell AI authorities. Weather changes are created only by the region authority for a given region, and weather packets are also only sent by that authority.

However, it should be noted that gradual weather transitions are used by default in this implementation. To use sudden weather transitions, the serverside Lua scripts need to forward WorldWeather packets with the forceWeather boolean set to true. That is, however, already handled by our default Lua scripts in situations where it makes sense.
6 years ago
David Cernat 59a56ca35e [Client] Disallow clients from scaling their associated players
Additionally, display messages when trying to scale players.
6 years ago
David Cernat b9520c11da [General] Rework PlayerEquipment packets so they are of minimal size
Moreover, rename BaseNetCreature's equipedItems into equipmentItems.

(cherry picked from commit d1ad0c91f8)
6 years ago
David Cernat 50fe54af5d [Client] Update DedicatedPlayer creature if displayCreatureName changes 6 years ago
David Cernat a01fc577f1 [Client] Add setAttributes() and setSkills() methods to DedicatedPlayer 6 years ago
David Cernat 716809f2db [Client] Prevent errors from NPC-only packets for DedicatedPlayers 6 years ago
David Cernat 68ee64902d [Client] Track & use previous race & creatureRefId for DedicatedPlayers 6 years ago
David Cernat acb1335d78 [Client] Make creature disguises update correctly 6 years ago
David Cernat 70f9cb535e [General] Use RecordHelper methods to create and update DedicatedPlayers 6 years ago
David Cernat 72463cfdb6 [Client] Refresh equipment for DedicatedPlayers when setting base info
Additionally, move default fatigue value to DedicatedPlayer initialization.
6 years ago
David Cernat c132dc70d2 [Client] Make PlayerShapeshift turn DedicatedPlayers into creatures 6 years ago
David Cernat 141eb8b7c2 [Client] Streamline creation of references for DedicatedPlayers
Additionally, delete DedicatedPlayers who disconnect.

Previously, all disconnected DedicatedPlayers were still kept in memory, but never used again. There was code that suggested they were meant to be reused upon reconnecting, but that reuse had never actually been implemented, and would probably not be that useful anyway.
6 years ago
David Cernat 14f90e773d [Client] Split up creation of DedicatedPlayers into multiple methods
Additionally, print player guids using their string representations for consistency.

The creation and updating of DedicatedPlayer references remains very inelegant, but this commit is the first step towards fixing that.
6 years ago
David Cernat 029dfc56ba [General] Implement player scale as part of PlayerShapeshift 6 years ago
David Cernat be25decee2 [General] Implement PlayerSpeech packet 7 years ago
David Cernat 413893aa51 [General] Implement PlayerAnimPlay packet 7 years ago
David Cernat 4db64e1721 [Client] Synchronize spellcasting for non-bipedal creatures 7 years ago
David Cernat 43a3daf0aa [General] Add & implement PlayerShapeshift packet for werewolf states 7 years ago
Koncord 8f7da49152 [Client] Update DedicatedPlayer to C++11 7 years ago
Koncord 6222c20e82 [Client] Convert MechanicsHelper to namespace 7 years ago
David Cernat c6aee3b780 [Client] Fix build by changing boost::shared_ptr into std::shared_ptr 7 years ago
Koncord a847d46984 [Client] Get rid Z axis in direction.pos 7 years ago
Koncord d67db1a9bd [Client] Play rotation animation on dedicated players 7 years ago
Koncord 2ef1e26233 [Client] Fix ID_PLAYER_POSITION spam 7 years ago
Koncord 5f30dfd5db [Client] Get rid direction.rot 7 years ago
David Cernat e042673779 [Client] Fix error when trying to delete player markers that don't exist 7 years ago
David Cernat cf41956cad [Client] Prevent framerate drops caused by invalid rotation values 7 years ago
David Cernat 34a452d775 [Client] Fix logic for initialization and updating of player markers
Additionally, disable the Ptrs of players who move to cells that don't exist for us instead of placing them in ToddTest.
7 years ago
David Cernat a353a21280 [General] Fix code style inconsistencies 7 years ago
David Cernat 068a45be87 [General] Synchronize player & NPC rotation animations 7 years ago
David Cernat b0c1aafc5a [Client] Use a 10 times higher maximum distance for linear interpolation 7 years ago
David Cernat 619982b085 [Client] Only try to send actor data to other players when authorized 7 years ago
David Cernat 8f5e6531db [Client] Avoid updating positions and anim flags when framerate is low
Also rename DedicatedPlayer methods so they are consistent with those from DedicatedActor
7 years ago
David Cernat 1f747d4375 [Client] Only apply interpolation when positions don't change too much 7 years ago
David Cernat b745a33f18 [Client] Resurrect DedicatedActors that aren't supposed to be dead 7 years ago
Koncord 60f4a1d9e5 [Client] Fix issues when changing npc model to creature 7 years ago
David Cernat 809b4d78ba [Client] Split off DedicatedPlayer and PlayerList into different files 7 years ago
Koncord 805c346bd7 [Client] Fix copy-paste mistake 7 years ago
Koncord 465a05bad0 [Client] Add ability to look like a creature for the DedicatedPlayers 7 years ago
Koncord fbd8e8b3a1 [Client] Use CreatureStats instead NpcStats 7 years ago
David Cernat 44476248b7 [Client] Add and use DedicatedPlayer::update() 7 years ago