veger / TLBE

TLBE - Time Lapse Base Edition
MIT License
9 stars 6 forks source link

Possible Improvements #37

Closed theotherbigfoot closed 11 months ago

theotherbigfoot commented 1 year ago

I have a lot of ideas here, to the point where I will probably need to come back and add to it because I've forgotten something. I'm not expecting anything. I can work with the mod you have already built no problem, I like it a lot. What you can or can't do or when is totally in your hands. I just struggle to do nothing if I feel like I have a good idea, youtube is useful for me in that respect. Here goes.

  1. A button that I can add to the toolbar that takes the next screenshot. I do a lot of timelapsing where I build in increments. So I set the frame rate high, build something, turn on the timelapse to take a single shot, and then build a bit more. It would be a lot easier if I could just hit a button in the toolbar to immediately take the next shot.
  2. When the camera is transitioning/panning/zooming there doesn't seem to be a way to pause it. You can pause the game but not the timelapse. If the timelapse is paused during a transition then it seems to skip taking the screenshots but the camera continues to move, which leads to missed frames. If I could control this via the same play/pause toolbar button that is already in the mod then that would be incredibly useful.
  3. If you could combine issues 1 and 2, so that I could have a button that takes the next screenshot whilst the camera is transitioning that would be really useful too.
  4. A button in the trackers tab that saves or saves and opens the screenshot that refers to that tracker. It would be really useful to be able to preview where the camera is moving to before starting a transition.
  5. How does the zoom work? It doesn't seem to be a linear progression from one set of co-ordinates to the next. It would be useful to be able to play around with this, maybe in a third options tab or something.
  6. This is a tricky one, I'm not 100% sure how to solve it, mathematically and algorithmically it doesn't have a simple solution. But the problem is this. If I am panning the camera from A to B without any zooming then the mod divides the total distance between A and B by the number of transitions that it has been programmed to take and moves the camera by that number of tiles each frame. But if the result of this isn't an integer then it is rounded up or down because it can only deal with whole tiles. The result is a transition that isn't smooth but seems to jagg around because it is moving a different number of tiles each frame. If the camera needs to move 2.5 tiles per frame, then one frame it will move 2 tiles, the next it will move 3. I have no idea how it can be achieved but it would be really useful if the mod could work out some absolute positions where the number of tiles it needs to move is matched with the number of frames that it needs to take to complete a transition. This doesn't seem to apply when the camera is zooming because the 'jagg' is masked in the zoom itself. Item 4 would be a useful thing to have in this regard. It would allow me to quickly review several alternative screenshot positions (if we are basing the next position of the camera on an absolute number of tiles then there will be limitations on the final co-ordinates that can be used) and select the one that I think works best. I am pretty handy in excel and VBA so I'm more than happy to start playing around with some possible algorithms if you think that will be useful.
  7. This is probably where I start to get into dreamland territory, It would be nice to be able to plan out a series of camera movements in advance. So, camera moves here, takes 30 frames while stationary, then moves here, takes another 30 frames etc. I would consider this a nice to have. I probably wouldn't use it very often, the other stuff on this list I would use all the time and would considerably reduce the amount of work required, this one isn't like that. But if we are talking about ideas then this is one to add to the list.

For the time being this is all that comes to mind. I know it's a lot. As I said, it is entirely up to you what you want to do with this list. Thank you for responding to my youtube comment and thank you for considering this. I am incredibly grateful.

veger commented 1 year ago

