Skip to content

Conversation

@oliverfcarson
Copy link
Collaborator

@oliverfcarson oliverfcarson commented Sep 6, 2023

Integrated Player Trading (DEVX-3358) and fixed the misc bug issues in the Unity Showcase Game (DEVX-3640). Please take a look at the last four commits (starting with commit 0430e15), for more details on what exactly was done, as the earlier commits are from Radoslav).

I wanted to mention two major points of concern:

  1. PNObjects event listener is still not properly getting called in the PubNubTrading.cs file (which is what handles any of the trading system implementation). I've tried to debug and figure out why, but I've had to go with a slightly different implementation when updating the inventory. Previously, updating the metadata for both recipient and initiator was done by the initiator. Now, once the trade has been accepted, both recipient and initiator update the metadata, as well as update their own local hat inventory. Check out ReplaceHats in Scripts/TradingSystem/MetadataNormalization.cs for more details.
  2. Sometimes when a trade is initiated, it generates a leave event for the initiator from the global channel global, which is affecting total player count. It can also affect the recipient when the window pops up on their end. I have spent way too much time trying to figure out why, as I also cannot reproduce the issue reliably. I did update the readme as this issue being a potential bug that some players might see. Please let me know if you have any major questions.

Thanks!

Radoslav Nikolaev and others added 28 commits August 11, 2023 10:07
- OnPNObject calls not being triggerred anywhere once the metadata is being updated after trading. Workaround for now is to update when updating the new hat inventory in MetadataNormalization.cs.
-Handling situation in SampleMainMenu.cs that is throwing errors when playing the game - it is attempting to access gameobjects no longer in scene since it is now no longer being destroyed when starting the game.
-Fixed a bug in player search due to some metadata causing problems.
-Integrated Player Trading with Existing System
-Storing the chosen hat and avatar in metadata for each user. If a user has never selected a new hat or chosen an avatar, the default avatar and first inventory slot is used.
-Trading windows show updated avatars.
-Trading window will have the first hat selected in inventories, not the chosen equipped hat.
-Trading an equipped hat will result in player equipping the newly traded hat.
-Did not encounter issue where users are playing with the hat that was just traded away - they play with the hat that is currently equipped (if there is one)
-Set Chat, Friend, and Settings Button to be non interactive until PubNub loads.
-Change how updating username works. Clicking on the Update button next to the nickname field will now update the username for the player.
-Added customizable game length when host is creating a match. 2 min, 20 min, and 60 min. Added to presence state.
-Updating username button only interactable once pubnub is enabled and when username is different from existing.
-Updating README with Player Trading Functionality Added.
-Code Cleanup
@darryncampbell-pubnub
Copy link
Contributor

I found a 'crash' with TradingService.cs. Seems reproducible as follows:

  • Given two instances of the app
  • Start a game with two human players (not bots)
  • Quit the game as Player A
  • Start another game with two human players
  • You will see an error related to TradingService.cs:176
  • Quit the game as Player A
  • You will see an error related to TradingService.cs:54
    I'll try to attach screenshots
Screenshot 2023-09-19 at 09 21 48 Screenshot 2023-09-19 at 09 21 56 Screenshot 2023-09-19 at 09 23 42

@LoudStank
Copy link

@darryncampbell-pubnub is there a fix for this pull request? I'm just tryna add trading to my game and would love to add this but not have that issue above..

@darryncampbell-pubnub
Copy link
Contributor

@LoudStank I'm going to have to defer to @oliverfcarson on this one as I haven't touched the game since last year. @oliverfcarson ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants