Skip to content

Fire weapons from the barrel and record levels for YouTube - #3

Merged
MBemera merged 6 commits into
mainfrom
feature/barrel-shots-and-level-clips
Oct 4, 2026
Merged

MBemera merged 6 commits into
mainfrom
feature/barrel-shots-and-level-clips

Conversation

@MBemera

@MBemera MBemera commented Oct 4, 2026

Copy link
Copy Markdown
Owner

An old gameplay clip made the weapons look like props: the player ran past enemies holding a gun that never seemed to fire. Two things caused that. The recording route in record-yngm.py only followed waypoints with the camera tipped at the floor, so it never aimed at anyone. And the game drew its shots from the wrong place.

The hits themselves were fine. A headless check fired every weapon at a target 4 to 35 m away, and darts, the NDA Stapler and the railgun hit every time, with the others dropping off at their designed range. What was wrong was the drawing. Shots spawned from a fixed point 0.4 m in front of the camera, above and behind the gun's barrel. The rail and Disruptor beams started another 0.9 m out, so from the player's view they shrank to a stub. There was no visible muzzle flash, and a thrown grenade appeared at full size right in front of the camera while the held one stayed in hand.

Shots, beams and the flash now come from the actual barrel tip, found from the front of each gun model. If a wall or an enemy is closer than the barrel, the shot starts on the player's side of it. Each shot gets a short glow at the muzzle. The held grenade leaves your hand while one is in flight, and a thrown grenade starts at hand size and grows. Lightning stays anchored at both ends.

Three timers used the wall clock: the shared ranged-attack slot, the yell throttle and the result-screen delay. They now count physics frames. Play is unchanged, but recordings stay true to it.

record-yngm-levels.py records each level with Godot's Movie Maker at HIGH, 1920x1080 and a locked 60 fps. That keeps the video smooth on laptops that can't render HIGH at 60 fps live. It writes a temporary override.cfg for the window size, records Theora, because Godot's AVI writer breaks past 4 GB, and encodes YouTube-ready H.264. The encode converts Godot's BT.601 output to tagged BT.709, so YouTube keeps the colours. The autoplay bot also gets a --recording mode. It lets the story play and plays like a person: it reacts, aims with some wobble, dodges only some shots and walks while fighting, so it takes real damage and can lose. It gets better after each death, so a level always finishes. tools/recording/RECORDING-PROCESS.md has the details and the pitfalls. The version is bumped to 1.0.2.

I verified this on Windows 11 with Godot 4.7.2:

  • test_level.gd passes 169/169. The new tests fire the projectile weapons and check that each shot spawns at the front of the gun, check that rail and Disruptor beams start at the barrel, and hit a target 8-30 m away with every weapon except the grenade, which has its own tests. They also check the grenade leaves the hand and a point-blank shot into a wall starts on the player's side. The spawn and beam checks fail on the old code.
  • test_levels.gd passes 994/994, and pytest tools/packaging passes 3/3.
  • The rebuilt Windows, Linux and macOS packs each pass test_level.gd.
  • A silent /S /TESTMODE install of the 1.0.2 installer matched the built pack by hash. The installed game ran with exit 0, and the uninstaller cleaned up.
  • Movie Maker frames show each weapon firing from the barrel and connecting. Levels 1-6 were recorded with the new mode: each won on the first attempt after taking 5-10 hits.
  • Headless bot trials win levels 10 and 11 within three attempts.

The bot and tests are excluded from the exported packs, so the recording changes don't touch the shipped game.

Happy to adjust. -MB

Shots, beams and the muzzle flash now start at the held gun's barrel tip instead of a fixed point near the camera. Rail and Disruptor beams no longer start 0.9 m out, where they read as a stub. A short glow marks each shot, the held grenade leaves the hand while one is in flight, and a thrown grenade starts at hand size. A shot fired into a wall or enemy at point blank starts on the player's side.
The shared ranged-attack slot, the yell throttle and the result-screen input delay used the wall clock. They now count physics frames, so they behave the same in Movie Maker recordings and when the game runs slowly.
record-yngm-levels.py renders each level with Godot Movie Maker at HIGH, 1920x1080 and 60 fps, then encodes YouTube-ready H.264/AAC clips. The autoplay bot gains a recording mode that plays like a person: it watches the story, reacts and aims with some wobble, dodges only some shots, takes damage and can lose, and improves after each death.
The barrel test now fires each projectile weapon and checks where the shot spawns, not just the muzzle getter. The bot starts dodging a shot 0.25 s after it appears instead of ignoring its last 0.25 s, and counts damage from the runway signals so the final hit is included. Clips and the joined video are written to a .partial.mp4 file and renamed when complete, so an interrupted encode is redone and a re-join replaces the old file.
The project setting still said 1.0.1, so the exported packs carried the old version. The packages are rebuilt and dist/build-result.json has the new hashes.
@MBemera
MBemera merged commit 5cfc22d into main Oct 4, 2026
2 checks passed
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.

1 participant