what role does the gpu cpu and RAM do in gaming?

Solution
The RAM has to do with overall system performance. If you have an integrated GPU on the MOBO, or imbedded in the CPU (how most iGPU's are today) then the RAM will also drastically affect the gaming performance of the system. The CPU is what processes everything happening on the computer and in a game. The more process intensive a games is, the more it is going to rely on the CPU. Also the CPU is a big factor in multi-player gaming. The GPU is very important for gaming, but without a solid CPU and RAM to back it up, the system will bog and bottle neck.

Still, the CPU should not be the most expensive part in a gaming machine. Usually a lower end i5 will be plenty for the majority of games. Hardly if ever will a system run much better...
The RAM has to do with overall system performance. If you have an integrated GPU on the MOBO, or imbedded in the CPU (how most iGPU's are today) then the RAM will also drastically affect the gaming performance of the system. The CPU is what processes everything happening on the computer and in a game. The more process intensive a games is, the more it is going to rely on the CPU. Also the CPU is a big factor in multi-player gaming. The GPU is very important for gaming, but without a solid CPU and RAM to back it up, the system will bog and bottle neck.

Still, the CPU should not be the most expensive part in a gaming machine. Usually a lower end i5 will be plenty for the majority of games. Hardly if ever will a system run much better with an i7. The RAM for the entire system, as long as it is running at 1600, you're fine. Faster RAM will help the system overall, but not necessarily in gaming. The speed of the RAM in the GPU is much more important.
 
Solution
RAM is the least important, provided you have at least 8 GB of DDR3 1600mhz for modern games. RAM is like a highway, determining if you can have 2 lanes, 4 lanes, or more of "cars" (data volume) going to and from other parts of your PC (such as GPU and CPU).

From there, some games are more CPU dependent, others are more GPU dependent. Historically, most games cannot maximize more than 2 cores during games, but there are exceptions to that rule. The reason I mention it is because it's more important to have a quad core CPU with faster cores, than it is to have a CPU with 8 cores with slower cores. It is a misconception that more cores = better.

Provided your PC is not bottlenecked by your CPU, your GPU is the single most important part in your PC for gaming. This is usually the most expensive part in your gaming PC, and for good reason.

In summary, your PC will be only as fast as the slowest part in your PC. My minimum recommendations currently are:

8gb DDR3 1600mhz
i5 CPU, preferably one around 3.4 GHZ or more. If you are into overclocking you can get to 4.0 ghz or more easily with a decent cooler.
Depending on your screen resolution and games you play, a graphics card good enough for your needs. The GTX 970 is a good buy right now as you can max almost all modern games on 1080p. If you are running high resolution (4k) or multiple monitors, you may want to consider a GTX 980, or a sli configuration of some fashion. On the mid/lower end, the radeon R9 280 and R9 290 are great buys right now and run more than fast enough for most games.