2025-08-20 16:19 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0005028Spring engineGeneralpublic2016-01-12 19:37
Reporterjamerlan 
Assigned Tohokomoko 
PrioritynormalSeveritymajorReproducibilitysometimes
StatusclosedResolutionno change required 
Product Version100.0 
Target VersionFixed in Version 
Summary0005028: broken "spring" cam zoom at the beginning of the game
Descriptiontake a look at this short video: https://youtu.be/nmyJgzXMJII

infolog is attached

I placed this line:
LOG("dist: %f, dir: %f, pixelSize: %f, scrollSpeed: %f, fov: %f", dist, dir, pixelSize, scrollSpeed, fov);

inside of
void CSpringController::Update()

and I guess it is not helped to debug.. I am not sure :-)
At least this code is executed -> spring cam is used.

This bug is reproducible with BA 9.27 and Tech Annihilation 2.38.5
Additional Informationthis looks like a minor issue but many BA players are suffering from this at the beginning of the match. Switching to overhead cam helps (ctrl+f2). So this bug is "spring" camera related
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0015459

jamerlan (reporter)

Just checked with the latest "dev" version - issue still present

"latest" version is this:
commit cf258a1d6d52308728677608525055de9966d838
Author: rtri <none@none>
Date: Fri Jan 8 02:50:16 2016 +0100

~0015461

abma (administrator)

from springsettings.cfg:

CamMode = 5

which should be "overview"

https://springrts.com/wiki/Springsettings.cfg#CamMode

~0015462

abma (administrator)

does it also fail with the "Camera Remember" widget disabled?

http://imolarpg.dyndns.org/trac/balatest/browser/trunk/luaui/widgets/camera_remember_mode.lua

~0015463

jamerlan (reporter)

from attached infolog.txt we can see:

[f=0000000] <LockCamera>: Sorry for the camera switch spam, but this is the only reliable way to list camera states other than hardcoding them
[f=0000000] Switching to Spring style camera
[f=0000000] dist: 8764.962891, dir: -0.007812, pixelSize: 0.000000, scrollSpeed: 14.195764, fov: 1.000000
[f=0000000] Switching to Free style camera
[f=0000000] Switching to Rotatable overhead camera
[f=0000000] Switching to Overhead (TA) style camera
[f=0000000] Switching to FPS style camera
[f=0000000] Switching to Overview style camera

cam was switched to "overview".

and later:
[f=0000000] Loading widget from mod: Camera Remember <camera_remember_mode.lua> ...
[f=0000000] Switching to Spring style camera
[f=0000000] dist: 8764.962891, dir: -0.007812, pixelSize: 0.000000, scrollSpeed: 14.195764, fov: 1.000000

that widget switches camera back to "Spring"
=====================================================
I disabled widget - and now camera is staying in "overview" mode.

OK, let's say that this situation is too complex to analyze. Let's take a look at tech annihilation instead:
https://www.dropbox.com/s/s3bpmki8kk5jvd7/infolog.txt?dl=0

hm... actually the same situation! It switches to overview then to "spring" cam. By different widget - but the same effect!

So bug is reproducible when you switch from overview to spring cam at the beginning of the game

~0015464

abma (administrator)

why is non-default CamMode = 5 set?

~0015465

abma (administrator)

i guess setting the mode via lua is broken. updating the camera mode in config file possible already fixes the problem:

i.e. Spring.SetConfigInt("CamMode", 2)

~0015466

jamerlan (reporter)

When I switch ingame to other cam and back I still have CamMode = 5 but spring cam working fine:

LOG("dist: %f, dir: %f, pixelSize: %f, scrollSpeed: %f, fov: %f, camMode: %d", dist, dir, pixelSize, scrollSpeed, fov, configHandler->GetInt("CamMode"));

this still prints 5 for CamMode

~0015467

abma (administrator)

> This bug is reproducible with BA 9.27 and Tech Annihilation 2.38.5

no, i can't reproduce it. please provide details how to reproduce it.

~0015468

jamerlan (reporter)

abma, fedora linux 23, windowed mode (take a look at the video) https://youtu.be/nmyJgzXMJII

also, to confirm that issue is not only on my side:
[23:07:40] <[bling]nix> Yeah had quite a few ppl with that issue

~0015469

jamerlan (reporter)

I have a guess: probably when spring is started - I have "Alt" mode enabled. Like I was pressing ALT. This is another bug I often have in spring (and other people ofc)

~0015470

jamerlan (reporter)

nah, my guess was wrong. This: LOG("Alt state is: %d", KeyInput::GetKeyModState(KMOD_ALT));
prints: "Alt state is: 0"

~0015471

jamerlan (reporter)

ok, now I placed another LOG here: https://github.com/spring/spring/blob/develop/rts/Game/Camera/SpringController.cpp#L119
LOG("newDist: %f, wantedCamPos: (%f, %f, %f), dir: (%f, %f, %f)", newDist, wantedCamPos.x, wantedCamPos.y, wantedCamPos.z, dir.x, dir.y, dir.z);

