Thank you @gamingislove for the detailed answer, and thank you @GeneralK again! These are exactly the type of guidance I need. I think I got a clear idea on question 1-6 and 8.
I'll explain the context of Q7 in more detail and list the help I need at the bottom:
Context
Q7 touches the core of my game implementation: the colony mode is a real-time system separate from ork, which I'm using turn-based phase battle only. Player can not directly control the movement & actions of any character but only affect how each character in colony mode moves and works by adjusting their "schedule", a bit like RimWorld.
I've recorded a longer video to show the colony mode (0~19s). 20~21s is a world map full of colonies (or empty locations) that allow switch between colonies, and more importantly start a battle that connecting colony mode to ork phase battle. 22~27s shows an ork phase battle took place at a colony, and 28~45s are just normal ork phase battle.
When I started the project I assume ork does not handle resource gathering, building, schedule of each character, etc. so I was using two systems in parallel, one for real-time management (colony) and one for turn-based grid battle(ork). I was thinking using the colony system as base to keep all data, and "Sync" the data to ork whenever a battle happens.
In the video, all characters in 0~19s are colony characters, and all in 22~45s are ork characters. They are different prefabs that have no connection at all, except use the same model (mesh, bones, materials). The colony character will get tired and hungry over time, gain experience while gathering resources/forging weapons/build architectures/practice abilities over time, sleep over time to recover energy, and real-time move speed plays a key role in efficiency of some jobs, say resource gathering. When a character perform certain job for long enough time, for example mining, his strength increases.
I essentially created an "instance dungeon" for each battle, and I was planning to copy all data/stats from my "colony character" that's relevant to battle to the corresponding "ork character" (HP, max HP, strength, learned ability, experience of each ability, equipment, items), have them being updated during the ork phase battle, and copy the result ( character experience gained, HP lost, items consumed, loot gain, ability experience gained, new ability learned by reading book, whether a character is permanently dead ) back to the colony mode.
After reading your answers to my other questions I think it might even be possible to use ork and the base system and keep track of all data of each character, and have the colony system update the corresponding stats whenever a battle or save happens.
However even in this case I would still need a way to read data from ork, copy to colony mode, wait for the change over time, and update the data back to ork. Specifically:
- HP: it will reduce when a character move on the map from one colony to another. When battle happen at the destination colony, the starting HP in Ork Phase Battle will be a lot lower than starting HP when the character leaves home colony.
- Max HP, Strength, Level: during battle a character might level up (not even by end of battle, but during battle), which changes these stats, and these change needs to be reflected in real-time colony mode: for example strength affects the productivity of mining, level affect enemy level in events, low HP at higher Max HP takes longer time of rest to recover, etc.
- Ability Experience: ability experience can be gained in colony mode by spending time on "practicing" (spending time in a practice room) and in ork battle by using the ability in the battlefield. Ability experience dominates damage and accuracy in battle mode, as well as practicing efficiency in colony mode (slower to increase experience by practicing when the experience is already 900 than when it is 100), so need to keep both systems in sync when entering and leaving the battle mode.
- Ability Learned: character learns an ability when his experience of this ability reach 300, reading a book grants 80 ability experience. So if a character get a book through loot or steal during battle, and he already at 250 experience of that ability, if he use that book in battle, he will gain a new ability with 330 experience that can be used right away in battle. He might use it multiple times to bring the experience to 400. This ability with 400 experience will need to be reflected after battle end, and when he start spending time "practicing" this ability in colony mode, he starts from 400 experience. Same deal goes the other way round, if this character gain more than 300 experience of an ability through practicing or reading book during colony mode, he will learn a new ability that can be used in battle mode.
- And of course if a character permanently died in battle mode (ork) he's not gonna come back to life in colony mode. If a character is too low in loyalty and choose to leave player faction, or defected and joined a rival faction during colony mode, then he will not show up in the battle mode fighting for player faction.
Same thing happens with equipment, items, all other stats. The core problem essentially comes from the fact that there are a bunch of activities happening outside of ork, but will have impact in ork (phase battle); and anything happen in ork (during phase battle) will also directly impact the activities outside of ork.
This is phase battle in ork (turn counter at bottom right), all UI shown are either Ork HUD or UI Box. Bottom left is UI Box listing abilities, and three HUD templates to the right showing equipment, items (limit to 8 slots) and stats.
This is under colony mode (real-time, there's speed control buttons at bottom right), all these are my own UI, no ork HUD script or anything (in current implementation). However everything in red is relavent to ork (phase battle) and needs to be in sync with ork.
Essentially the button "Martial Lore" in colony mode should display similar information as ability menu but in different layout (it's the tech tree for abilities), "Equipment" button in colony mode should display both the colony item box and the equipment slot and item slot. Items and weapons can be produced during colony mode and somehow added to item box (ork) as well. The "Stats" part in my colony mode UI should display the exact same information as the HUD template, same goes with portrait, name, nickname (not shown here), job title, level, exp, etc. Currently these data are kept outside of ork, and displayed in my colony mode UI without using the HUD template already available in Ork UI system.
Questions
Q7.1 how can I reuse the HUD template (so getting relevant information from ork) while display them on the same UI that shows other non-ork aspects of the corresponding character? (same character from player perspective, but is its own 3D model prefab, own animation controller, and a separate set of data that's not relevant to ork. For example the schedule system where each little golden man icon represents an hour)
Q7.2 @gamingislove mentioned I could use schematics (Change Statues Value) but my question is exactly how I can get this schematic node to read data (for example current HP) from data under my colony mode (let's say an integer in an instance of my colony character)? And the reverse direction, how to write the remaining HP into this integer in my colony mode when battle ends? I guess I would still need to play with setValue() or addValue() in this API when characters join battle (write the current colony data into ork), and getValue() when the battle is over (write the current ork data into colony)?
I've already had a button in my colony UI that add items to ork so I know script would work (snippet below). I just haven't find a code snippet on reading/writing values shows me an example.
public void OnClickPotion()
{
Debug.Log($"Within Colony Sim add Item ID: 3, Quantity: 1");
GamingIsLove.ORKFramework.Item item = ORK.Items.Get(3);
ORK.Game.ActiveGroup.Leader.Inventory.Add(new ItemShortcut(item, 1), true, true, true);
}
Anyhow I will try out ideas following answers I got so far and come back with a better question if I'm still stuck. Thank you both again!