aliens

Author Topic: [DONE][Suggestion] Chronological Research History  (Read 2043 times)

Offline Delian

  • Commander
  • *****
  • Posts: 695
    • View Profile
[DONE][Suggestion] Chronological Research History
« on: November 30, 2024, 01:46:49 am »
I suggest adding a Research History feature.

This would be useful both for:
- players themselves, because they'd be able to check what path they took through the research tree in their current game or some other past game
- community, because they'd be able to check the path that some player took through the research tree and compare it to their own
- modders, because they'd be able to check what path the players of their mod took through the research tree, to get various insights, such as whether a certain topic was too easy or too difficult to reach

The suggestion would require creating a new window where the research history would be presented.
I'm not sure what would be the best place for the button to access this window and the history.
I'm also unsure about what features such a window should have (search / sort / filtering).


Technically, I suggest adding "discoveredHistory" sequence to a .sav file, where each element is a mapping containing information on how, when and where a discovery was made.
Code: [Select]
discoveredHistory:
  - { name: STR_BOWS_SUMMARY,   time: {second: 0, minute: 0, hour: 0, ...}, sourceType: 0, sourceName: "MyResearchBase" } //sourceType = Directly from a research project in a base
  - { name: DARK_TROOPER_ARMOR, time: {second: 0, minute: 0, hour: 0, ...}, sourceType: 1, sourceName: "Darktrooper" } //sourceType = Free after completing a different research topic
  - { name: STR_POLAR_OUTFIT,   time: {second: 0, minute: 0, hour: 0, ...}, sourceType: 4, sourceName: "Location: Arctic" } // sourceType = event reward
  - ...
« Last Edit: January 01, 2025, 05:33:23 pm by Delian »

Offline Tamren

  • Captain
  • ***
  • Posts: 91
    • View Profile
Re: Research History
« Reply #1 on: December 01, 2024, 05:47:58 am »
Another feature that would be very handy for players is being able to click on old techs they researched and see the xpedia articles that tech unlocks.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9511
    • View Profile
Re: [Suggestion] Chronological Research History
« Reply #2 on: January 19, 2025, 05:35:40 pm »
I suggest adding a Research History feature.

It's kinda useless for me personally, but I do understand your reasoning.
And you've earned it.

It may take a while until it gets high enough on my prio list.
If you want, you can also PR, but I don't guarantee a merge straight away (I will want to review and maybe make my own changes before merge).

Offline Delian

  • Commander
  • *****
  • Posts: 695
    • View Profile
Re: [Suggestion] Chronological Research History
« Reply #3 on: January 20, 2025, 02:34:45 am »
Thanks. Well, I wouldn't want you to spend a bunch of time on a feature you deem useless, so I suppose I should be the one to implement it. I'd appreciate if you could provide some guidelines on how to do this. Which window would be similar enough to reference the code from, and which GUI features should be present and where.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9511
    • View Profile
Re: [Suggestion] Chronological Research History
« Reply #4 on: January 27, 2025, 12:15:31 pm »
1/ Entry point
- I would make the new GUI accessible from the "Global Research Overview" screen -- the one accessible from the geoscape using `C` hotkey
- that GUI has only 1 OK button taking whole screen width -> this can be changed to 2 buttons taking half width
- OK button on the right side
- new "History" button on the left side

2/ "History GUI"
- default title probably "Research History" ?
- GUI structure:
  - Title on the top
  - Table in the middle -- two columns (left column: Topic name; right column: Completion date/time), sortable by both columns using up/down arrows (same as e.g. Funding GUI) -- maybe even a third column with "sourceType number" if it still fits in the middle
  - Below the table a 3-line high "Detail text" -- showing info that is not available in the table (sourceName?) when the user hovers over a table line (similar to what is implemented in the Mods GUI or Options>Advanced GUI)
  - OK button on the bottom
  - Edit: maybe two buttons? OK button on the right and "Filter" combobox on the left? Filter would be able to filter by "sourceType"?
  - maybe a "quick filter" (hotkey Q) somewhere above the table on the left side?
« Last Edit: January 27, 2025, 12:19:10 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9511
    • View Profile
Re: [Suggestion] Chronological Research History
« Reply #5 on: January 27, 2025, 12:29:24 pm »
Btw. if you don't like making GUIs, I can probably do the GUI if you do the backend: tracking/saving/loading of the new data.

Offline Delian

  • Commander
  • *****
  • Posts: 695
    • View Profile
