I'm a little bit stuck and having trouble getting through what I'm trying to wrap my mind around, so it's time to do what my friends like to call 'Codespew'... the following passages may not make any sense whatsoever, but the simple act of making the attempt to somehow define them helps me to figure out a problem.
It's actually hard to define where precisely this new problem is. I have the core of the GUI set up - there's still the analysis panel to create, but that'll just be a bunch of boxes with variables in them. Shouldn't be too much trouble to make. I haven't made it yet because I don't have the variables to put into it yet - and to have the variables, I need calculations to actually be done. Therein lies my problem - I'm not sure where to start with actually doing the calculations, especially considering my 'replay' feature.
The replay feature will be essential to the program, so I should probably figure out how precisely that is going to work before I do anything else. Okay, here's the premise.
The program first needs a way to distinguish between opening a file for stamping and opening a file for replaying. Stamping is the act of placing timestamps on the lines fed in from an original log file as it is being written by the LOTRO program. Replaying is the act of loading a previously stamped file and 'playing' the file's contents based on the timestamps, so it looks like the fight is happening in real time.
When stamping, the original logfile is constantly being read from and when the program catches a line that isn't empty, it processes it.
When replaying, the entire file is loaded into memory, processed into arrays/objects, and the program decides when to display each line based on the difference in timestamps between the 'next' line and the current line.
So how to differentiate? Do we do it based only on the presence of timestamps? The idea is flimsy at best. I think that the best way to do this would be to have two different 'load' menu options - 'stamp logfile' and 'replay logfile.' Each option should be able to call an event loop in the application, unless I'm terribly mistaken, so that we don't always have two loops running, and there isn't even one loop running if a file simply isn't loaded.
So, even when we've let the user specify what type of file we're messing with, how does the program know what to do with the contents of the file? This will require liberal use of regexps and arrays. I will need to define a number of different regexps (or perhaps One Regexp To Rule Them All, if I can manage it) that will be able to pull apart each line and stuff the important parts of it into an array for each line.
But what to do with those arrays? Where to put them? Each section of the log that spans a single stream of uninterrupted combat will be considered a subsession. A subsession is an object with a multidimensional array of data pulled from lines from the log file. Where do we put the subsession? It can go into an array inside a 'root' Session object.
So a Session object has an array which lists the subsessions which list the data from the lines.
Once I create this structure and am able to fill it with data, I will be able to proceed with the other things I mentioned earlier.