Skip to content

Subject: Feature Request/Pull Request: Dynamic Camera Movement Speed based on Height#49

Closed
winyunq wants to merge 12 commits intoHeyZoos:mainfrom
SecondSinoJapaneseWar:main
Closed

Subject: Feature Request/Pull Request: Dynamic Camera Movement Speed based on Height#49
winyunq wants to merge 12 commits intoHeyZoos:mainfrom
SecondSinoJapaneseWar:main

Conversation

@winyunq
Copy link

@winyunq winyunq commented Sep 22, 2025

Subject: Feature Request/Pull Request: Dynamic Camera Movement Speed based on Height

Hi, HeyZoos

First and foremost, I want to express my appreciation for your excellent RTS Camera plugin! It's a
fantastic piece of work, and I'm planning to integrate it into my own RTS game project.

During my development and testing, I identified an opportunity to enhance the camera's usability,
particularly in the context of RTS gameplay. I believe the current camera movement speed could benefit
from being dynamically linked to the camera's current height.

Motivation for this feature:
In RTS games, players often switch between macro-management (overview of the battlefield) and
micro-management (detailed unit control).
Higher camera altitudes* are typically used for macro-management, where faster movement across the map
is desirable for quick strategic adjustments.
Lower camera altitudes* are for micro-management, where slower, more precise movement allows for
accurate unit positioning and control.
This dynamic adjustment would significantly improve the player experience by intuitively matching movement
speed to the current strategic context.

Implemented Changes:
I've implemented a system that adjusts the camera's movement speed based on its height. Specifically, the
changes include:

  1. Unified Movement Parameter: Both edge scrolling and key-based movement now utilize a single,
    height-interpolated movement speed parameter.
  2. Base Speed Introduction: A foundational movement speed has been introduced.
  3. Height-Based Interpolation: The current camera speed is now interpolated based on the camera's height,
    ensuring a smooth transition between fast (high altitude) and slow (low altitude) movement.

These modifications are primarily contained within RTSCamera.cpp and RTSCamera.h.

I'm relatively new to the Git pull request process, but I've prepared these changes and hope you'll find
them a valuable addition to the plugin. I've focused on modifying RTSCamera.cpp and RTSCamera.h to achieve
this functionality.

Thank you again for your contribution to the community!

  - 左键点击:单选 (Exclusive Select)。
  - 左键框选:多选 (Box Select)。
  - Shift + 点击:反选/移除 (Toggle/Remove)。
  - Shift + 框选:追加选择 (Append),且具备类型一致性保护 (Type Consistency)。
  - Ctrl + 点击:全屏同类选择 (Select All On Screen)。
  - Tab:在选中单位的子组间循环切换 (Cycle Subgroup)。
- 优化框选判定阈值:
  - 引入 1像素 (1px) 严格阈值,区分点击与框选。
  - 只有拖拽距离 > 1px 时才绘制绿框和执行框选逻辑,实现所见即所得。
- 增强视觉反馈:
  - 绿框增加半透明蒙层 (SelectionBoxFillColor),提升辨识度。
  - UI 增加 Grid 池化复用逻辑,解决 Grid 布局抖动问题。
- 数据层完善:
  - URTSSelectable 组件新增 Icon, Health, Shield 等基础 RTS 属性。
  - SelectionSubsystem 正确读取并传递这些数据到 UI。
  - 左键点击:单选 (Exclusive Select)。
  - 左键框选:多选 (Box Select)。
  - Shift + 点击:反选/移除 (Toggle/Remove)。
  - Shift + 框选:追加选择 (Append),且具备类型一致性保护 (Type Consistency)。
  - Ctrl + 点击:全屏同类选择 (Select All On Screen)。
  - Tab:在选中单位的子组间循环切换 (Cycle Subgroup)。
- 优化框选判定阈值:
  - 引入 1像素 (1px) 严格阈值,区分点击与框选。
  - 只有拖拽距离 > 1px 时才绘制绿框和执行框选逻辑,实现“所见即所得”。
- 增强视觉反馈:
  - 绿框增加半透明蒙层 (SelectionBoxFillColor),提升辨识度。
  - UI 增加 Grid 池化复用逻辑,解决 Grid 布局抖动问题。
- 数据层完善:
  - URTSSelectable 组件新增 Icon, Health, Shield 等基础 RTS 属性。
  - SelectionSubsystem 正确读取并传递这些数据到 UI。
- 开启框选 DrawDebug 视锥体可视化(WITH_EDITOR)
- 点选扩展范围从 4px 缩减为 2px
- 修复 IsValidIndex(-1) 崩溃(IssueCommand 中 EntityHandle 有效性校验)
- Shift/Ctrl 框选 Grid 刷新改为三种 Modifier 均触发
- Grid 查找改为 ActiveGroupKey 直接驱动(移除遍历 Handle 路径)
- CreateUnitDataFromEntity 改为读 FSubType.Index 分组
- View.Items 排序保证同类型单位连续显示
- 添加 FSubType.h include
@HeyZoos
Copy link
Owner

HeyZoos commented Feb 25, 2026

Hey! Sorry for taking so long to get back to you. I'll take a look soon :)

@HeyZoos
Copy link
Owner

HeyZoos commented Feb 25, 2026

I really appreciate you taking so much time to do this. It looks like it was a ton of work.

Unfortunately, it looks like there's many changes mixed in that depends on plugins that are specific to your project. If I were to merge this it would break the plugin for other folks. Would you be open to backing those changes out?

},
{
"Name": "LandmarkSystem",
"Enabled": true
Copy link
Owner

Choose a reason for hiding this comment

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

These plugins seem specific to your project

"MassBattle",
"MassAPI",
"MassEntity",
"LandmarkSystem",
Copy link
Owner

Choose a reason for hiding this comment

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

Same as the other comment, these plugins are specific to your game / project

* Unified data structure representing a single selectable unit OR a group summary.
*/
USTRUCT(BlueprintType)
struct FRTSUnitData
Copy link
Owner

Choose a reason for hiding this comment

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

I believe this is expanding the scope of the project to beyond just a camera library.

@winyunq
Copy link
Author

winyunq commented Feb 25, 2026

It seems I may have misunderstood how GitHub pull requests work. In commit [8333bc6], I implemented a correlation between camera zoom (Z-axis) and movement speed: the camera moves faster when zoomed out for a better overview, and slower when zoomed in for precision. However, the subsequent 11 commits were not intended for your repository. This was an operational error on my part. I will see if I can resubmit a clean pull request containing only commit [8333bc6].

@winyunq
Copy link
Author

winyunq commented Feb 26, 2026

I apologize for the previous push. My local environment was misconfigured, leading to unintended changes from my personal project being tracked. I have resubmitted a clean and focused version in PR #50: #50. Closing this PR now.

@winyunq winyunq closed this Feb 26, 2026
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