Re: [Suggestion] Chronological Research History
« Reply #6 on: January 27, 2025, 06:53:13 pm »
I have plenty of experience with GUI design, but zero using C++ or the library OXC uses. If you can implement the GUI, then that would spare me from having to learn it (it would save me a lot of time) hehe. Sure, I can implement just the backend.

1/ Entry point
I would make it accessible from both the Global Research Overview, and from the base's Current Research screen. I'd imagine the most common use case would be where the player enters the base research and tries to decide which project to research next, but he forgot what research that base was focusing on, so he wants to check what were the last few items he researched in that base. Therefore, it would make sense if this window was accessible both from:
Global Research Overview - default filter = "Everything"
Base Research Overview - default filter = "Current Base"

2/ "History GUI"
Would "Research Diary" sound better? Or just "Diary"?

I think table should have 3 visible columns (Topic name, Source, Completion date).
Status bar (detail text) for cases where the topic or source don't fit the line. Alternatively, use word wrap and multiline rows (I know that's used in Manufacturing).

The Source column shows "{0}: {1}", where {0} is localized sourceType and {1} is localized sourceName:
sourceType=0:
Base: MyResearchBase1
sourceType=1:
Free from: ResearchTopicWhereGetOneFreeWasThisTopic
sourceType=2:
Free after: ResearchTopicThatUnlockedThisTopicOrWasLastRequiredTopic
sourceType=3
Mission: Bandit Caves
sourceType=4
Event: Location: Arctic

Completion Date should be formatted as YYYY-MM-DD

Filter combobox should be populated with:
- "Everything"
- Time periods: "Today", "Last 7 days", "Last 30 days", "Last 365 days"
- "Current base"
- Other bases: "Base: MyBase1", "Base: MyResearchBase", "Base: MyPrisonerBase" (only show bases that completed something)
- Other sourceType's: "From mission", "From event" (only show if any such types exist)

Quick Filter would also be useful, yeah. Have it search all the table cells. e.g. searching for "2601-06", would return all the rows with this date.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9511
    • View Profile
Re: [Suggestion] Chronological Research History
« Reply #7 on: January 27, 2025, 08:30:06 pm »
sounds good

I'm fine doing the GUI

Offline Delian

  • Commander
  • *****
  • Posts: 695
    • View Profile
Re: [Suggestion] Chronological Research History
« Reply #8 on: February 09, 2025, 02:15:36 am »
https://github.com/Delian0/OpenXcom/commit/9f0896fa11cbbccf70cdf85e9e8d8817110c538f

I called it "Research Diary". It sounds more natural.

Code: [Select]
discovered:
  - STR_TAC_VEST_PEASANT_UC
  - STR_JACKSTOWN_ZZZ
  - STR_PEASANTS_ZZZ
  - STR_RECRUIT_PEASANTS
  - STR_JACKSTOWN_SCOUTING
  - STR_PIRATE_LIFE
  - STR_WAT_DO
  - CIV_ARMOR_LOKNAR_1
  - STR_RAIDER_CORPSE
  - STR_GERMANY
