Giter Site home page Giter Site logo

tlbe's Introduction

Timelapse Base Edition (TLBE)

Mod for Factorio that takes screenshots of your base at specified intervals.

Features:

  • Multiple camera support, each taking their own screenshots.
  • Trackers to tell the camera(s) where to look at
    • Follow player until the first entity is built.
    • Follow base growth, keeping focus on specified area/city block or recenter automatically.
    • And finally follow the rocket launch.
  • Camera use (ordered) tracker list, first enabled tracker is used.
  • Camera gradually (configurable period) recenters and zooms out, which can be recorded in a stop-motion fashion.
  • Each camera has customizable resolution, frame rate and speed gain, and show their recording area on the map.
  • All screenshots are taken with full daylight or follow day cycle, and optionally show entity information.
  • Configurable screenshot folder (e.g. to support multiple save files that are played in parallel).
  • Configurable screenshot numbering, either sequential (default, more suitable for Windows ffmpeg) or game tick (easier to synchronize multiple cameras).

Open the TLBE settings from shortcut bar or CTRL-T (default key binding) to configure your camera(s) and trackers.

Screenshots are stored in the script-output folder, with the configured sub-directory ('Save location' setting in the Mod Settings menu).

Check demo movie on Youtube

youtube

tlbe's People

Contributors

adix-null avatar drdozer avatar fortysixandtwo avatar jeison-souza avatar veger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tlbe's Issues

Feature Request: Zoomed-Out Map View Option

This mod is great! I would like to request the feature of being able to check a box and the zoomed-out map view is used instead of the normal game view. It would work normally but use the view that you get on the map if you zoom out enough. This would improve performance and make larger factories more viewable (and easier to understand). It would be great if I could just check a box to change the screenshot type to this view when my base gets too big for the regular view. Thanks!

Ignore building cars for bounding box calculation

Hey,

first of all thanks for your mod. It looks really nice and I'm amazed by the possibilities (different kinds of trackers for the camera).

The problem I encountered is that the "viewport" of the camera shows a lot of non base stuff as can be seen
00000861-basecam
After looking through the code and talking with one of the players I believe the issue is due to the player building/placing his/her car far from the base while on an exploration run.

