I've been struggling with this problem for the last 24 hours or so, and am ready to call it unsolvable. But I figured that first I'd asked some smarter minds than my own. That's you guys.
I'm playing a game called Dual Universe, in which I build industry machines, set recipes, feed them input materials, start them up, and they make products in cycles. Just as one example, let's say I tell a Metalworking industry to make Screws, so it eats a piece of steel, works on it for a 60 second cycle, then spits out a screw. If it runs out of steel then it stalls, until I feed it more steel, then it starts up again.
Now I have a programming board in the game that I can plug into the industry to parse information, and run it through a LUA script. What I would like to do is make a script that will monitor a set of machines and display their current progress or remaining time on a screen. Unfortunately I cannot parse current progress or remaining time directly. The information I can parse is:
Uptime: The total time in seconds since the machine was started
Efficiency: The total uptime efficiency since the machine was started, expressed as a value between 0 and 1. So if it's been running half of the time, this value would be 0.5
CompletedCycleCount: the number of cycles that have completed since the machine was started
CycleTime: the time that it takes to complete one cycle
My thinking thus far is:
RemainingTime = Uptime - CurrentCycleTime?
CurrentCycleTime = Uptime - CompletedCycleSum?
CompletedCycleSum = CompletedCycleCount * CompletedCycleTime?
CompletedCycleTime = CycleTime / CompletedCycleEfficiency?
CompletedCycleEfficiency = ?
See, I can parse the efficiency up to the current second, but I can't figure out a way to calculate the efficiency that the completed cycles ran at, and without that I can't see a way to get to RemainingTime.
So, can any of you smart people figure a way through this problem? Or at least confirm my suspicion that it's impossible with the information available?