Lots of button switches and one CB and USB plug

Last year I coded a script that worked about 20 push buttons and some rotary encoders. I had wired each device to a pin, etc.

My question is how do companies wire up a lot of buttons and only have what looks like a small simple circuit board with a USB plug to plug into my PC and have their device work? When I built my project I used a breadboard and had a lot of wires.

Specifically I have a pilot stick controller (commercial product) with about 12 buttons on it and I use it when I fly my desktop flight simulator. In addition to the stick movement (fore, after, left, right, and twist) there are about 12 push buttons that I can configure inside flight simulator to do specific things. How do they cram all that capability onto a circuit board?

Some type of serial communication works quite well for your application.

Paul