Making a server in draw()

I know that you can make servers in setup but I am wondering if you can make or initialize them in draw. I want to make a game that will connect me and my friends on a network. The thing is I want the user to choose if they are hosting or joining a game beforehand and then initializing a client or a server depending on the chosen option. I have tried putting server = new Server(this, port); in draw but it gives me:

The constructor Server(BomberMultiplayer.Game, int) is undefined

Also the server waits for a connection without calling the next draw() so I get a blank screen until it connects. I would like to show a “waiting” animation instead.

Nevermind. I have found the solution. I am using oscP5 now.

2 Likes