Not going to go into the hardware detail as too lazy to do that atm.
Basically what you need for the 2nd PC is really just a capture card and the software to use it.
What you do is on your gaming computer's GPU plug the HDMI out to a capture card's video input. HDMI or DVI with adapter (yes DVI, audio gets captured for certain cards). On your gaming computer, make sure to set the HDMI out to mirror the display, do not extend as that's kind of pointless.
On the capture computer set up OBS or whatever software you used to get the capture signal.
You can use remote desktop or just swap the displays around and use a KVM switch if you don't want to keep plugging the mouse / kb back and forth or having two sets.
Do beware, using Ryzen with an internal capture card will have a necessity for multiple PCI-E slots and expansion slots due to not having an integrated GPU. A low power graphics card would suffice. This means Mini ITX set ups aren't allowed if you use an internal.
https://solarisjapan.com/products/sc...-capture-board SC512 is considered one of the best capture cards but the price kind of reflects that.
Anyways, Elgato HD60 internal card is supposedly pretty good.