0
\$\begingroup\$

Background

I'm a noob programmer looking to create a simple turn based mobile game as a side project. I've pretty much got the game logic down and am left with implementing the online multiplayer/PVP portion.

More specifically, i'm looking to implementing a system when the player clicks play and will be matched with an opponent in a 1 v 1 format, without any lobbies etc etc.

I'm currently trying to develop my game in android studio(i'm new) but am also open to unity if it makes the development easier.(I have no experience in Unity).

What i want to know

From what i understand,i need to create and host my own server for the multiplayer to run(i.e matching of player to opponent). Do i also need the server to run the game itself or am i able to connect the player to the opponent and simply record the result of the game to my server/database?

Also, how would i go about creating and running/hosting the server? I heard nodeJS is a good choice for writing the server.

End Goal

I just wanna publish my game onto the app store, IOS store, etc.

\$\endgroup\$
1
\$\begingroup\$

Do I also need the server to run the game itself?

Generally speaking, it's better if the application is running on the server itself as you can never truly trusts the users. Unfortunately for you, Android Studio is not the best tool to create a web server application. Thankfully, you did suggests an acceptable alternative later in your question: Node.js

However, this is a huge shift in development in which you will need to transfer the game logic to the server. The Android Studio application will only be used to handle the user's input and display the game. The server will be in charge of verifying what is being submitted and apply the game logic.

how would I go about creating and running/hosting the server?

Many options are available to you when it comes to hosting servers. AWS, Azure, Google Cloud platform or even Digital Ocean will do nicely. They also tend to have special promotions in which they give away free credits numbering in the hundreds to new accounts. Alternatively, you can host the server locally, but I do not recommend this options for self-described newbies.

Once you have purchased a server instance, you will need to install Nginx or Apache to handle incoming connections. Additionally, you will need an application that can transfer traffic generated by one user to another which can be done in Node.js as you initially suggested. You will also need to hardened your server against attack as once your game goes live, you will be advertising your server's address for all to see.

Finally, you might want to purchase a domain name and have it hosted on the server you build. Using Let's Encrypt, you can also have your traffic encrypted via SSL. This is not necessary, but it will improve the legitimacy of your game.

I heard nodeJS is a good choice for writing the server.

Indeed, I have use this solution in many projects in the early phases due to how easy it is to create a quick application that can handle incoming connections and distribute traffic. Initially, you will wish to research web sockets which will allow you to send and receive messages using one constant connection.

Obviously, your questions are very broad and each of the topics discussed above could be it's very own in-depth article. I encourage you to continue digging. It may seem overwhelming, but we were all there once. Good luck!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.