Supreme Commander like tiltzoom

Supreme Commander like tiltzoom

Requests for features in the spring code.

Moderator: Moderators

Post Reply
qwerty3w
Posts: 1
Joined: 04 May 2018, 08:36

Supreme Commander like tiltzoom

Post by qwerty3w »

Basically a camera that's perpendicular to the map on the max zoom out, also centers the map on the screen. It tilts gradually when it zooms in, in SupCom it looks like the camera angle will be completely parallel to the map if the camera could actually touch the ground, makes it a 90° to 0° rotation, but the game restricts the minimal zoom-in distance.
Objects will be pulled to the center of the screen as a by-product of the rotation combined with zooming, which is a useful feature itself, not something to be avoided.
You could probably get a better idea by watching any SupCom gameplay video, like this one:
https://youtu.be/d0mRVF6wN2Y?t=124

It could serve as a great replacement for clicking on the minimap, also reduces the need of camera edge panning to some degree, it's aesthetically pleasing too.

Shadowfury333 tried to implement something like that for Zero-K in lua, but ran into problems:
Shadowfury333 wrote:Honestly I did the best I could manage, and I'm still not sure why it's bumpy
I set up similar code at work (industrial project, not a game), and it works perfectly
the algorithm is theoretically simple (store world-space point under cursor, zoom, rotate based on zoom, pan so that previously stored world-space point goes back under cursor), but actually executing it within Lua alongside the other 3000 lines of code for COFC turns out to not be so simple, a lot of that likely being that Spring lacks a built-in camera that can do the stuff COFC needs (free camera used to, but rotation got borked a couple years back) so almost everything mathematical is done in Lua
I realize there's also a bit of pan drift to pull the object under cursor to the center of the screen, but that's only a tiny addition to the algorithm and not the source of the bumpiness
the only hint I've ever had was that the bumpiness is framerate dependent
which kinda makes sense, since AFAIK Spring doesn't exactly have a way to get screen->world projection data without actually adjusting the camera, which IIRC happens on one of the graphical update events, and those events are FPS dependent.
So I think maybe it could be better implemented as an engine feature.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Supreme Commander like tiltzoom

Post by Silentwings »

It would better to report/fix any bugs in free camera and implement your feature request via lua. It's worth checking carefully that there aren't camera smoothing widgets and suchlike within ZK interfering.

I'm skeptical that free camera can be much broken, because I know of people within BA who use custom lua cameras based on it.
AFAIK Spring doesn't exactly have a way to get screen->world projection data without actually adjusting the camera
https://springrts.com/wiki/Lua_Unsynced ... reen_Trace, doesn't Spring.TraceScreenRay do that?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Supreme Commander like tiltzoom

Post by Kloot »

Isolate the bug in a minimal standalone widget with one of the default cameras and report it on mantis.
Post Reply

Return to “Feature Requests”