Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare current time against logfile of choice #46

Open
2 tasks
ngraham20 opened this issue Dec 23, 2023 · 3 comments
Open
2 tasks

Compare current time against logfile of choice #46

ngraham20 opened this issue Dec 23, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@ngraham20
Copy link
Owner

  • convert logfile to splits so at least having a +00:03:15 indicator is possible
  • figure out how compare the position of the ghost and the player relative to the next checkpoint (what does "ahead" even mean)
@ngraham20 ngraham20 added this to the Online Functionality milestone Dec 23, 2023
@ngraham20 ngraham20 added the enhancement New feature or request label Dec 23, 2023
@ngraham20
Copy link
Owner Author

Here's how killer's ghost timer works:

  1. get the xyz coordinates into a vector
  2. find the closest coordinate to the player's current coordinate (euclidian distance every single coordinate. Very slow)
  3. get the time from the same line as those ghost coordinates

This does the job, but as it's super slow to iterate over a vector over 1.5k times every loop, this may not be viable

@ngraham20
Copy link
Owner Author

to create a splits file from a log

  1. iterate over the coordinates
  2. when a coordinate is inside the starting checkpoint, save that time as a split
  3. do this for each checkpoint until the log file is over
  4. you'll now have splits data from the log which can be compared against quickly

@ngraham20
Copy link
Owner Author

This may be able to be sped up significantly by caching the log entry index when it's found the closest one. Using Rust's slices, you can stop checking any position before the most recently found location. Essentially:

  1. find the min once and cache its index
  2. on subsequent searches, find the min of the slice [idx..], which equates to the remainder of the vector

The min function probably should be done manually, in order, starting with idx=0 so that local minimums are allowed. This will account for things like looping and getting stuck. Also, since the closest position will also be the closest to the front of the vector, this should be incredibly fast, as it won't be necessary to iterate over the entire vector every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant