What is the best way to organize communication with a 3rd party code?

Hello everyone!

I’m pretty new at UE4 and I stumbled across the following program design problem. I have a weather simulation system (implemented as an independent c++ module (bunch of c++ classes really)) that should affect nearly all actors on a map. It implements a set of methods like GetTemperatureAt(...), EmitHeatAt(...), GetWindDirectionAt(...), etc...Actors should be able to query “weather” state and push updates to the simulation, therefore a proper communication method should be established. I’ve come up with these three ideas, but I’m not very familiar with UE4 way of doing things :frowning:

  1. Singleton. Plain old singleton class that will manage lifecycle of the simulation module and serve as the main interface to it. Any actors that are interested in the “weather” will communicate with it via smth like

  2. One custom actor per level which will essentially have the same methods as the singleton above (GetWeather, EmitHeat, GetHumidity, etc) and will manage lifecycle of an instance of the “weather simulator”.

  3. Subclass UGameInstance and implement all the methods there (which will redirect function calls to an instance of the “weather simulator” class).

  4. Other. No idea ¯\(ツ)/¯. GameState, Level blueprint, ???

So, the question is: What is the common way (design pattern) of implementing such a thing (communication with a global per level entity) in UE4?