Skip to content

Add smooth-movement plugin - #5875

Open
notliad wants to merge 15 commits into
DFHack:developfrom
notliad:plugin/smooth-movement
Open

Add smooth-movement plugin#5875
notliad wants to merge 15 commits into
DFHack:developfrom
notliad:plugin/smooth-movement

Conversation

@notliad

@notliad notliad commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Adds the smooth-movement plugin to DFHack. It provides smooth visual interpolation for creatures, items, vehicles, and related overlays in the fortress viewport.

Notes

I closed the previous PR in favor of this version, which preserves the original code structure that was already reviewed by humans in the standalone repository.

Standalone repository: https://github.com/notliad/df-smooth-movement

Testing

  • Built the smooth-movement plugin through the DFHack build system.
  • Built and ran smooth-movement-test.
  • All regression assertions passed.

Comment thread plugins/smooth-movement/smooth-movement.cpp Outdated
Comment thread plugins/smooth-movement/smooth-movement.cpp Outdated
Comment thread plugins/smooth-movement/smooth-movement.cpp Outdated
Comment thread plugins/smooth-movement/smooth-movement.cpp Outdated
Comment thread plugins/smooth-movement/visual_animation.h
@ab9rf

ab9rf commented Aug 13, 2026

Copy link
Copy Markdown
Member

A general comment as this is a pervasive issue and I do not wish to pepper the review with dozens if not hundreds of comments: there are a lot of operations in here that work on (x,y) coordinate pairs that involve effectively duplicated code. DFHack has a 2d coordinate type df::coord2d that can be used to store a coordinate pair as a unit and operate on both components in parallel. Consider using df::coord2d in lieu of separate x and y variables wherever possible as this provides clearer indication of intention as well as reducing the risk of updating one but not the other resulting in inconsistent behavior.

I've made some other specific comments but this should not be considered a full review.

@notliad

notliad commented Aug 13, 2026

Copy link
Copy Markdown
Author

A general comment as this is a pervasive issue and I do not wish to pepper the review with dozens if not hundreds of comments: there are a lot of operations in here that work on (x,y) coordinate pairs that involve effectively duplicated code. DFHack has a 2d coordinate type df::coord2d that can be used to store a coordinate pair as a unit and operate on both components in parallel. Consider using df::coord2d in lieu of separate x and y variables wherever possible as this provides clearer indication of intention as well as reducing the risk of updating one but not the other resulting in inconsistent behavior.

I've made some other specific comments but this should not be considered a full review.

This will be a substantial refactor. I will look into it and the others comments as well.
I'm bit worried making lots of changes cause I can't reproduce (on both of my machines) the most common bug and need someone to test it for me, this can take a day or two.

@notliad

notliad commented Aug 14, 2026

Copy link
Copy Markdown
Author

Camera feature was not working properly and introduced a mouse click bug so I opted to remove it.

Edit: forgot to tag @ab9rf

@ab9rf ab9rf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this is not a complete review - i'll make another pass after these comments are addressed

Comment thread plugins/smooth-movement/smooth-movement.cpp
Comment thread plugins/smooth-movement/smooth-movement.cpp Outdated
Comment thread plugins/smooth-movement/smooth-movement.cpp Outdated
Comment thread plugins/smooth-movement/smooth-movement.cpp Outdated
Comment thread plugins/smooth-movement/smooth-movement.cpp Outdated
Comment thread plugins/smooth-movement/visual_animation.h Outdated
Comment thread plugins/smooth-movement/visual_animation.h Outdated
Comment thread plugins/smooth-movement/visual_animation.h
Comment thread plugins/smooth-movement/visual_animation.h Outdated
Comment thread plugins/smooth-movement/visual_animation.h Outdated
@ab9rf

ab9rf commented Aug 18, 2026

Copy link
Copy Markdown
Member

Edit: forgot to tag @ab9rf

not necessary to tag me, i'm notified on all activity on dfhack repositories

@notliad
notliad requested a review from ab9rf August 18, 2026 14:59
@ab9rf

ab9rf commented Aug 20, 2026

Copy link
Copy Markdown
Member

I'm not ignoring this PR; instead, reviewing this PR has illuminated for me a few places where our infrastructure is insufficient and so I am working on improving those. I should have some more comments in another day or two.

@notliad

notliad commented Aug 20, 2026

Copy link
Copy Markdown
Author

I'm not ignoring this PR; instead, reviewing this PR has illuminated for me a few places where our infrastructure is insufficient and so I am working on improving those. I should have some more comments in another day or two.

No worries, just let me know what I can do on my side.

@ab9rf

ab9rf commented Aug 20, 2026

Copy link
Copy Markdown
Member

No worries, just let me know what I can do on my side.

There are two things I'm working on that will impact this PR.

  • I am working on making a generalized template for coordinate pairs and coordinate triples. This is now mostly done but the process has illuminated a good deal tech debt which I am trying to clean up as best I can. Once this is finished, I will be expecting use to use these templates in place of the copy you've included in this PR.
  • Your code is using some constants that are known to us (they're in g_src which is published) but which we don't include in df-structures because, I guess, we didn't think anyone would need them. I'm going to be adding those to df-structures in the near future, and I will expect this PR to use them once they've been added.

bool flip_enabled = false;
bool zlevel_enabled = false;

// DF stores fire's animation frame in bits 28--31 of screentexpos_spatter_flag.

@ab9rf ab9rf Aug 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These appear to be incorrect. the encoding is actually
frame1 = 001 (1)
frame2 = 010 (2)
frame3 = 100 (4)
frame4 = 011 (3)
in bits 28-30. Bit 31 is used for something else.

Why Toady did it this way, I have no idea, but this is what's in the headers so...

Also this type is being added to df_structures as viewport_spatter_flag; please use the codegen-provided constants here instead of hardcoding them - see DFHack/df-structures#892

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants