Author Topic: Smoother Key + Mouse Scrolling plugins  (Read 10465 times)

Offline Buttercraft

  • Grunt
  • ***
  • Posts: 56
    • View Profile
Smoother Key + Mouse Scrolling plugins
« on: March 22, 2023, 01:47:48 AM »
Hello, are there any plugins to get "Starcraft style" smooth scrolling in War2? :thinking:

by default key scrolling moves the screen in 64px increments (and 32px if you click and scroll with the minimap)

Online Mistral

  • Administrator
  • Axe Thrower
  • *****
  • Posts: 408
    • View Profile
Re: Smoother Key + Mouse Scrolling plugins
« Reply #1 on: March 22, 2023, 04:38:14 AM »
war2 cannot draw "half" of map square or 60/40 or any %
u cannot set camera in "between"
it can only be set onto fixed grid of 32x32
the entire war2 game engine is builded around this and u cannot overcome this

Offline Buttercraft

  • Grunt
  • ***
  • Posts: 56
    • View Profile
Re: Smoother Key + Mouse Scrolling plugins
« Reply #2 on: March 22, 2023, 07:47:22 AM »
I figured that was the case as HD plugin scales in 32px increments.

32px is MUCH smoother than 64px though, you can try it on minimap click-hold and drag, I think it's worth moving to 32px and doubling the default scrolling rate in menu for a better experience.

There are mscroll/kscroll references in the main .exe but I don't know where those three values (or tables) are stored.
« Last Edit: March 22, 2023, 07:51:12 AM by Buttercraft »

Offline fois

  • Grunt
  • ***
  • Posts: 248
  • Chicken
    • View Profile
Re: Smoother Key + Mouse Scrolling plugins
« Reply #3 on: March 27, 2023, 05:49:03 AM »
I just tested it and it does look nice, made a new plugin for it:
https://github.com/FunkyFr3sh/Warcraft-II-Plugins/releases

Offline Buttercraft

  • Grunt
  • ***
  • Posts: 56
    • View Profile
Re: Smoother Key + Mouse Scrolling plugins
« Reply #4 on: March 27, 2023, 01:42:46 PM »
Great improvement and great work :chuckisthemuscle:

Scrolling is now imperceptibly smooth at max scroll speed, but it is a little too fast, so I choose one notch down.

Is there a way to tweak the rates any further? assuming all the seven are hard coded in finite range.

If that is the case the sweet spot probably lies between current 6-7.
« Last Edit: March 27, 2023, 01:54:43 PM by Buttercraft »

Offline fois

  • Grunt
  • ***
  • Posts: 248
  • Chicken
    • View Profile
Re: Smoother Key + Mouse Scrolling plugins
« Reply #5 on: March 27, 2023, 02:13:58 PM »
It should be the same scroll speed as before, I could make it possible to tweak the values via an .ini file if needed though.

By default it would scroll over 2 cells every 20ms, with the plugin it scrolls 1 cell every 10ms.



If you know how to compile the plugin then you could tweak the 0x0A (= 10ms) here:
https://github.com/FunkyFr3sh/Warcraft-II-Plugins/blob/main/SmoothScroll/w2p.c#L14

Offline Buttercraft

  • Grunt
  • ***
  • Posts: 56
    • View Profile
Re: Smoother Key + Mouse Scrolling plugins
« Reply #6 on: March 27, 2023, 03:09:24 PM »
I think an .ini would be ideal, there is room for improvement on the defaults.

Seems the lower settings are calculated/multiplied off one MAX value? which is why they cause judder effect.

Let's assume the engine runs in 60fps.

Possible values are

1ms (60/60)
2ms (60/30)
3ms (60/20)
4ms (60/15)
5ms (60/12)
6ms (60/10)
10ms (60/6)
12ms (60/5)
15ms (60/4)
20ms (60/3)
30ms (60/2)
« Last Edit: March 27, 2023, 04:14:21 PM by Buttercraft »

Offline fois

  • Grunt
  • ***
  • Posts: 248
  • Chicken
    • View Profile
Re: Smoother Key + Mouse Scrolling plugins
« Reply #7 on: March 27, 2023, 10:23:48 PM »
Yeah that could be true


I updated the plugin, you can play around with the new "SmoothScroll.ini" settings file if you want

Offline Buttercraft

  • Grunt
  • ***
  • Posts: 56
    • View Profile
Re: Smoother Key + Mouse Scrolling plugins
« Reply #8 on: March 28, 2023, 11:27:19 AM »
Thanks fois,

Ok the delay in reality is just a wait timer, it doesn't affect rate unless you miss frame timing.

10ms is only 1.67 ticks every frame, ideally you want >2x frequency.

5ms (10 ticks every 3 frames) is an obvious choice.
« Last Edit: March 28, 2023, 03:21:14 PM by Buttercraft »

Offline Buttercraft

  • Grunt
  • ***
  • Posts: 56
    • View Profile
Re: Smoother Key + Mouse Scrolling plugins
« Reply #9 on: March 28, 2023, 11:48:56 AM »
Maybe worth merging smooth scroll into next version of HD plugin, as it doesn't have alot of value at standard resolution anyway (IMO).

I am using crt-easymode.glsl shader with great results, works nicely at any resolution ^-^

-bilinear is just a switch in cnc-ddraw, you don't need the file present (just included for simplicity)

Offline fois

  • Grunt
  • ***
  • Posts: 248
  • Chicken
    • View Profile
Re: Smoother Key + Mouse Scrolling plugins
« Reply #10 on: April 10, 2023, 01:00:18 PM »
I prefer to keep it separate, it does work without the widescreen patch as well (might not help that much, but still nice to have)

Yeah I know that shader (it's also in my "shader-package.zip which I forgot to include in the widescreen patch...)