Can IPFS be used to host a game server?

Hi,

I’m new here and I’m looking for a decentralized solution to host a game server for a game I’m developing.
Does IPFS have any kind of server hosting capabilities similar to AWS or Google Cloud compute engine?

Thanks

This depend a lot of your game, something slow, for example chess, could be made to work over pubsub (a multicast p2p protocol included in IPFS).

But likely no, IPFS is a CDN, it serves file, it would be awesome to distribute your game / level data (for example decentraland distribute levels on IPFS).

You could maybe get something more p2p to work (example imagine having all players connected to each other) use libp2p (the network layer of IPFS), but that sounds like desync and lag compensation hell.

2 Likes

There aren’t really servers in a decentralised environment (it’s peer to peer of course :smiley:). However libp2p / pubsub can definitely be used to make a game. If you’re making one using js-ipfs, I have a guide that might be useful if you’re new to peering: http://docs.ipfs.io/how-to/create-simple-chat-app/ (edit: workshop link too, might be helpful if you like a video IPFS: Browser Connectivity Walkthrough - YouTube)

2 Likes

There are also questions about reliability.

If your game is just for fun, you can just pick someone with a good connection at random, and make it the server, or let people host their own servers.

If however your game has an MMR system, or an XP system, … or anything you want to control (I imagine a CSGO where items are NFT for example), that would be a pain.

2 Likes

Smart contracts over something like NEAR might make that less painful :thinking:. Would require some work to figure out how to make things “reliable” (ie: valid).

1 Like

The issue I see, is that if you are playing a shooter game for example, even with a really low tickrate of 20 tps. You can’t update a smart contract 20 times a second.

You can maybe only update the chain when the game is finished (claiming victory, giving XPs to players)
But what stops a server to give rewards to random users instead ? (or giving the reward to the wrong team)

My conclusion

If you don’t care about any reliability, you can but you will need to figure out all the networking yourself easly (as easy as writing the netcode for any game). (you can use libp2p and pubsub, but it’s only an authed readwrite stream and a multicast protocol, you are light years away from any game netcode)
But in this case, why not just use the community hosted server routes (where anyone can download the server and host it, and have a list of servers) ? Many small games do that, it’s easier and work great.

If you want a game where you require some state (MMR, XPs, …) I don’t think you can. Or just the networking will require 5 years + of programation and research to do.

2 Likes

I was thinking update the smart contract in certain intervals (once every 60s?).

Seems I should get a game demo higher on my priority list :thinking:.

Many actions are very important in term of order.
For example what if I claim that I killed you and you claim that you killed me first ?

That why I’m pushing hard for just let the comunity deal with it.
You have some centralised server, and if you are not happy just spin up your own (it’s a just a federation model when I think about it :smiley: ).
This also solve the solution of cheaters, let the admin of the server ban it.

I still think there’s a consensus model to be had. Everyone stakes a token, end of game validators check state, liars lose stake (or agree with consensus).

Hmmm ok thanks for both your input.

The kind of game I’d like to do is a sandbox type game maybe… the ideas aren’t concrete yet.
It would need a fairly high tick rate of say at least 30tps or so.

The most important feature I’m after is that my game can’t be censored or cancelled (not that it’ll be offensive or anything :stuck_out_tongue_winking_eye:).

But I guess the idea of community hosted servers is probably the most easiest and feasible idea for now.
I’ll also have to look into that pubsub technology as well.

1 Like

I just had an idea:
What about if I distributed my game as a NFT?
The NFT could then point to a IPFS location.
And when I update the game or have a new release, I could make a new commit at that location?

There are potential issues in that an NFT owner could share their IPFS location and then everyone can get a copy of my game for free.

Maybe there’s a way to authenticate the game so that only NFT owners are allowed to play it?

It doesn’t make sense, just distribute the IPFS location anyway.
If you think about selling the game through NFTs, what stops someone from just reading the NFT on chain and download the CID ? Or from one people would buy it, and share it to everyone else ?

Yes, but IPNS (over ENS) makes more sense, to me.

Yes there are, but it’s a huge pain, and that doesn’t stop people from reverse enginering the game and removing all of your checks anyway.

I think, you should really take a look at https://decentraland.org/ the whole game is opensource, what they focus is selling content in the game (places, cosmetics, names, …) instead of the game itself.

For example when you buy a cosmetic, you say to other players : “hey I have this nice hat, pls show it on my character”, then other players are gonna check this on the chain and they will display it only if it’s true. So you can still modify the game on your side to unlock everything, but if doesn’t player doesn’t see it, is that really an issue ?

1 Like