If I understand the code correctly (I don't know Lua at all) the bounding box for the
base is recalculated in https://github.com/veger/TLBE/blob/master/scripts/main.lua#L77 with the updating
done in https://github.com/veger/TLBE/blob/master/scripts/main.lua#L99

The function Main.entity_built is a callback function registered in https://github.com/veger/TLBE/blob/master/control.lua#L58
I suggest (I can probably come up with a Pull Request) to ignore any kind of player drivable vehicle in this callback.

Do you think it would be enough to "fix" the base size if I destroyed the cars/drove them closer to base and hit "recalculate base size"?

Or would I need to use the area tracker for my camera?

Thanks in advance!

Support other surfaces

Only default/ground surface is supported at the moment, but I guess it would be nice to (somehow) support other surfaces, so it becomes easier to make a timelapse of, for example, Factorissimo or Space Exploration games.

Although I have no idea how to timelapse such a game... Or any game with multiple surfaces (split view video?? ๐Ÿค” )
So maybe this is not a very good/needed enhancement...

Some ideas how to do this:

Have camera 'follow' player on the active surface

How work 'area' tracker and rocket tracker work?!
Bare tracker would need to keep track of base sizes on each surface.

Make surface camera(s)

Each camera can track a single surface and player as to set up multiple camera.
But lots of camera will generate boring screenshot as such a surface is not changing (and slow down the game due taken multiple screenshots)

Shortcut for pause/resume camera

Suggested on mod portal:

Would it be possible to add a keyboard shortcut for pausing/resuming the currently selected camera, without having to go through the GUI?

Pausing avoids making lots of identical screenshots at larger base sizes when I'm tinkering in a small area that is barely even visible, but doing it manually gets tedious and prone to mistakes.

Reset tracker information

For example an outpost (base) tracker needs to be reset for each outpost, so it can track a new outpost again.

Support screenshot folders

The trick of usign a / (or \) in the camera name does not work, as the screenshot numbers are added to the full name, cause multiple folder with one screenshot in it being created.

video tutorial

Once the various new features are added, would it be a good idea to make a tutorial video or video series showing how to use these features? Happy to contribute. The next release may be a significant upgrade but with a learning curve.

Pausing camera does not stop the 'transition time'

Report from point 2 of #37

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.

Most probably cause (from #37 (comment))

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!

Adding Interval to timelapse setting

Currently, configuring the timelapse feature involves adjusting both FPS and Gain, which the whole gain thing can be confusing, particularly when determining the required gain for a specific interval.

To simplify this process and enhance clarity, I have a suggestion of implementing three fields: FPS, Interval (between shots), and Gain.
Users would input any two of these values, with the third being automatically calculated.

This approach accommodates users who prefer setting the gain directly while also allowing others to specify the interval between shots. By streamlining configuration to just inputting FPS and the time interval between shots, the mod becomes more user-friendly and accessible.

New tracker: Area tracker

It tracks a specified area without changing/updating its size.

  • use player position to specify an area corner
  • using (map) markers the area could be specified as well

Add a city-block tracker

From https://mods.factorio.com/mod/TLBE/discussion/6498a5ed070072bbaa7d044c#post-2

other options for setting the camera target location - the one I frequently need is to center on the chunk the player is in, plus a half chunk around it, but I guess this can be a "center on player with radius x" with a "chunk-aligned" toggle; this happens when doing city block designs, where you want the camera to always be city-block-aligned

Basically you want to have some sort of a grid based camera positioning, where the city block area is the grid size? Or you see other use-cases where the player is the real/actual center of a (chunk) aligned tracker? (I guess it will be fairly easy to add some 'chunk align' or 'city block' tracker to implement this.

For this we'dthe following config in the tracker:

  • grid size
  • grid offset (no-one will have the first block in 0,0 on the map ๐Ÿ˜› )
  • current block that should be zoomed on
  • maybe (minimum) amount of blocks that should be zoomed on (to be able to zoom out on a bigger part of the factory)

Possible Improvements

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.

Remove notifications

Getting notified about each and every screenshot taken is annoying and does not add any value. (it would be easy enough to open the save folder and see the screenshots coming in)

Instead add a single notification that taking screenshots started (when it gets enabled)

Option to disable smooth movement/zoom

For certain situations the smooth movement of the camera is not desired.
For example

  • Follow player (currently it is solved in a hack-ish way)
  • Jump to rocket launch can be a matter of preference.

So it would be good to have this option available for each tracker, so depending on the active tracker it is enabled/disabled for the camera.

Speed up transitions

From https://mods.factorio.com/mod/TLBE/discussion/6498a5ed070072bbaa7d044c#post-2

pan/zoom speed and capture rate configurable separately from the static capture rate, so for example, we can have a 1 h : 5 sec capture rate, but when panning set it to 1:1; also set the pan speed by video time e.g. pan so that it produces 5 seconds of video

So it won't take hours before the camera is transitions (missing out on the action on the new spot or the builder needing to wait until the camera is present)

capture box enhancements

For once the basic functionality has been implemented and tested in the wild perhaps.

Does either the target box or the capture box need to be labelled with the camera name? It would be relatively simple to add a name anchored to the center point.

  • pro: visual reminder of what box goes with which camera
  • con: requires a crosshairs or dot or entirely blank icon to avoid getting a default map pin
  • con: extra text may be more visual clutter

When should the camera name be rendered?

  • always
  • never
  • user-toggled
  • only when there is more than 1 camera

Do multiple cameras need multiple colors, instead of label?

  • pro: less clutter
  • con: need a UX to select color
  • con: need yet more tinted icons, cluttering the signals tag

Suggestion: Scaling Timelapse

Considering the 8-hour demo took 36GB worth of screenshots, a 180-hour run would require its own hard drive with the current technique. To get around this, I suggest adding an options to take screenshots A) every X structures placed (selectable minor structures--e.g. belts/rails/inserters/etc.--and major structures--e.g. refineries/assemblers/storage tanks/etc.) and/or B) every time the total number of structures (minor and/or major) increases by X%. The latter would have more screenshots taken at the very beginning when each structure is a larger percentage of the total and relatively few near the end. When compiled, this would naturally make the video speed up over time until it freezes with the rocket launch. (...and the camera REALLY should follow the rocket until it disappears!) This would make for a video that gets more and more exciting the longer it goes while minimizing the needed frame storage space.

Also, I would add an option to darken the area in the current frame that is identical to the previous one--barring belts/inserters/etc.--to highlight changes between the two.

Does that sound reasonable?

Improve numeric textfields

Provide a popup (like train schedule uses), containing a textfield and a slider.

This way it is possible to validate the input and keep them within their ranges in a more intuitive way..

Sequential Numbering

From mod portal:

Would it be possible to implement a sequential numbering scheme for the output images ? The current one doesn't play nice with making the images into a video with FFMPEG on Windows (It need contiguous numbers to work properly on non-Unix systems for this purpose)

Resolution doesn't effect zoomlevel. Possible Bug.

If I change the resolution of the screenshots to 2x the resultion (4096x2160), the viewing distange of the shot becomes 2x larger and the zoomlevel stay constant.

This means the factory is effectfly 2x smaller on the picture, but same level of details.

Here are two consequative frames (scaled down for github).
where inbetween the resolution was changed.

The zoom level does not reduces after playing for longer.
00000204-main
00000205-main

PS: Thank you for this great mod.

Recalculating base size only considers Nauvis

Main.get_base_bbox() picks the default/first surface:

local entities = game.surfaces[1].find_entities_filtered { force = "player" }

It should use the selected camera surface instead

crash - missing camera transitionPeriod

With pymods installed and others, on adding DeadlocksStackingForPyanadon, but loading a vanilla map, although that's likely incidental:

  61.642 Applying migration: Time Lapse Base Edition: tlbe-0.2.1.lua
  61.642 Applying migration: Time Lapse Base Edition: tlbe-1.0.0.lua
  61.642 Applying migration: Time Lapse Base Edition: tlbe.1.1.1.lua
  61.643 Applying migration: Time Lapse Base Edition: tlbe.1.2.0.lua
  61.643 Applying migration: Time Lapse Base Edition: tlbe.1.3.1.lua
  61.643 Applying migration: Time Lapse Base Edition: tlbe.1.4.2.lua
  61.643 Applying migration: Time Lapse Base Edition: tlbe.1.4.3.lua
  61.643 Applying migration: Time Lapse Base Edition: tlbe.1.4.4.lua
  61.643 Applying migration: Time Lapse Base Edition: tlbe.1.4.5.lua
  62.651 Error AppManagerStates.cpp:1662: Error while applying migration: Time Lapse Base Edition: tlbe.1.4.5.lua

__TLBE__/scripts/camera.lua:104: attempt to perform arithmetic on field 'transitionPeriod' (a nil value)
stack traceback:
	__TLBE__/scripts/camera.lua:104: in function 'updateConfig'
	__TLBE__/migrations/tlbe.1.4.5.lua:55: in main chunk

I haven't looked at the code yet -- I'm betting it is some inconsistency in the behaviour of the green box tracking to the white one.

Possible to use TLBE for a replay?

Factorio does have the "enable replay" tickbox when starting a new game which will supposedly save everything that ever happened inside the savegame.

Now I wonder if it would be possible to use/setup TLBE while watching a replay.
When watching a replay I noticed that everything seems to happen exactly as it did in the original game
including which menus were opened at which time (inventory, production menus, etc).

Any idea if this would be possible at all?
I see two problems:

  • Does the replay even load if you didn't play that savegame with TLBE enabled?
  • If all the menu interactions are also replayed, how can you possibly setup TLBE?

It would be pretty cool if it were possible as you could easily make some taxing recordings (high resolution, multiple cameras, higher framerate) while running the replay in offline mode - possibly scripted?

Blacklist for base tracker

From https://mods.factorio.com/mod/TLBE/discussion/6498a5ed070072bbaa7d044c:

ask the "whole base" tracker to ignore turrets - it's quite common early game to go way out into the wilds with some turrets to clear bugs, but at the moment this causes the base tracker to zoom out to include those turrets, which has killed several of my attempts at timelapses

Basically add a blacklist, letting the user to select the buildings that should be ignored by the tracker

Pause/enable/disable buttons are misleading

In UIs, buttons usually are labeled with what they do, e.g. a pause label when something is playing and can be paused, a play label when something is paused and can be activated. Instead, in TLBE, the enable/disable buttons for cameras and trackers, as well as the "pause game when this window is open" button, are labeled with the current state, i.e. exactly reversed.

The Factorio GUI library has Items that I think are better suited for "enable/disable" controls. I would suggest a switch with "allow_none_state" set to False.

Taking screenshots causes FPS/UPS to halve per screenshot

I tried using this mod to create a timelapse of my base, but every time the mod takes a screenshot (default settings), the game freezes and I see the FPS/UPS halve.

I can launch nukes without the game lagging..so I don't understand why the performance drops. I have an SSD and a dedicated GPU with 2GB of VRAM which should be enough for 1080p screenshots

Testing with ridiculous screenshot sizes

more or less the title
I'm a madman, so when I looked at individual images and saw a pixelated blob when zoomed in, I was annoyed. I'd upload images but they've been deleted. For reference, they were made at 1440p. Keep in mind that the screenshots all have very little difference (no new chunks were explored/visited, I only built some stuff)

The small issue I have with this: anything larger than 4k is not taken properly. When I went to 8k, I played for five minutes, yet in the timelapse folder there were only two 8k images. I'll blame this on VRAM...I only have two and my SSD is fast enough for this.

ok so the game crashed with 16k images and the game at max settings, since I only have 2GB of it
image

4k Image:
(when I find out how to insert 21mb images I'll post it)

8k Image:
(when I find out how to insert 84mb images I'll post it)

16k Image:
(when I find out how to insert 330mb images I'll post it)

Yafc fork

I'm very sorry to contact oyu through here,

but your modified version of YAFC is throwing this error.
It seems something is reffering to your folder structure on your HD?

Annotation 2022-01-26 131442

Enable camera (taking screenshots) by default

It might be less confusing if the camera takes screenshots by default.
Additionally, a (map) settings can be added to disable this default state if someone for some reason does not want the camera to be enabled by default (e.g. when changes to the camera/trackers are required before taking screenshots)

Error While Changing Camera Settings

I get the following error pointing to a nil value on transitionSpeedGain when changing almost any setting on the Camera tab. When I try to change Transition Speed Gain itself, it will point to a nil transitionPeriod. If I try to recalculate camera settings, it points to a nil transitionTicks.

All of these fields have values, and there doesn't appear to be anything obvious on the GUI to reset or otherwise the internal state of these values. I know that I started this save on a previous versions of TLBE, and the settings got migrated for the 1.5.0 update, not sure if that could be the culprit?

The mod Time Lapse Base Edition (1.5.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event TLBE::on_gui_text_changed (ID 2)
__TLBE__/scripts/camera.lua:103: attempt to perform arithmetic on field 'transitionSpeedGain' (a nil value)
stack traceback:
	__TLBE__/scripts/camera.lua:103: in function 'updateConfig'
	__TLBE__/scripts/camera.lua:304: in function 'setFrameRate'
	__TLBE__/scripts/gui.lua:556: in function <__TLBE__/scripts/gui.lua:511>

Crashes on 0.18

Error while running event TLBE::on_tick (ID 0)
TLBE/scripts/main.lua:11: attempt to index local 'playerSettings' (a nil value)
stack traceback:
TLBE/scripts/main.lua:11: in function <TLBE/scripts/main.lua:8>

Button to take a screenshot

Requested in #37:

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.

Fix width of tracker tab

Because the widest label on this tab is less wide than the widest label on the camera tab, the width of the tab/content is also less wide.
This results in a 'huge' gap between the tab/content and the right side of the window.
It is especially apparent when clicked back and forth between the camera and tracker tabs.

Adding some vertically_stretchable all over the place only partly fixes the issue.

Is it possible to write to an external drive?

I may be acquiring a 1TB SSD in the future, and I would like to be able to write screenshots to the SSD when it's plugged in or if it's not plugged in, write them to the normal folder.

Is it possible to tell the mod to write screenshots to a designated spot on the external SSD? I'd transfer manually but my laptop only has USB 2.0...so 57 mb/s is quite slow to do via manual transfer. If I write directly to the SSD, will the images properly save? (I don't want any incomplete files)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.