Sayaki
Sayaki

Reputation: 789

Backend for unity mobile game

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:

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:

Upvotes: 2

Views: 3180

Answers (4)

Foggzie
Foggzie

Reputation: 9821

PlayFab supports everything you've listed out-of-the-box except NFT/crypto integration. Their tutorials are extensive and they've got a Unity-specific plugin to make thing even easier. If your game's logic is fairly complex, you'll need to use their multiplayer server features where you upload your binary but, if it's simple enough, you could design the entire server-side of your game as a collection of Azure Functions.

Upvotes: 3

shubham shukla
shubham shukla

Reputation: 51

Technically what you looking into is a custom server with a lot of supporting 3rd party services. I recommend writing your own c#, node server, and then go ahead with the rest of your needs from 3rd parties such as Moralis, etc.

Upvotes: 5

Asad Awadia
Asad Awadia

Reputation: 1521

be the authoritative server and run the whole logic of the game

can be done via any language and http server combo

For a grab n go template to build backend apps in kotlin you can use git clone https://gitlab.com/asad-awadia/kotlin-server-app.git

access NFT, interact with smart contracts and send all required blockchain-related data to the client

can be done via any language that has the required libraries

supports PVP, PVE and co-op type of gameplay

can be done via any language and http server combo

supports a microservices architecture

Not sure what a server has to do with this? You can model your backend however you want

allow for easy deployment scalability with services like AWS or Google

Pretty much any language and http server can be put inside a docker container and deployed via AWS/GCP

expose an APIs

That is mainly what the server will do

ofc be secure and attack-proof

This is something that takes a lot of thought and is usually punted down the road for when you can hire someone

has all the features that a decent mobile game needs

You will have to code up whatever features you want

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

A language + http server is the most common technology used for creating backends for mobile games. I would start with Kotlin + Javalin

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

Unlikely, since you have very specific requirements of NFTs and blockchains

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?

In your situation that might be a way to go

Upvotes: 0

AlexApps99
AlexApps99

Reputation: 3584

You will need to make your own server, but you can be flexible on how much you implement, and how much you leave to a third-party Unity server (like Mirror, Photon, or some other solution).

For example, exposing APIs and interfacing with NFT/blockchain is something you would need to implement on a server yourself, as there are security issues with having that code on the client, and Unity integrations aren't suited to implementing these features.

As for the game netcode: Match-3 style gameplay is easy to make yourself on a custom server, and it would be a lot more efficient than an external solution, which are usually designed for more complex games with lots of GameObjects being synchronised at once, rather than a simple game board and a small amount of state. On the other hand, using Unity netcode is a lot easier depending on how you design the game, and the tradeoff could be worth it if you find it easier.

Ultimately, where you draw the line between external Unity backends and your custom API server is up to you. If your game has simple gameplay, then networking will not be a bottleneck even if it isn't efficient, so it could be worth the tradeoff of a secondary Unity backend solution when it involves less work.

To summarise, Unity backends are designed primarily for synchronising GameObject state between multiple clients of a Unity game, not so much for external API calls and other functionality.

There is no standard server technology because at the end of the day, a server is a server. No matter your underlying language or libraries, the way your server behaves to the network is defined by you. It doesn't make much difference how you implement it, because you will need to write the "glue" code between the server and the client regardless.

Upvotes: 3

Related Questions