We, as a player, have a journal, which is a table (CSV or JSON) in which we have blocks like monster name, location, vulnerabilities etc. How do I make so that when we come to a game object (example: book) which will also be a table (CSV or JSON), and click on it - all data from the book will transfer to our journal.
Data Tables are read only run-time. But if you think about, a Data Table is little more than a Map of named structs with a fancy interface.
If you start treating it like one, you can manipulate it and perform more operations than the basic Data Table allows.
- Book is a Data Table and holds structs filled with data (if we cannot add / remove from the book, it can be a Data Table)
- the journal needs to be a
Name|Struct
map (same struct as the book)
Once the interaction happens, fetch the book entry by Name and Add it to the Journal Map.
Wow, thanks for such a detailed response! It is super helpful, but I need some time to process that information) Appreciate it, man!
As a kickstarter, it could look like something along the lines of:
- the top bit adds a single entry from the Book DT into the Journal (you can add more than one, ofc)
- at the bottom, the journal Finds all entries that have been added so far - you’d likely start creating UMG widgets at this point and start pushing the structs in
But again, I’m not 100% certain how it should work. I’m imagining a standard Bestiary.
But there’s also a question of how to organise it all in the Journal itself, especially ordering. That’d be up to you. Maps are very efficient at finding entries quickly (!) but, unlike Arrays, are not ordered.
If you want the entries to appear in a specific order, use an array. If you prefer Name identifiers (because monsters already have Names; or maybe the player clicks on their icons), a Map might be better.
For something a tad more involved, you’d have sorting algorithms; by name, by number of encounters, by rarity and so on.
Good luck!
You already helped so much with your first comment and now this?) I can’t thank you enough, man. And yeah it is a standard bestiary. Not really sure about all the nitty-gritty detail and how it should work in the final version, but you’ve fully answered my question and even beyond