Here's an example of a simple 3D gun game implemented as a single HTML file with JavaScript:
This code sets up a canvas element that allows you to move a player around using the arrow keys. The player is represented by a square, and there is a gun attached to it. The gun rotates as the player rotates.
Note that this is just a basic example to demonstrate the movement and rotation. It does not include any game elements or interactions beyond moving the player and rotating the gun. You can further enhance the game by adding enemies, shooting mechanics, obstacles, and more.