Thanks for the extensive list of issues and ideas!

  1. This is a nice feature to make manual timelapses yes and can work next to the existing features. I created #38 to track

  2. I cannot reproduce. When I trigger a transition I can pause the camera, all cameras or the game (by opening the config GUI with the pause enabled). And in all cases this is pausing the camera. Which is also supported by the code:

    So if you could give some steps on how to reproduce, it would be nice :)

  3. Should be the case when 1 is implemented and 2 is working properly/as expected

  4. I do not fully understand, you mean a button that (saves and) opens the screenshot in an external (to factorio) image viewer?

  5. When "smooth camera movement" is enabled, it is (should be) a linear progression from original camera position to requested position. Problem is that I do not keep/have the original position, so I need some maths to calculate the step for each screenshot by calculating the number of 'left over steps' and the 'left over distance' in order to get the step length. This is done here: https://github.com/veger/TLBE/blob/master/scripts/camera.lua#L124 I guess it is fairly readable, even if you ware not a programmer. If you find some issues with my math, please let me know :wink:

  6. I am not rounding down camera position, zoom factor, etc. Of course the values have some precision, but that should be negligible for this use-case. When a screenshot is taken, the values are not rounded as well and factorio (while having some precision) accepts partial tiles as well: take_screenshot function (follow MapPosition for details on precision) In the GUI is do round the values to full tiles, to keep things neat(er). I quickly confirmed by showing the unrounded position in the GUI, and it is indeed not rounded.

    So I do not know why the panning is jagged...? Can it be a framerate issue, screen refreshes at e.g. 60Hz and the movie does not match nicely, causing to skip frames once in a while? (Not a video editor/editing expert, so I am just wildly guessing now :) )

  7. It is a nice idea, and I have thought about it myself:

    1. It is not easy to implement (it is possible, not takes a lot of work)
    2. I do not see a use-case. It would only work if you fully plan the base before building it I guess (using blueprints?) and then build all in the 'correct pace'? Or maybe for an 'after movie' of an finished base? But for that you could use the area tracker and move from one area to the next? (it is a one time action/work while not playing the game I guess)

    So unless you have a very tempting use-case I doubt that I will implement this (as I want to play the game as well, and this would take a lot of my free-time to implement :wink:

theotherbigfoot commented 1 year ago
  1. Awesome
  2. This was something I tested a year or so ago when I made the last tutorial. I will test again and see what I can come up with.
  3. Awesome
  4. Say I set up a new tracker for a new camera position. The mod is still set on the previous camera position. I wanted a way of viewing the next camera position before I transition to it. If it saves it as the next shot in the timelapse that wouldn't be a problem, I can just delete it once I've viewed it. It doesn't even really need to open the image, I have a second monitor and I have the timelapse folder open at all times. Just a button to take a screenshot of the proposed co-ordinates without moving the camera formally.
  5. I didn't think I would be able to read it but I think I kinda can. I think the issue is that you are using the centre of the shot to move the image and I think I was expecting it to individually move each corner. If that is the case, it does kinda feel like it would be difficult to calculate. In fact, I'm almost certain it would be a complete pain in the ass.
  6. Oh, ok, I guess I just assumed something there. Maybe there is something else at play. Maybe it is nothing at all and all in my mind. Video editing also entirely possible. I'm no expert either.
  7. There was a moment in time when this thought occurred to me, in that moment I must have had a reason, but I can't for the life of me think of what it was right now. Your points are totally valid, it can be achieved other ways, it doesn't need to be a specific feature.
theotherbigfoot commented 1 year ago

Follow up on issue 2, nope still can't pause it. This is what I am trying to do. I have a set of co-ordinates for the current position and the proposed position. If I am able to pause the transition then I want to run it at a high frame rate so that I can capture a single screenshot at a time. 24 screenshots proposed to get from A to B, so I am going to run the transition at 12 frames a minute for two minutes. I start the transition to get the initial screenshot then immediately pause it. Wait a minute, unpause the timelapse to get a single screenshot again and the camera has moved a significant distance. Wait two minutes, unpause, get a single screenshot, and the camera seems to have moved about double the distance than what it did for a single minute.

Even though the timelapse is supposed to be paused, the camera is still moving in the background. The only thing the pause button seems to do during a transition is stop recording the shots.

veger commented 1 year ago

Oh... I see! (I guess)

It is because it calculates the step using the lastModifiedTick and game.tick. So when pausing a camera (for some time) the game ticks progress and become farther away from the lastModifiedTick. Causing a big(ger) jump than expected.

When I have some time, I'll try to reproduce again.

theotherbigfoot commented 1 year ago

Just to give you a sense of why this is so annoying, the alternative, if I can't pause it, is to run the transition at a single frame per minute for 24 minutes so that I can guarantee I can get all things I want to get done for that shot. I might have a single frame that takes a minute to create and that dictates the duration of every other frame in the transition. I have tried running this at 2 frames a minute but it can get really stressful at times, trying to squeeze everything in before the camera moves. The end result is a single transition that takes 24 minutes to make, produces less than a second of real footage and I spend half the time sitting waiting for the camera to tick over.

I really don't want to put pressure on you because you are basically doing this out of the goodness of your own heart and I don't want to push my luck, I am incredibly grateful for anything you can do with my list, but this issue is a big problem for me. Anything you can do would be amazing.

veger commented 1 year ago

I still cannot reproduce (I guess my tests are too short?), but I see a/the problem in the code.

The game ticks will pass when the camera is paused. And while the code calculates the step size using game ticks and start time of transition the step size will/should change because time 'disappeared', the transition should continue (although with the wrong step sizes). An additional issue is that when the transition time is passed, while the camera is paused, unpausing it won't finish the transition to the final location/scale!

So there are definitely things going on with respect to point 2.

theotherbigfoot commented 1 year ago

Correct. If the camera is paused while a transition completes then the camera is locked in the position it was when the timelapse was paused. It won't move to the final destination. I noticed this in one of my early videos.

Forgive me, I am a simpleton when it comes to coding, but isn't it just a case of creating our own custom tick timer that is linked to the game timer but stops ticking when the timelapse pause button is pushed? An independent timelapse tick timer? I genuinely don't know what I'm talking about though, if there is something technical that I'm not aware of (there will be) then just tell me and I'll stop trying to help.

veger commented 1 year ago

No worries about not being a (expert) coder, being interested is good :+1:

Yes, you generally need to make a custom timer to make transitions. The mod does this by marking the tick when the transition started and calculate the passed time. The advantage of this is that the code does not need to create additional timers, which reduces complexity (tracker only need to keep track of the latest change it had) and is more performant (no need to update some transition timer each tick for each camera).

Which is fine, unless you are able to pause the transitions... :scream: :wink: This is an oversight I had :smile: I will think of a system that has a transition timer for each camera, so they can be paused independently

drdozer commented 1 year ago

"Problem is that I do not keep/have the original position"

OK .. but is there a technical reason why we can't store the original position? Then the linear (or non-linear) interpolation becomes really quite easy. It also would feed into the box-drawing enhancement, as we can render the origin box, the destination box and the pan box in 3 different colors.

veger commented 1 year ago

I vaguely remember this was because trackers change (especially with the player tracker), cameras switch trackers. So keeping the original position is 'weird' as it changes over and over (especially when active building with the area tracker).

So when implementing the smooth transitions, it became more easy to use current state of the camera and the intended state and transition into it.

I forgot the exact reasons, and they even might be obsolete by now... In order to fix #43, I guess a redesign of the smooth transitions is going to be needed

veger commented 1 year ago

Now I remember: the idea of trackers is that they track something in-game like a player, buildings, a static area, etc. Camera on the other hand take screenshots or their current position, while using trackers to update (transition) their position.

So a camera is not notified that a tracker points to something new (as a tracker doesn't know if/when it is going to be used, and thus cannot inform camera(s)). Therefore, the camera checks when a tracker lastly noticed a change (and updated their 'position') and start a new transition form there on. This could even happen in the middle of another transition!

By moving the 'start transition' time to the camera, it would be possible to pause the transition (compared the game ticks) and (re)start new transitions. I guess it would even make it easier to have multiple (non-linear) transition types in the future.

veger commented 11 months ago

@theotherbigfoot I think all of your requests made it into v1.5.0 If you feel there is something that is missed, or you have new ideas feel free to open a new issue!

Thanks again for the wonderful ideas, the mod ha some great improvements in this version.

theotherbigfoot commented 11 months ago

Ahh dude, absolutely my pleasure. I have wanted these changes for so long, the fact that you have incorporated them into the mod is incredible.

Thank you