hozuki / MilliSim

Extensible simulator for THE iDOLM@STER Million Live! Theater Days / アイドルマスターミリオンライブ!シアターデイズ用の拡張可能なシミュレーター / 可扩展的偶像大师百万现场剧场时光模拟器
MIT License
33 stars 3 forks source link

Questions about the API for Score Format Plugins #7

Open blueapple25130 opened 7 years ago

blueapple25130 commented 7 years ago

Looking at the current MilliSim API for Score Format Plugins, the compiler seems to compile MilliSim.SourceScore into MilliSim.RuntimeScore.

I think that the feature should be in MilliSim and not neccessary for external plugins.

[Example: flow of compile with external plugin]

1. (plugin).ScoreReader.ReadAsSourceScore
  (something source file)
    -> (plugin).SourceScore
  (convert by (plugin).Extensions.ToMilliSimSourceScore)
    -> MilliSim.SourceScore

2. (plugin).ScoreCompiler.Compile
  (MilliSim.SourceScore)
    -> MilliSim.RuntimeScore

(the 2nd process is unnecessary for external plugin)

hozuki commented 7 years ago

Yes, this is a problem in current IScoreCompiler design.

I abstracted IScoreCompiler in order to provide an open access to SourceNote and RuntimeNote. It is reserved for the ExtraProperties property on SourceNote and RuntimeNote. This property is not placed yet. It would be of type Dynamic, to store custom information on ordinary notes. For example, note attribute, custom command, etc. This feature should be used with custom Elements, to achieve those effects in Deleste, or something like this.

However the basic compile methods are quite the same, so I think these methods can be wrapped in a helper class instead of making everyone copy the code. A custom IScoreCompiler just need to call the methods to create a basic RuntimeNote (with timing info, etc.) and then fill in compiler-specific properties if there is any.

Right now I'm solving other bugs. I'll see if I can make this change in a few days.

hozuki commented 7 years ago

BTW, thanks.

blueapple25130 commented 7 years ago

I don't think it's any need to publish the compilation procedure externally. (-> IScoreCompiler.Compile) Simply, just read and compile inside the plugin and match it to MilliSim formats. figure2

hozuki commented 7 years ago

Something happened two weeks ago so I disappeared from GitHub for two weeks.

Anyway, here the point. The compiler design is preserved for score format exchange. It works like this:

image

The exchange I talked about:

image

I wrote a small example: here.