Hello,
All ideas welcome.
TLDR: In what way could I represent attachments in my in-game, Animal-Crossing-like mail system that allows me to send ANYTHING as an attachment?
I have made a mail system for my game. It is mainly meant for the player to receive “in game” mail for certain events. It is similar to Animal Crossing’s mail system in that I can spawn mail from NPCs and even push mail from online or other players to the mailbox. The messages (Text) sent work fine. However, I am trying to find a good way to represent mail “attachments” such that ANYTHING can be sent through the mail; with “ANYTHING” meaning anything in the game that is tracked within the player class → items, reputation, quests, creatures, materials.
Examples:
- A player has helped an NPC so the NPC sends mail with money attached.
- An NPC finds a treasure map and sends it to the player, initiating a quest. (Map and Quest attached).
- A hunter NPC captures a rare, summonable battle creature and sends it as an attachment to the player.
Ideas:
-
I’ve tried just having the attachment be a struct “MailItemStruct.h” that is included where it’s needed. However, this means that the struct will be giant as it needs to account for anything that can be an attachment. I am wary of this approach as I’ve ended up with structs with hundreds of useless fields before.
-
I can also wrap the attachment in a “MailAttachmentUObject” that includes the enum type of attachment and a pointer to whatever is being attached. Then I call the appropriate player interface function (AddItem(), AddQuest(), AddCreature()) and pass in the object. Though, I don’t know if this is over complicating the system. And it is more difficult to create randomized attachments this way than with structs, tables, and data assets.
I feel the second approach is CLOSER to the best approach here. Though, I have absolutely no idea how I would send an attachment from a server in this case. If there is “developer mail” how would I even send attachments to the player without updating the game?