-
Couldn't load subscription status.
- Fork 4.7k
Predict store system #39581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Predict store system #39581
Conversation
|
I always thought the main reason stores are not predicted is because networking them would be a very easy antag checker for cheat clients. Although in many other cases we prioritize smooth gameplay over potential for cheats. Also this will heavily conflict with this PR #38712 |
Antag detection cheats are already possible, and issue with cheats can be resolved only when components will support conditional networking, so only antags for example can receive component states related to this component. Probably should be an engine event. |
They already do with But either way, that can't really be used for stores, because anyone has to be able to interact with them, not only antagonists. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
FYI, And regarding conditional networking, I want to clarify that all comp states can have session-specific data. The
IIRC currently PDAs just all have a store to prevent antag detection, so if that doesn't change, you don't need to use |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
About the PR
Stores are now predicted.
Requires #38712
Why / Balance
You can access store systems from Shared code, and also it works smoothly.
Technical details
Most of the StoreSystem server code was moved to the new SharedStoreSystem, the code was also refactored to support prediction.
Listings handling was reworked, now instead of storing all dynamically generated listings in the component and serializing all of it, now you can get a list of all listings with a call to StoreSystem directly. The only thing that is stored are changes to these listings in a dictionary.
Media
TODO
Requirements
Buying works moslty fine, but other interactions like currency withdrawing or conditional listings are mis-predicting and broken.
Breaking changes
Most of the old
StoreSystemcode was moved to the newSharedStoreSystem. It also includes partials, soStoreSystempartials on server-side were removed and also ported to Shared counterparts.The API methods have been changed to use the
Entity<T?>orEntity<T>pattern.StoreSystem's
UpdateUserInterface()public method was removed.All
ListingConditions moved to theContent.Shared.Store.Conditionsnamespace.CurrencyComponentmoved to theContent.Shared.Store.Componentsnamespace and hasNetworkedComponent,AutoGenerateComponentStateattributes.StoreComponentnow hasAutoGenerateComponentStateattribute.Removed
StoreUpdateStateBUI state, sinceStoreBoundUserInterfacenow relies on predicted/networked data fromStoreComponent.Removed
StoreSystem.Commandpartial entirely,addcurrencycommand moved to theContent.Server.Store.Commandsnamespace atAddCurrency.csclass.StoreSystem.CloseUimethod was removed, if you still need it useSharedUserInterfaceSystem.CloseUi(uid, StoreUiKey.Key)