Repository navigation
Fire weapons from the barrel and record levels for YouTube - #3
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pyonly 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.pyrecords 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 temporaryoverride.cfgfor 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--recordingmode. 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.mdhas 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.gdpasses 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.gdpasses 994/994, andpytest tools/packagingpasses 3/3.test_level.gd./S /TESTMODEinstall of the 1.0.2 installer matched the built pack by hash. The installed game ran with exit 0, and the uninstaller cleaned up.The bot and tests are excluded from the exported packs, so the recording changes don't touch the shipped game.
Happy to adjust. -MB