Advertisement

Backend for unity mobile game

Started by July 22, 2022 02:53 PM
2 comments, last by ARM1233 2 years, 3 months ago

Hi, I would like to create a simple match-3-like mobile game in Unity. The game will be using NFT and blockchain features. I also need a server for the game. I have experience with creating mobile apps and games, but I don’t know much about backend development for mobile games. My first thought was to create a custom server in Node.js. After a quick research, I realized that there are already a lot of different and developed server solutions for unity like Mirror or Photon.

My server has to have the following features:

  • be the authoritative server and run the whole logic of the game
  • access NFT, interact with smart contracts and send all required blockchain-related data to the client
  • supports PVP, PVE and co-op type of gameplay
  • supports a microservices architecture
  • allow for easy deployment scalability with services like AWS or Google
  • expose an APIs
  • ofc be secure and attack-proof
  • has all the features that a decent mobile game needs

As I said earlier I don’t have much experience with creating a backend for mobile games and I’m really confused about what solution should I pick. I am afraid that creating a custom server might be overkill but at the same time, I don’t know if the server solutions available for unity can handle all of my requirements.

I’m wondering:

  • What's the standard, a most common technology used for creating backends for the mobile games?
  • Is there any Unity backend solution like Mirror or Photon that supports all of the requirements that I mentioned above?
  • Is it common to have a mixed solution where the game uses Mirror or Photon strictly for running gameplay, and a custom server that e.g. interacts with smart contracts, exposes APIs, etc?

===============================================

I also post the same question on StackOverflow in case anyone would like to earn some points there:

https://stackoverflow.com/questions/73075249/backend-for-unity-mobile-game

Most of that leaves me feeling dirty as you seem to be looking at marketing and profiteering rather than creating games, but answering your questions directly:

ARM1233 said:
What's the standard, a most common technology used for creating backends for the mobile games?

The simplest method is to have an instance of the game that runs on a server, although it doesn't scale well.

The most common technology in little games is a large, single application that someone sets up and runs once, it doesn't do much of anything, and the game dies in obscurity.

The most common technologies in big games are large, autoscaling technologies hosted by Amazon, Google, Microsoft, and other companies that maintain servers for databases, servers for an interface layer, servers for all the little games which can be launched and torn down as needed.

ARM1233 said:
Is there any Unity backend solution like Mirror or Photon that supports all of the requirements that I mentioned above?

Mostly no to that list specifically.

There are many great frameworks out there. The frameworks typically provide communications frameworks around the concepts of user authentication, account management, matches, rooms/groups, chat, storage like player data, game data, and rankings data, and utility functionality. There are many of these to choose from. But those don't do your list.

Most of your list's requirements are things that your game needs to implement, and are not naturally responsibilities of server infrastructure. Having the server be authoritative isn't a function of a framework, that's entirely on your own use and implementation. Any type of PVP/PVE usage is up to you, you're the one deciding how to use the messages, there are plenty of libraries you can use to implement it. The security element is a perpetual battle that your own code is mostly responsible for. And the NFT parts are going to be all on you.

ARM1233 said:
Is it common to have a mixed solution where the game uses Mirror or Photon strictly for running gameplay, and a custom server that e.g. interacts with smart contracts, exposes APIs, etc?

Yes. Large games and commercial projects usually have many different servers, and gameplay is only one of many elements of functionality. Gameplay is often the most complex and least able to be abstracted away, as described in your last answer. Authentication, account management, leaderboard tables, and generic data storage and many other generic bits of functionality are easier to create in generic form, and so less necessary to customize. Your game code will still need to interact with all those features, and it will be your own responsibility to deal with that.

For example, the typically very first networking step of your client providing a username and password and calling Connect() will eventually either fail or succeed with returning an authentication token. The framework can provide the functionality since it is common. Proper authentication is a major task, and securing the typical 3-way authentication triangle is tricky to get right, but libraries do it well. Although the framework relies on them existing, you will need to provide security certificates, DNS entries, and all the other configuration and hardware. Everything that is displayed on screen, messaging to the user, details about how and when and where the authentication takes place, details about how it fits into the flow of your game, those are all on you and not the infrastructure.

Advertisement

frob said:

Most of that leaves me feeling dirty as you seem to be looking at marketing and profiteering rather than creating games, but answering your questions directly

Hehe, no worries. I just want to create something fun after work, but I want to make it professionally.

Great answer. Thank you!

This topic is closed to new replies.

Advertisement