Hello everyone,
We want to make an inbox in the game. The player will receive some messages, kind of mission in the game, and they will accept or decline the missions. The messages will be shown respectively on a virtual computer in the game and when they decline a mission, the related message will be deleted. There are 2 approaches we are thinking of, but maybe there is a more optimized way to do this. So, which one would be the best in terms of using the resources?
First of all, every player can receive up to 5 messages.
First approach: Making only 1 read only data and save all the messages in the field as a JSON file. For example;
{ Message1:{ Sender: "Mark",
Mission: 10,
IsAccepted: 0 } Message2:{ Sender: "Paul", Mission: 5, IsAccepted: 0 }
Message3:{ Sender: "Tom", Mission: 2, IsAccepted: 1 } }
When the player decline, let's say, the second message, we need to shift all the message, which is a bit problem for us. We don't know how to do that in Cloudscript. A code example would be nice for this approach. The last result should be like this:
{ Message1:{ Sender: "Mark", Mission: 10, IsAccepted: 0 } Message2:{ Sender: "Tom", Mission: 2, IsAccepted: 1 } }
Second approach: Making 5 different read only data and save all the messages separately as a JSON file. For example;
This approach makes everything more clear, however, when the player declines a mission, we need to shift all the data, which is a bit complex.
Which approach would be the best or is there any other options to implement this feature?