Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Game map progression animation #13032

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

lenzls
Copy link
Contributor

@lenzls lenzls commented Jan 2, 2024

The general idea is to create a video of the map progression throughout a game. Ideally, we see the progress of the pieces over the course of a game, for example a shifting frontline.

Current approach

The current approach is rather primitive and only semi-automated.
The MR adds another menu entry "Load series of files and create map animation" to the "tools" menu. If you click it, you need to select a folder containing all the vlog files of your game.

Then we'll automatically loop over those vlog files, iterate through every command in the logfile and take a map screenshot each time. At the very end of the process, the selected folder will contain a series of map screenshot, a screenshot for every command in every logfile.

After that, I'm (optionally) cropping the screenshots to the map section I'm interested in (for limited scenarios)

mogrify -format 'png' -crop 2173x1005+3543+938 +repage *-Map0.png

Note, I need to do that since Vassal's SnapshotTask currently takes x,y coordinates, but ignores them.

After that, I'm (optionally) watermarking the map screenshots with the name of the save game via

mogrify -format 'png' -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 26 -gravity NorthEast -annotate +10+10 %t *-Map0.png

As a last step, I'm combining all map screenshots into a video via

ffmpeg -f image2 -framerate 30 -pattern_type glob -i "*-Map0.png" output-30fps.webm

Know shortcomings

  • not fully integrated into the vassal java application (should/can it?)
  • lots of temporary image files. The first two turns of my current small scenario game of Last Blitzkrieg resulted in 2042 screenshots and over 60GB of image data. The PNG screenshots are huge. Note that the final encoded video is only 13 MB.
  • Currently I'm creating a screenshot for every command, even when it was just a text message. I should filter that somehow to only screenshot the actual piece movements

Questions

  • Can we somehow easier get a video stream than doing expensive map screenshots?
  • Can the ffmpeg part also be done in plain java?
  • External dependencies and everything aside, would this kind of functionality be interesting to include in the vassal application?

@riverwanderer
Copy link
Collaborator

Certainly interests me. Even as a standalone app. Built-in would make it easier for everyone to find.

@lenzls lenzls force-pushed the game-map-progression-animation branch from 3fd0c39 to 4c0abb2 Compare February 5, 2025 19:10
@lenzls
Copy link
Contributor Author

lenzls commented Feb 5, 2025

fyi: I just updated the code to newest master (luckily no conflicts whatsoever).

I still don't have a plan or idea how to tackle the key shortcomings mention in the PR description. The current state is definitely not ready to me merged.

Still, besides myself, another community member is also using my SNAPSHOT build to create videos from their game: https://www.youtube.com/playlist?list=PLfAJ-jit45UM_jxG-R7FbDCeSLVoIgbew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants