Listen to the topic for a while (find other players waiting for people to join)
If the system finds a player
Send a message to the server ("server" being the person who created a new "room"; you'll know if you were the server owner if you spawned in on the left side) indicating that a player is joining
Both computers agree to meet each other at a specific time (the black screen; your computer is waiting to start at the time specified)
If one of the players does not connect in time (usually a severe error and one of the players has to quit, or a hacker was detected and kicked from the game) then the other player will move back into the matchmaking phase
If no players were found
Create a new "server" (can be joined when another player is at the "listening" phase)
Wait for other players to join
If people still do not join, start a game with a bot
If the game starts but the game keeps erroring out (usually a hacker, on normal circumstances you'll usually only get one when you first start the game, I don't know why)
Spawn a bot
I plan to make it so that if you can beat the bot its aim will slowly get worse and worse.
Also, when you are in a match this is what's happening behind the curtains:
When the game starts, both players send "packets" indicating their position, mouse position, etc.
When you receive a packet, some variables are updated on the enemy's velocity and gravity. The game will predict where the player is while it waits for the next packet (usually around every 0.3 seconds a new one is received). That's why if you are playing with a real player, you'll occasionally see people fall off edges and magically teleport back to the top of the edge.