Skip to content

fjamesprice/DF-Slide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DF-Slide

Smooth visual interpolation for unit movement in the Steam version of Dwarf Fortress to help players who have trouble tracking tile-based step movement. Purely visual and does not alter gameplay mechanics.

THIS IS 99% A.I. GENERATED AND I DON'T KNOW WHAT I'M DOING!

The other ~1% is this sentence, the one above, and some other additions like these! That said, there might be a chance this could be a good starting point for this project, so maybe someone who knows something could make it work. I haven't even tried it yet.

Overview

This mod attempts to add smooth visual interpolation for unit movement in Dwarf Fortress, making it easier to track moving units by eliminating the "teleport" effect of tile-based movement.

Features

  • Smooth interpolation: Units glide smoothly between tiles instead of jumping
  • Ghost trail: Semi-transparent preview shows where units are moving to (or moved to, to be more accurate)
  • Performance optimized: GPU-based rendering with minimal CPU overhead
  • Configurable: Adjust speed, toggle features, and customize appearance
  • Accessibility-focused: Helps players with visual tracking difficulties

Requirements

  • Dwarf Fortress (Steam version)
  • DFHack (latest version compatible with your DF version)
  • OpenGL 3.3+ capable graphics card

Installation

Step 1: Install DFHack

  1. Download DFHack from https://github.com/DFHack/dfhack/releases
  2. Extract to your Dwarf Fortress installation directory
  3. Verify DFHack works by launching DF and typing help in the DFHack console

Step 2: Build the Plugin

Prerequisites

  • CMake 3.10+
  • C++ compiler (GCC, Clang, or MSVC)
  • DFHack development files

Build Commands

# Navigate to DFHack plugins directory
cd /path/to/dfhack/plugins

# Create plugin directory
mkdir smooth-movement
cd smooth-movement

# Copy plugin files
# - smooth-movement.cpp
# - smooth_movement.vert
# - smooth_movement.frag
# - CMakeLists.txt

# Build
mkdir build
cd build
cmake ..
cmake --build .

# Install
cmake --install .

Step 3: Configure Auto-Load

Create or edit dfhack-config/init/onLoad.init:

# Enable smooth movement on fortress load
smooth-movement enable

Usage

Basic Commands

Enable smooth movement:

smooth-movement enable

Disable smooth movement:

smooth-movement disable

Toggle ghost trail:

smooth-movement ghost on
smooth-movement ghost off

Adjust interpolation speed (0.5 = slower, 2.0 = faster):

smooth-movement speed 1.5

Check current status:

smooth-movement status

Configuration Options

Edit dfhack-config/smooth-movement.json to customize:

{
  "enabled": true,
  "ghost_trail": true,
  "ghost_alpha": 0.5,
  "interpolation_speed": 1.0,
  "max_tracked_units": 500
}

Settings:

  • enabled: Master on/off switch
  • ghost_trail: Show semi-transparent unit at destination
  • ghost_alpha: Transparency of ghost (0.0-1.0)
  • interpolation_speed: Speed multiplier (0.5-2.0)
  • max_tracked_units: Maximum units to track (performance)

Performance Tuning

Low FPS Issues

If experiencing frame rate drops:

  1. Reduce tracked units:

    smooth-movement maxunits 200
    
  2. Increase interpolation speed (less time per frame):

    smooth-movement speed 1.5
    
  3. Disable ghost trail:

    smooth-movement ghost off
    

High CPU Usage

  • The plugin automatically culls off-screen units
  • Only units on the current z-level are tracked
  • Interpolation is GPU-based for efficiency

Troubleshooting

Units still "jump" between tiles

  • Check that the plugin is enabled: smooth-movement status
  • Verify DFHack is running correctly
  • Ensure game speed is not too fast (affects interpolation timing)

Visual artifacts or flickering

  • Update graphics drivers
  • Try adjusting interpolation speed
  • Disable ghost trail temporarily

Plugin won't load

  • Check DFHack console for error messages
  • Verify all shader files are in hack/shaders/
  • Ensure OpenGL 3.3+ support

Performance issues

  • Reduce max_tracked_units setting
  • Disable ghost trail feature
  • Check that GPU acceleration is working

Technical Details

How It Works

  1. State Tracking: Plugin hooks into DF's simulation tick to detect unit position changes
  2. Interpolation: Between ticks, positions are smoothly interpolated using GPU shaders
  3. Rendering: Custom GLSL shaders render units at interpolated positions
  4. Ghost Trail: Optional semi-transparent sprite at final destination

Architecture

  • DFHack Plugin (C++): Tracks unit positions and manages state
  • Vertex Shader (GLSL): Calculates interpolated positions
  • Fragment Shader (GLSL): Renders units with optional ghost effect

Performance Characteristics

  • CPU overhead: Minimal (~1-2% on modern processors)
  • GPU overhead: Negligible with hardware acceleration
  • Memory usage: ~50KB per 100 tracked units
  • Frame impact: <1ms per frame with default settings

Compatibility

Tested With

- Dwarf Fortress Steam v50.xx - DFHack 50.xx-r1+ Nothing.

Known Assumed Issues

  • Very fast game speeds may show slight stuttering
  • Extreme z-level jumps (teleportation) cannot be smoothly interpolated
  • Units being flung by catapults may show unexpected interpolation

Accessibility Notes

This mod was designed specifically to help players who have:

  • Difficulty tracking rapid movement
  • Visual processing challenges
  • Motion sensitivity
  • ADHD or similar conditions affecting visual attention

The ghost trail feature is particularly helpful for predicting unit movement paths.

About

Smooth visual interpolation for unit movement in the Steam version of Dwarf Fortress to help players who have trouble tracking tile-based step movement. Purely visual and does not alter gameplay mechanics.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors