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

Velocity Module #2

Closed
Tmktahu opened this issue Sep 21, 2021 · 3 comments · Fixed by #8
Closed

Velocity Module #2

Tmktahu opened this issue Sep 21, 2021 · 3 comments · Fixed by #8
Assignees
Labels
Add-On Enhancement New feature or request Help Wanted Extra attention is needed

Comments

@Tmktahu
Copy link
Owner

Tmktahu commented Sep 21, 2021

Instead of trying to tie velocity directly into the base IPS code, I want to house it in a separate module.

In a perfect world, the module would have the following features:

  • 0.2 update speed
  • optional ability to store speed and velocity on memory chips
  • option to display speed on the same text panel as standard IPS
  • method of stabilizing the output to buffer against random coordinate spikes

But given line restrictions, not all of this may be possible. The speed calculation can only be compressed down so far.
d=sqrt((:x-x)^2+(:y-y)^2+(:z-z)^2)/t is the smallest form I know of, which is 36 characters.

In addition, velocity involves direction and speed, which means we want the ability to store a vector and the speed itself. the vector in question is [:x-x, :y-y, :z-z], so if we want to store those values then there need to be 3 additional assignment statements.
:u=:x-x :v=:y-y :w=:z-z d=sqrt(:u^2+:v^2+:w^2)/t ramps us up to 48 characters.

We also need to grab the current coordinates and save them for the next iteration, which is another round of assignments.
:u=:x-x :v=:y-y :w=:z-z :d=sqrt(:u^2+:v^2+:w^2)/t x=:x y=:y z=:z brings us to 64 characters.

And then we have the problem of display. We only have 6 characters left and need a goto statement in there as well, so display is pretty much impossible on this line.

We could consider making base IPS handle display optionally, but the code is so tight there to begin with that we would end up sacrificing configurability for more displayed information.

TODO:

  • Consider the downsides of a 0.4 update time to allow for display and potentially stabilizing logic.
  • Brainstorm the idea of a Display Module for the IPS system that purely handles display of information.
  • Write up a properly minified version that does not store the velocity vector.
  • Write documentation that explains the reasoning behind separating velocity out into its own module.
@Tmktahu Tmktahu added Add-On Enhancement New feature or request Help Wanted Extra attention is needed labels Sep 21, 2021
@Tmktahu
Copy link
Owner Author

Tmktahu commented Sep 22, 2021

I can save a couple characters by doing a ^0.5 instead of sqrt.

s=0.5
:u=:x-x :v=:y-y :w=:z-z :d=(:u^2+:v^2+:w^2)^s/t x=:x y=:y z=:z

^ happens before divide, so we don't need parens. This brings us to 62 characters. + the goto puts us at
:u=:x-x :v=:y-y :w=:z-z :d=(:u^2+:v^2+:w^2)^s/t x=:x y=:y z=:z goto# which is 68 characters.

@Tmktahu
Copy link
Owner Author

Tmktahu commented Sep 22, 2021

Further IPS modification has revealed a way to display the speed. But calculations will still be handled in this module.

@Tmktahu Tmktahu linked a pull request Sep 23, 2021 that will close this issue
@Tmktahu Tmktahu self-assigned this Sep 23, 2021
@Tmktahu
Copy link
Owner Author

Tmktahu commented Sep 23, 2021

Initial implementation done in #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Add-On Enhancement New feature or request Help Wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant