'how to upload server project
I have created a Chess game with special rules that I want to use for an event in my discord server.
for this I have programed the chess game in Java (the main languge that I know) and I also added a client and a server that can communicate between them and update the board.
now since I want it to use it for an event I need to let a few people to join and play at same time (around 10-16 people) so basically i need 5-8 boards (maybe each 2 connect do different ports?).
I am not sure how can I mange this I dont mind paying for some server or cloud but I am not even sure if what i want is possiable and how I do this? I don't know even what to search on google in order to achive it.
I would really appricate if someone can gide me to what I need to look for. Thank you very much
Solution 1:[1]
Software design
maybe each 2 connect do different ports?
That depends on how your chess software is designed.
You can design it in a way that you only need a single server process, listening on a single port, like a webserver that is listening on port 443. Your server process would be able to accept the incoming connection requests of all of your 10 or 16 clients. In this case you would have to implement a way to assign client pairs, e.g. player 1 vs player 2, and player 3 vs player 4.
Another way would be to have one server process for each chess board, with each process listening on a different port. In that case you would have to assign the player pairs manually to a server process and port. That would be less user-friendly compared to the variant mentioned before. But it's easier to implement: the server assigns the first connected player to a random color, the second connected player gets the other color that is left, and every other connection requests are rejected.
I don't know even what to search on google in order to achive it.
You could google for simple multiplayer games written in Java. TicTacToe seems to be an easy example, like this one: https://math.hws.edu/javanotes/c12/s5.html
Running your own application on a rented server
Before paying for a server, you can test your scenario locally. Start the server process(es) and client processes on your home computer. If that works, then it should work with a rented server.
The application you described, apparently doesn't have any special requirements. So this should work on any cheap VPS for ~6$ per month.
Installing your own application on a server requires basically the same steps as for your home computer:
- Did you need to install a JRE to be able to run your application on your home computer? Then you need to install a JRE on your server as well.
- Are there any JARs required for your application to run on your home computer? Then you need to upload those JARs to your server as well.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
