A mirror of the official tes3mp repository
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Go to file
David Cernat 5f6ddcfc59 [General] Rework container sync to prevent item duping
A main priority in TES3MP development is to avoid making major changes to OpenMW code, so as to avoid merge conflicts in the future. Whenever avoiding potential conflicts seems especially difficult for the proper implementation of a particular multiplayer feature, that multiplayer feature is often put off until later or partially implemented with the intent of being revisited in the future.

Container sync is the perfect example. Previously, the OpenMW code for container actions was kept exactly as it was, with clients unilaterally accepting their own container changes as per singleplayer-specific code, with only the addition that clients sent container packets every time they made a change in a container, packets which were then forwarded unquestioningly by the server to other players. This meant that two players clicking on the same item in a container at the same time both managed to take it, thus duplicating the item.

Immediately after the packets were already forwarded, server scripts were able to check for incorrect changes, such as the removal of more items than should have existed in a container, but they had to send their own packets that attempted to fix what had already been accepted on the initial client and then forwarded to all clients, which was quite onerous in some scenarios, such as when a player on a slow connection immediately dropped items in the world after taking them from a container (which is why the default TES3MP serverside scripts made no attempt at sending corrective packets at all, preferring to expect the matter to be solved in a later C++ implementation).

This commit fixes item duping in containers by preventing container actions from initially running on clients and by ending the automatic forwarding of container packets by the server. Instead, clients now send container packets that act as requests for container actions, and serverside scripts have to forward these requests themselves. In other words, without a matching Container event in the server's Lua scripts, players are completely unable to affect containers for themselves or for others.

To forward a received Container packet, the following line must be used in a Container event in the Lua scripts:

tes3mp.SendContainer(true, true)

When an invalid action count is used in a container request, the serverside scripts can amend it using the following new function:

tes3mp.SetReceivedContainerItemActionCount(objectIndex, itemIndex, actionCount)

Thus, the serverside scripts are able to allow only container actions that are correct based on their own recorded contents for that container.

The OpenMW code allowing unilateral container actions in mwgui/container.cpp is now prevented from executing. When a player's container request is returned to them, code in mwmp/WorldEvent.cpp simulates those container actions instead.
7 years ago
CI Merge pull request #392 from OpenMW/master while resolving conflicts 7 years ago
apps [General] Rework container sync to prevent item duping 7 years ago
cmake Merge pull request #392 from OpenMW/master while resolving conflicts 7 years ago
components [General] Rework container sync to prevent item duping 7 years ago
docs Merge pull request #392 from OpenMW/master while resolving conflicts 7 years ago
extern Merge pull request #392 from OpenMW/master while resolving conflicts 7 years ago
files Merge pull request #392 from OpenMW/master while resolving conflicts 7 years ago
manual/opencs remove latex error 10 years ago
plugins/mygui_resource_plugin Uses case-sensitive MyGUI_* variables 9 years ago
.editorconfig Add an EditorConfig file 7 years ago
.gitignore Merge pull request #369 from OpenMW/master 7 years ago
.gitmodules Add breakpad to server 8 years ago
.travis.yml Merge pull request #359 from OpenMW/master while resolving conflicts 7 years ago
AUTHORS.md Update AUTHORS.md 7 years ago
CHANGELOG.md updated changelog 7 years ago
CMakeLists.txt Merge pull request #392 from OpenMW/master while resolving conflicts 7 years ago
CONTRIBUTING.md http to https for supported urls (#1625) 7 years ago
LICENSE http to https for supported urls (#1625) 7 years ago
README.md Merge pull request #392 from OpenMW/master while resolving conflicts 7 years ago
appveyor.yml Fix "curl: command not found" error 8 years ago
tes3mp-changelog.md [Documentation] Update changelog for 0.6.2 7 years ago
tes3mp-credits.md [Documentation] Update credits 7 years ago

README.md

TES3MP

Build Status

TES3MP is a project aiming to add multiplayer functionality to OpenMW, a free and open source engine recreation of the popular Bethesda Softworks game "The Elder Scrolls III: Morrowind".

  • TES3MP version: 0.6.3
  • OpenMW version: 0.43.0
  • License: GPLv3 (see LICENSE for more information)

Font Licenses:

Project Status

Version changelog

TES3MP is now playable in most respects. Player and NPC movement, animations, combat and spell casting are properly synchronized with small exceptions, as is picking up and dropping items in the world, using doors and levers, and adding and removing items from containers. Journal entries, faction stats and dialogue topics are also synchronized, allowing the majority of quests to work fine.

Serverside Lua scripts are used to save and load the state of most of the aforementioned.

Contributing

Development has been relatively fast, but any contribution regarding code, documentation, bug hunting or video showcases is greatly appreciated.

Test sessions are often advertised on our Discord server or in our Steam group.

Feel free to contact the team members for any questions you might have.

Getting Started

Donations

You can benefit the project by contributing to the Patreon pages of our two developers, Koncord and David Cernat, as well as by supporting OpenMW.