and it prints:
[f=0000000] newDist: -1.000000, wantedCamPos: (6115.324219, 10753.990234, 4964.636230), dir: (0.000000, -0.894004, -0.448059)
[f=0000000] newDist: -1.000000, wantedCamPos: (5037.151367, 5976.354980, 2452.202148), dir: (0.000000, -0.894004, -0.448059)

so this "if" block not executed: https://github.com/spring/spring/blob/develop/rts/Game/Camera/SpringController.cpp#L119
and camera not moved

~0015472

jamerlan (reporter)

I guess this check: "if (newDist > 0.0f) {" is wrong or not required. I just commented-out it and now my issue is gone. Please review this check - which issue it solves?

~0015473

abma (administrator)

> abma, fedora linux 23, windowed mode (take a look at the video) https://youtu.be/nmyJgzXMJII

this doesn't help in reproducing it... still can't reproduce it.

can you paste your ba config file please? (BA.lua i guess)

~0015474

jamerlan (reporter)

abma, https://www.dropbox.com/s/s923ow3m3r223fn/BA.lua?dl=0

~0015475

jamerlan (reporter)

[20:48:31] <[LCC]jK> I TOLD YOU IT IS NOT SPRINGCAMS FAULT
[20:48:56] <[LCC]jK> IT IS THE FUCKING BA WIDGET THAT SETS/SAVES A FUCKING CAMERA THAT IS NOT MEANT TO START WITH

=> game devs should workaround this. I dont agree with this but I am not engine dev... so I will work-around: http://imolarpg.dyndns.org/trac/balatest/changeset/4657

~0015486

abma (administrator)

Last edited: 2016-01-12 02:11

View 2 revisions

shouldn't GetCameraState AND SetCameraState contain the type of camera?

and if it missmatches the engine throw an error?!

(or switch to the correct camera)

~0015490

hokomoko (developer)

The state contains the camera type and switches if needed.
No issue there.

~0015491

hokomoko (developer)

The code which caused the issue is the following lua code:

local camState = Spring.GetCameraState()
camState.name = camName
camState.mode = GetModeFromName(camName)
Spring.SetCameraState(camState, 0)

Transferring an entire state from one camera mode to another isn't supposed to work.

An example of supported code:
Spring.SetCameraState({name = camName, mode = GetModeFromName(camName)} , 0)

Another example of supported code:
local oldState = Spring.GetCameraState()
Spring.SetCameraState({name = newCamName, mode = GetModeFromName(newCamName)} , 0)
-- do whatever
Spring.SetCameraState(oldState)

~0015492

abma (administrator)

did someone transfer this info to the wiki?

https://springrts.com/wiki/Lua_UnsyncedCtrl#Camera

i don't see it there, so imo its not solved

~0015493

hokomoko (developer)

Check now

~0015495

abma (administrator)

ty!
+Notes

-Issue History
Date Modified Username Field Change
2016-01-08 16:35 jamerlan New Issue
2016-01-08 16:35 jamerlan File Added: infolog.txt
2016-01-08 17:15 jamerlan Note Added: 0015459
2016-01-09 18:47 abma Note Added: 0015461
2016-01-09 18:53 abma Note Added: 0015462
2016-01-09 18:57 abma Status new => feedback
2016-01-09 19:20 jamerlan Note Added: 0015463
2016-01-09 19:20 jamerlan Status feedback => new
2016-01-09 19:23 abma Note Added: 0015464
2016-01-09 19:31 abma Note Added: 0015465
2016-01-09 21:22 jamerlan Note Added: 0015466
2016-01-09 21:58 abma Note Added: 0015467
2016-01-09 22:10 jamerlan Note Added: 0015468
2016-01-09 22:28 jamerlan Note Added: 0015469
2016-01-09 22:32 jamerlan Note Added: 0015470
2016-01-09 22:56 jamerlan Note Added: 0015471
2016-01-09 23:00 jamerlan Note Added: 0015472
2016-01-10 15:17 abma Note Added: 0015473
2016-01-10 17:22 jamerlan Note Added: 0015474
2016-01-10 20:07 jamerlan Note Added: 0015475
2016-01-12 02:09 abma Note Added: 0015486
2016-01-12 02:11 abma Note Edited: 0015486 View Revisions
2016-01-12 18:39 hokomoko Note Added: 0015490
2016-01-12 18:48 hokomoko Note Added: 0015491
2016-01-12 18:48 hokomoko Status new => closed
2016-01-12 18:48 hokomoko Assigned To => hokomoko
2016-01-12 18:48 hokomoko Resolution open => no change required
2016-01-12 18:54 abma Note Added: 0015492
2016-01-12 18:54 abma Status closed => new
2016-01-12 19:08 hokomoko Note Added: 0015493
2016-01-12 19:08 hokomoko Status new => closed
2016-01-12 19:37 abma Note Added: 0015495
+Issue History