ElectronicObserverEN / ElectronicObserver

Electronic Observer is a game viewer for Kantai Collection.
Other
83 stars 19 forks source link

Manual quest tracker creation #63

Open myangelkamikaze opened 3 years ago

myangelkamikaze commented 3 years ago

Check if it's possible to make an easy way to edit quest trackers by end users. Could start with json first to represent the data structure, and possibly make an UI for it later.

Jebzou commented 3 years ago

Am i getting somewhere with something like this or should i just stop ? This could be easily serialized/deserialized

https://github.com/Jebzou/ElectronicObserver/commit/1c715ec05551fd8068ea30ed1bb42ec6ea487ec6

myangelkamikaze commented 3 years ago

Sorry, I should have written that I'm working on this and am mostly finished somewhere, but event happened and 5.0.0 migration is taking more time than expected so I didn't have time to finish polishing it up. Removing help wanted would probably help :D

Having a list of edges for battle quest might be overkill and a bit annoying to make manually. BattleManager.Compass.EventID is 5 for boss nodes, which should be sufficient for most cases.

That's the only nitpick I have. From a quick look it seems like you tried to stay consistent with the existing quest code. I started out with that but decided to change things to a more generic design.

I pushed my WIP now: https://github.com/gre4bee/ElectronicObserver/commit/7f163386f6f99dc7495c53016ae78a2654fab40e. There's quite a lot of code but I'll try to point out the main parts.

Data model

TrackerModel is the root. It consists of a quest, tasks and a condition group. https://github.com/gre4bee/ElectronicObserver/blob/QuestTrackerManager/ElectronicObserver/Window/Dialog/QuestTrackerManager/Models/TrackerModel.cs

Tasks are basically just anything you want to track, boss kills, expeditions etc. All task implementations are in the union attributes, more on that later. https://github.com/gre4bee/ElectronicObserver/blob/QuestTrackerManager/ElectronicObserver/Window/Dialog/QuestTrackerManager/TrackableTasks/ITrackableTask.cs

Condition group is a list of conditions that can be checked with and or or. https://github.com/gre4bee/ElectronicObserver/blob/QuestTrackerManager/ElectronicObserver/Window/Dialog/QuestTrackerManager/Models/ConditionGroupModel.cs

Condition implementations are in the union attributes. https://github.com/gre4bee/ElectronicObserver/blob/QuestTrackerManager/ElectronicObserver/Window/Dialog/QuestTrackerManager/Models/ICondition.cs

Logic

Main logic is in QuestRequirementViewModel. You have a list of trackers, can add/remove them, and it subscribes to apis so it can increment the correct trackers (incrementation still needs to be extended to support more task types). https://github.com/gre4bee/ElectronicObserver/blob/QuestTrackerManager/ElectronicObserver/Window/Dialog/QuestTrackerManager/QuestRequirementViewModel.cs

TrackerViewModel handles adding/removing tasks, and increments the correct tasks if the conditions are met. https://github.com/gre4bee/ElectronicObserver/blob/QuestTrackerManager/ElectronicObserver/Window/Dialog/QuestTrackerManager/ViewModels/TrackerViewModel.cs

Conditions and tasks have their own logic to check if the increment applies to them.

Serialization

Json serializer doesn't seem to support polymorphism, so MessagePack is used instead. MessagePack supports polymorphism by wrapping the object and adding a type discriminator. The discriminators are the values in the union attributes. For example if you have a boss kill task, instead of making [BossKillTask], it will make [0, [BossKillTask]]. MessagePack is a binary format so you can't really share that via external sources, but it supports converting to json, which is used here.

I'm currently using integer keys, so the json is actually arrays rather than objects. I didn't decide on the final format yet but started with keys which are more performant and make a smaller output text. The disadvantage is that reading the output is a bit hard for humans.

NaokiSato102 commented 2 years ago

I'm sure this feature will come in handy. It's also something that I've been requesting to be implemented in the mainstream. However, it is a bit difficult to use because of the lack of on-screen instructions on how to use it. It would be nice if there were easy-to-use in-app explanations.

By the way Does the mission tracker created by this feature have the ability to feed back to you? If there is, I think it would be a win-win if it could be reflected in the settings, saving the time and effort of updating.

myangelkamikaze commented 2 years ago

Agree, it's not really easy to use currently, it's still a work in progress. There are some basic instructions here: https://github.com/gre4bee/ElectronicObserver/wiki/Quest-tracker-manager

I'm not sure what's meant with the feedback question. You mean if we can see the trackers users make? We can't, it's not really a problem since quests don't get added that often, so the trackers are easy enough to make and share.

NaokiSato102 commented 2 years ago

Thank you for taking the trouble to introduce the page with examples of use.

As for the reply to my question, my understanding is a bit incomplete since I am using machine translation, but I thought it looked okay somehow.

myangelkamikaze commented 2 years ago

I just wasn't sure if that was what you're asking so I wanted to make sure ・。・v Note that you can write in Japanese if you want.

NaokiSato102 commented 2 years ago

では遠慮なく。 作成した任務データを、簡単にシェアできれば、神風氏が更新するまで間を持たせることができるほか、そのデータを(精査の上)本体に組み込むこともできるのではと思いました。

myangelkamikaze commented 2 years ago

Ah, okay, so I understood it correctly.

Making an automatic tracker submission would probably take longer than making trackers does, and I get help with tracker making on discord too, so that wasn't considered at all.

NaokiSato102 commented 2 years ago

そういえばDiscordありましたね

myangelkamikaze commented 2 years ago

・。・v image