veger / TLBE

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

Ignore building cars for bounding box calculation #22

Closed fortysixandtwo closed 3 years ago

fortysixandtwo commented 3 years ago

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!

veger commented 3 years ago

Thanks you for your thorough report. I think you could be on the right track. TLBE does not check what got build, I never thought of this use-case... :wink: So 'building' a car or some other vehicle outside of the current 'base area' will definitely influence the tracked area.

'Recalculate base size' should solve this (if the car is 'inside' the base area) as it checks all entities again in order determine the total base size.

For a permanent solution, it seems to make sense if we could indeed check what type of entity got build and if it should count as part of the base. So ignoring vehicles seems nice, but I also wonder if combat robotic influence this... (and maybe other entities as well??)

fortysixandtwo commented 3 years ago

See #23 :)

Haven't tested it yet though!

veger commented 3 years ago

I'll run a few quick tests soon :wink:

fortysixandtwo commented 3 years ago

I wanted to test drive this as well, but haven't yet found time to start up Factorio.

Also please note, that this is the first time I ever wrote Lua (pretty nice that Factorio ships the docs in doc-html/).

And what is up with 1-base arrays in Lua? :D

fortysixandtwo commented 3 years ago

I did some testing and while it's not exactly how i imagined it - still a few things on the screenshot I wouldn't have expected - it seems a bit better than before.

F.e. 00000872-basecam

Adding a car in the north: (viewport does not change) 00000873-basecam

Adding a turret in the north (viewport does change - it doesn't show the turret, but maybe thats because of aspect ratio of the screenshot or something)

Uploading 2 screenshots because I have smooth camera

00000874-basecam

00000875-basecam

fortysixandtwo commented 3 years ago

So it appears to be working, but please run some tests of your own ;)

veger commented 3 years ago

Thank you for your tests and screenshots!

TBH I would expect the first 2 screenshots zoomed in a little more, as the South and West seem empty the zoom level could be higher... :thinking:

I'll try and test this weekend when I have some time.

fortysixandtwo commented 3 years ago

I had a session today and it seems good enough (even if it the screenshots are not ideal yet). Not sure why the area in the west is included (or if this is a consequence of the 16:9 aspect ratio).

In case you're interested you may have a look at https://fortysixandtwo.eu/upload/basecam.mp4 (might not work in browser, but rightclick -> save and then playing with vlc do the trick - at least that's what my windows using friends had to do).

veger commented 3 years ago

When looking at the movie it looks like the height fits (almost? hard to see since it looks like you adjusted/recalculated the area?) perfectly, so I am pretty sure it is the 16:9 aspect ratio indeed.

veger commented 3 years ago

Fixed in v1.4.1