So a switch alone, would not be able to let both computers get on the internet and play game onlines. It only can connect 2 computers together to play games like locally between the two?

So a router would be what i want , correct? Cuz my friend and I would like to both be able to surf the internet, and we like to play a game called Call Of Duty , and want to be able to play online with others, instead of just having matches between the two of us.

Switch: Passes traffic from one physical port to another on the same network simply by looking at the address that the traffic is destined for.

Router: Passes traffic from one network to another. For instance, your ISP's network to your internal network. Routers generally ( but do not always ) have services such as DHCP and NAT which allow the router to manage the entire network autonomously without the need for the user to configure IP addresses and address translation.

In order to connect two or more devices to a single modem, you will need a router capable of both DHCP and NAT (all home routers have this capability and is enabled by default, so no need to worry).

Switches are good for connecting more devices to the network than your router has room for. You can use a single port on your router, plug that into the switch, and connect up to 23 devices with that single port, assuming you have a 24 port switch.