question

Brent Batas (Lisk) avatar image
Brent Batas (Lisk) asked

Best way to track whether an item is "new" for a player?

In my game, each player has a collection of items. I would like to render a special "New!" UI text if an item is new.

For reference, here is a screenshot from Overwatch demonstrating what I mean:

After I click DoomFist, the "New" icon goes away next time I browse this menu.

The only way I can think of is by having a "isNew" boolean in the item's CustomData, which is set to true initially, then call UpdateUserInventoryItemCustomData to set isNew to false when the player browses that item.

Is that the best way to do this? The downside of using UpdateUserInventoryItemCustomData is I'd have to route the calls through my lobby server or through CloudScript, and I am afraid to place more load on those servers for something like this which is non-essential and would be perfectly safe for the client to modify.

qxefg.png (159.8 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Given the requirement to only have the "new" tag go away when the player clicks on that specific item (so, you could have multiple items, all added at different times, and you want to track that the player has seen each individual one, rather than update a timestamp for when the player saw the inventory list itself), you'd have to track that data per item. You can do that either in the item's custom data or in player data. The real question is, how many items will the player have, and how quickly can they iterate the list to remove the tags? If the answer to either of those means that you'd be generating a lot of calls for this, I'd say player data would be better since it's not a separate call for every inventory item, and you could aggregate the changes over time - letting the player click a bunch of items, then updating the backend with the latest state info when they pause or move to another screen.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Brent Batas (Lisk) avatar image Brent Batas (Lisk) commented ·

Thanks for the answer, Brendan. Of the two you suggested, Player Data probably makes more sense.

However, I thought of another solution. I'm thinking of just having a "ViewedItems.txt" stored locally on their machine. I'll just add itemIds to that text file after they browse it. Then I'll just check that text file to see whether an item is viewed (contained in the file) or not. The minor downside is if they play on a different computer or if they reinstall the game, it would mistakenly mark things as new, but that doesn't seem too major to me.

0 Likes 0 ·
brendan avatar image brendan Brent Batas (Lisk) commented ·

Ah, I was thinking you wanted the "new" tag to be consistent cross-device. If that's not a requirement, then yes, just track it locally and make your life way easier. :)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.