researchDiary:
  - {date: [2601,1,1],name: STR_RAIDER_CORPSE,sourceType: 4,sourceName: STR_START_LOCATION_EUROPE_EVENT}
  - {date: [2601,1,3],name: STR_JACKSTOWN_SCOUTING,sourceType: 0,sourceName: Sailor's Tower}
  - {date: [2601,1,3],name: CIV_ARMOR_LOKNAR_1,sourceType: 1,sourceName: STR_JACKSTOWN_SCOUTING}
  - {date: [2601,1,3],name: STR_JACKSTOWN_ZZZ,sourceType: 2,sourceName: STR_JACKSTOWN_SCOUTING}
  - {date: [2601,1,3],name: STR_RECRUIT_PEASANTS,sourceType: 0,sourceName: Sailor's Tower}
  - {date: [2601,1,3],name: STR_PEASANTS_ZZZ,sourceType: 2,sourceName: STR_RECRUIT_PEASANTS}
  - {date: [2601,1,3],name: STR_TAC_VEST_PEASANT_UC,sourceType: 2,sourceName: STR_RECRUIT_PEASANTS}
  - {date: [2601,1,4],name: STR_WAT_DO,sourceType: 0,sourceName: Sailor's Tower}
  - {date: [2601,1,4],name: STR_PIRATE_LIFE,sourceType: 0,sourceName: Sailor's Tower}
  - {date: [2601,1,4],name: STR_GERMANY,sourceType: 4,sourceName: STR_START_COUNTRY_GERMANY_EVENT}

It seems to be working fine. SavedGame has a new field, which holds this data:
Code: [Select]
std::vector<ResearchDiaryEntry*> _researchDiary;


Other concerns:
I'm not sure if I should be handling research obtained thought arc scripts as well. For now I decided not to.
Bases are identified through their name. I think that even if two bases have the same name, the worst case is simply that filtering will group them together, which isn't that bad.


Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9511
    • View Profile
Re: [DONE][Suggestion] Chronological Research History
« Reply #9 on: March 22, 2025, 08:19:57 pm »
Done.

Backend merged:
https://github.com/MeridianOXC/OpenXcom/commit/f19653c0381c1994e89f9dccfb4e00c86a0d2e86
https://github.com/MeridianOXC/OpenXcom/commit/75c9cf5489c0f8cad116a9481aafc6c0b998d02f

Frontend implemented:
https://github.com/MeridianOXC/OpenXcom/commit/4ef3d44f2a9d19af7c5f6a7e8567a7aabb155ad3


Demo video attached.

PS: not all UI features and suggestions were implemented, let's see how this works and if it needs to be changed/improved...
« Last Edit: March 22, 2025, 08:24:55 pm by Meridian »

Offline Delian

  • Commander
  • *****
  • Posts: 695
    • View Profile
Re: [DONE][Suggestion] Chronological Research History
« Reply #10 on: March 22, 2025, 11:58:10 pm »
Thank you. I can fix the rest of the issues and add the missing features when I have the time. To note it down for later...

ITEM column should be named TOPIC (for instance, Alien Origins aren't an item)
TYPE column should be SOURCE column (right now it's useless)
Sorting by date is buggy (rows with the same date don't get sorted in the original order or reverse of the original order)
Quicksearch only works on the ITEM column
Item codes (in the detail text) shouldn't be visible (or at least, not visible when debug=false)
Non-global research diary
« Last Edit: March 23, 2025, 12:00:07 am by Delian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9511
    • View Profile
Re: [DONE][Suggestion] Chronological Research History
« Reply #11 on: March 23, 2025, 08:52:46 am »
1. ITEM column is called NAME (the video is a bit old). "item" is however still used in the explanation templates, I used "topic" several times and changed it back and forth, but "topic" simply didn't sound good to me, so I changed the word to an even more generic word "item" (as in list item or research diary item) at the end.
2. TYPE was chosen because it's short in all languages and fits nicely into this narrow column (also SOURCE is even less understandable than TYPE for an average user IMO). For the same reason it says "DATE" instead of "Completed on".
3. There is no ID to sort, so it is sorting by DATE (I can autogenerate ID if needed, but sort by DATE was ok for me so far).
4. Quicksearch will be updated to include DATE, I forgot that.
5. This whole screen is for debug/troubleshooting purposes only (IMO), so I will leave the codes there by default. If someone doesn't want them, they can be removed by template translation (by the modder/player).
6. Non-global research diary? What is it? Doesn't make much sense to me.

Code: [Select]
  STR_DISCOVERY_SOURCE_BASE: "This item was discovered via a research project.{NEWLINE}Research base> {ALT}{1}{ALT}{NEWLINE}Item code> {ALT}{0}{ALT}"
  STR_DISCOVERY_SOURCE_FREE_FROM: "This item was given for free from another research project.{NEWLINE}From research project> {ALT}{2}{ALT}{NEWLINE}{ALT}{1}{ALT} -> {ALT}{0}{ALT}"
  STR_DISCOVERY_SOURCE_FREE_AFTER: "This technical item was discovered automatically.{NEWLINE}After research project> {ALT}{2}{ALT}{NEWLINE}{ALT}{1}{ALT} -> {ALT}{0}{ALT}"
  STR_DISCOVERY_SOURCE_MISSION: "This item was given for free as a mission reward.{NEWLINE}Mission type> {ALT}{2}{ALT}{NEWLINE}{ALT}{1}{ALT} -> {ALT}{0}{ALT}"
  STR_DISCOVERY_SOURCE_EVENT: "This item was given for free as an event reward.{NEWLINE}Event type> {ALT}{2}{ALT}{NEWLINE}{ALT}{1}{ALT} -> {ALT}{0}{ALT}"
« Last Edit: March 23, 2025, 11:40:25 am by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9511
    • View Profile