• Advertisement
Sign in to follow this  

Could I use a raspberry pi as a server for a mobile game.

Recommended Posts

So starting a new mobile game and this time I want to add a proper leader board and allow players to retrieve profiles. For my first game I used Facebook to hold score, however the one score per player limit and the fact that you can only see the score of friends are annoying.

So now I wan my own server to deal with it except servers are expensive and I only need to store int and a copy of the Unity save.I have been thinking about getting my self a raspberry pi and turning it into a server for the mobile game, then I could also use it for my other mobile games if I want.

1.) Can I even use a raspberry pi as a server?

if I can

2.) How hard would it be and how long would it take more or less? (Assume I know nothing of networking.)

3.)What kind of maintenance am I looking at? I notice the rasberry doesn't have a cover or anything. It would have to run day in and out.

if I can't

4.) What are my other options?

I notice free server sites often forbid game hosting and only data storage, I think because then no one sees the adverts these sites use.

I really don't need much. Based on my projections from my other mobile games I think I am going to get around 500 - 800 players for about a month before it rapidly drops down. So I only need to store around 2000 player's data. Having my own server would make it easy to create more complex mobile games as I advance.

 

I am doing this for the experience so I don't mind if it's difficult or comes with some expense, I just don't want to spend thousands on this.

Share this post


Link to post
Share on other sites
Advertisement

The pi works as a great server for personal use, depending on what exactly you need it for. but if your expecting large volumes of people to play your game, the pi will most definitely not cut it. You could certainly start out with it though, and upgrade later. I have a couple pi's set up as servers at my house, ones even hosting a site (not a public site though)

Share this post


Link to post
Share on other sites
24 minutes ago, iedoc said:

but if your expecting large volumes of people to play your game, the pi will most definitely not cut it.

Lucky I am not expecting much. I think that it's going to take a long while before my games get decent downloads.

Thanks for letting me know it's possible.

Share this post


Link to post
Share on other sites
3 hours ago, Scouting Ninja said:

1.) Can I even use a raspberry pi as a server?

You can turn any computer to a server.

 

3 hours ago, Scouting Ninja said:

2.) How hard would it be and how long would it take more or less? (Assume I know nothing of networking.)

3.)What kind of maintenance am I looking at? I notice the rasberry doesn't have a cover or anything. It would have to run day in and out.

Hosting your own server (raspberry pi or not) involves dealing with making sure people from outside can access that box sitting under your desk. You'd most likely need to open up a port on your router. Some say it was that easy, but some others have said that they also need to call their cable provider to let incoming traffic into their home router. YMMV.

There exists tools like ngrok to let you tunnel in without having to deal with all above, but they may have certain limitations on the free version.

Maintaining a home server is not just making sure it has a cover. It is to also make sure it keeps on running, and your server app is not crashing under any condition. Power outages, network loss, DDoS are some of the things that you need to worry about.

Edited by alnite
grams

Share this post


Link to post
Share on other sites
1 hour ago, alnite said:

Maintaining a home server is not just making sure it has a cover. It is to also make sure it keeps on running, and your server app is not crashing under any condition. Power outages, network loss, DDoS are some of the things that you need to worry about.

Thank you for this, it's exactly the kind of information I need. In the past I hired a server and of course these things are easy to miss when other take care of them.

1 hour ago, alnite said:

You'd most likely need to open up a port on your router. Some say it was that easy, but some others have said that they also need to call their cable provider to let incoming traffic into their home router. YMMV.

Good to know. I remembered that I had problems with incoming traffic when I set up my render farm, so chances are I will need to look into this.

1 hour ago, alnite said:

You can turn any computer to a server.

I wasn't 100% sure the raspberry was a full computer. I remember when it first launched it was marketed as a platform for kids to learn python. Yet I think I somewhere seen someone mention that they used it as a server and I just wanted to double check.

I don't want to use my other computers as servers because it could be a risk and I need them for work. With a raspberry if something happens the cost of fixing it should remain low; unless my house burns down.:)

 

I have been reading up on the raspberry and it does look like a good option for a starter server, so I am going ahead with it.

Share this post


Link to post
Share on other sites
2 hours ago, Scouting Ninja said:

I don't want to use my other computers as servers because it could be a risk and I need them for work.

You're right that your server should not also be a workstation, for a whole bunch of reasons.  Consider though that as soon as you open the ports and invite connections into machines in your home, there's going to be some amount of risk involved.  What you could do is get one of those VPS-style hosting services like Digital Ocean or Linode or something and deploy your server on one of those.  You won't be inviting connections into your home network, don't have to worry about weird port forwarding or asking for a static IP from your home internet provider, etc.- but they do cost about $5/month minimum to keep them running.

Edit:  Also, consider that security on a server like that is hard to get right if you don't already know what you're doing- so offloading that task to a machine with nothing else of value on it would be a good idea.

Edited by trjh2k2

Share this post


Link to post
Share on other sites

Yeah your home router/ISP is a more troublesome issue than whether your server is a Pi or a PC :)

Many ISPs actually have a clause in the fine print that hosting any kind of service is not allowed ("please upgrade to a business plan"), so be aware that you might be sneakily doing something that could get you cut off. Likewise most ISPs will change your IP every time your router reboots, which is very bad when trying to maintain a stable server.

You can get free trials of virtual server hosting on Amazon or Azure. If you don't expect longevity you might be done by the time the trial runs out. Alternatively, you can get a virtual server with similar performance to a Pi but in a datacenter with a 1Gbps internet connection for under $5/month.. 

Share this post


Link to post
Share on other sites

Thanks for the advice. I contacted my service provider to check if I would be allowed to host, I explained to them what I needed and found out that under my current contract I would NOT have been allowed to host the server.

It turns out that switching to a contract where I can host costs less than $1 extra and gives me 2GB cloud storage with limited bandwith. I also had to remove a restriction on my modem that they guided me APN restriction?

They reassured me it isn't only for websites, a concern I had when they provided me with website building tools. I don't know how I feel about it.

 

On the one hand I now have every thing I need to keep score and store profiles, with good options to upgrade, don't need to maintain and it all costs less than a single dollar.

On the other hand I still have no idea how any of this works. They gave me software and some example code(Java and C++) to show how I would store data. That part works I made a C++ program to test.

 

I wonder if I should now still get the raspberry just to learn networking, then at the same time would I ever need to?

Share this post


Link to post
Share on other sites

Yes, a Raspberry Pi can be a "server" because a "server" is just a computing machine that responds to requests from other nodes on the internet according to some rules that you decide. A Raspberry Pi 1 is probably about the same compute power as the server computers that ran the game EverQuest, one of the first really big MMOs (back in 2000 or so.) That being said, a Raspberry Pi does not allow you to hook up very durable media -- the compact flash is not designed for constant reading/writing over long times. Perhaps a hard disk on USB could solve that?

What's harder is to figure out how those other machines would find your server. If you have a typical home Internet service, you have a single IP address, and that address goes to your router. You'd then have to port forward from the router to your Raspberry Pi. You'd then have to register a domain name, and make it map to your IP address. And, when your ISP changes your home IP address (which happens automatically every so often without warning or notice,) you'd have to update the DNS to map to the new address, and wait for DNS caching to expire, so some users couldn't find your server for a while.

This is why servers live in data centers. They can have a fixed IP address, and a squirrel chewing on your internet wire won't knock you offline, and a heatwave won't make your home computer suddenly overheat while you're not even there to do anything about it.

Using a web host of some sort is much easier. Even better is something like a virtual private server -- be it Linode ($10/month,) interserver ($6/month,) or Amazon Lightsail ($5/month and up, plus networking fees.) Of course, as your server needs grow, you will need to pay more for the server hosting.

 

So, your web hosting provider has a plan that lets you "host" somehow? It's hard to tell exactly what that means. It might be a small container / virtual machine. At that point, you could build your own service using whatever tech you want (C++, node.js, golang, python, erlang, C#, Java, Haskell, PHP, ...) and have your apps talk to your service. You still need to register a domain name, and make "api.yourgamename.com" or somesuch point to that server's IP.

Or you can use Game Center on iOS and Google Play Services on Android. Sounds simpler :-)

Share this post


Link to post
Share on other sites
11 hours ago, Scouting Ninja said:

I wonder if I should now still get the raspberry just to learn networking, then at the same time would I ever need to?

If you're looking to get into server development and management, get yourself VirtualBox (or VMWare) and set up local test servers as virtual devices on a local workstation in a virtual network.  You can play with everything you need that way, with backups (in case you mess up) and easy restarts (in case you mess up).  Study up on using Docker to wrap and provide your services, and that way you can build and test on your local  workstation-encapsulated server network and then migrate (publish) to your live server, with minimal risk and without change.

If you want to get a Pi, get a Pi.  You don't need a Pi to do any server development.  You can even run Docker on a Pi if you're serious about using one as a server.

Share this post


Link to post
Share on other sites
10 hours ago, hplus0603 said:

($10/month,) interserver ($6/month,) or Amazon Lightsail ($5/month and up, plus networking fees.) Of course, as your server needs grow, you will need to pay more for the server hosting.

So, your web hosting provider has a plan that lets you "host" somehow?

The prices they give me matches very near to what you listed above. So I think I have a virtual server with limited storage and bandwith.

I know that it works. Using the domain name I was provided with and sample code I can link my scoreboard with all the mobiles I have. It's not as convenient as Facebook because there was conflicts with the score board and one player appeared twice on the list. I don't know if I can change the domain name, it looks random generated using my name and some letters and numbers.

A quick search online shows that what I am doing wrong is sorting on the client side. I think this is a virtual server I have, as they did provide me with a sample that shows a basic employee profile login to the server.

3 hours ago, Bregma said:

If you're looking to get into server development and management, get yourself VirtualBox (or VMWare) and set up local test servers as virtual devices on a local workstation in a virtual network.

Thanks for this I am going to need all the practice I can get.

Share this post


Link to post
Share on other sites
37 minutes ago, Scouting Ninja said:

I don't know if I can change the domain name

You would need to register your own domain name, then you can point the name to whatever hosting you want.  Just google domain registrars, should be straightforward.  It is yet another small cost though.

Share this post


Link to post
Share on other sites
15 hours ago, Scouting Ninja said:

It's not as convenient as Facebook because there was conflicts with the score board and one player appeared twice on the list.

A quick search online shows that what I am doing wrong is sorting on the client side. I think this is a virtual server I have, as they did provide me with a sample that shows a basic employee profile login to the server.

You are starting to venture into the server-side development, knowing which logic to do on client vs server, how to prevent duplicate entries, and among many other fun things.

 

15 hours ago, Scouting Ninja said:

I don't know if I can change the domain name, it looks random generated using my name and some letters and numbers.

Once you have your own domain, it's just a matter of updating your CNAME record.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Now

  • Advertisement
  • Similar Content

    • By Chamferbox
      Chamferbox, a mini game asset store has just opened with some nice game assets, 
      Here you can find a free greek statue asset 

      Also check their dragon, zombie dragon and scorpion monster out:



      They're running the Grand Opening Sale, it's 30% off for all items, but for gamedev member, you can use this coupon code:
      GRANDOPEN
      to get 50% off prices What are you waiting for, go to
      http://chamferbox.com
      and get those models now!

      View full story
    • By Dafu
      FES Retro Game Framework is now available on the Unity Asset Store for your kind consideration!
      FES was born when I set out to start a retro pixel game project. I was looking around for an engine to try next. I tried a number of things, from GameMaker, to Fantasy Consoles, to MonoGame and Godot and then ended up back at Unity. Unity is just unbeatable in it's cross-platform support, and ease of deployment, but it sure as heck gets in the way of proper retro pixel games!
      So I poured over the Unity pipeline and found the lowest levels I could tie into and bring up a new retro game engine inside of Unity, but with a completely different source-code-only, classic game-loop retro blitting and bleeping API. Months of polishing and tweaking later I ended up with FES.
      Some FES features:
      Pixel perfect rendering RGB and Indexed color mode, with palette swapping support Primitive shape rendering, lines, rectangles, ellipses, pixels Multi-layered tilemaps with TMX file support Offscreen rendering Text rendering, with text alignment, overflow settings, and custom pixel font support Clipping Sound and Music APIs Simplified Input handling Wide pixel support (think Atari 2600) Post processing and transition effects, such as scanlines, screen wipes, screen shake, fade, pixelate and more Deploy to all Unity supported platforms I've put in lots of hours into a very detail documentation, you can flip through it here to get an better glimpse at the features and general overview: http://www.pixeltrollgames.com/fes/docs/index.html
      FES is carefully designed and well optimized (see live stress test demo below). Internally it uses batching, it chunks tilemaps, is careful about memory allocations, and tries to be smart about any heavy operations.
      Please have a quick look at the screenshots and live demos below and let me know what you think! I'd love to hear some opinions, feedback and questions!
      I hope I've tickled your retro feels!



      More images at: https://imgur.com/a/LFMAc
      Live demo feature reel: https://simmer.io/@Dafu/fes
      Live blitting stress test: https://simmer.io/@Dafu/fes-drawstress
      Unity Asset Store: https://www.assetstore.unity3d.com/#!/content/102064

      View full story
    • By DevdogUnity

      Ho ho ho
      Tis the season of Christmas surprises, and we have a awesome one for you! 🎅  
      Sponsored by all your favorite Unity Asset Store developers, Nordic Game Jam, Pocket Gamer Connects, and co-hosted by Game Analytics, we (Joris and I – Devdog) are launching the second edition of our yearly Christmas Giveaway Calendar for all Unity game developers!
      You can already now sign up right here.
       
      So what’s this all about?
      For the past weeks, we’ve been collecting sponsored gifts related to Unity (asset vouchers, product keys, conference tickets etc.), and throughout each day of December leading up to Christmas Day on the 25th, we will be sending out these sponsored gifts as early gamedev Christmas presents via e-mail to hundreds of lucky winners.
      The total prize pool is at $35,000, with over 1200 presents donated by the awesome sponsors!
       
      Merry Christmas from Devdog, Game Analytics, and every single one of the sponsors.

      View full story
    • By sveta_itseez3D
      itSeez3D, a leading developer of mobile 3d scanning software, announced today a new SDK for its automatic 3D avatar generation technology, Avatar SDK for Unity. The Avatar SDK for Unity is a robust plug-n-play toolset which enables developers and creatives to integrate realistic user-generated 3D avatars into their Unity-based applications. SDK users can allow players to create their own avatars in the application or integrate the SDK into their own production processes for character design and animation.
      “Virtual avatars have recently become increasingly popular, especially in sports games and social VR apps. With the advance of VR and AR, the demand to get humans into the digital world is only increasing”, said Victor Erukhimov, itSeez3D CEO. “Our new Avatar SDK for Unity makes it super-easy to bring the avatar technology into any Unity-based game or VR/AR experience. With the Avatar SDK for Unity now every developer can bring face scanning technology into their games and allow players to create their own personalized in-game avatars, making the gameplay much more exciting and immersive.”
      Key features of the Avatar SDK for Unity:
      Automatic generation of a color 3D face model from a single selfie photo in 5-10 seconds (!). Works best with selfies, but can be used with any portrait photo.
      Shape and texture of the head model are unique for each person, synthesized with a deep learning algorithm crafted by computer vision experts
      Head models support runtime blendshape facial animations (45 different expressions)
      Generated 3D heads include eyes, mouth, and teeth
      Algorithms synthesize 3D meshes in mid-poly resolution, ~12k vertices, and ~24k triangles
      Six predefined hairstyles with hair-recoloring feature (many more available on request)
      Avatar generation API can be used in design-time and in run-time, which means you can allow users to create their own avatars in your game
      Cloud version is cross-platform, and offline version currently works on PCs with 64-bit Windows (support for more platforms is coming soon)
      Well-documented samples showcasing the functionality.
       
      Availability
      The Avatar SDK for Unity is offered in two modes - “Cloud” and “Offline”. The “Cloud” version is available at http://avatarsdk.com/ and the “Offline” version is available by request at support@itseez3d.com.
      ###
      About itSeez3D
      At itSeez3D, we are working on the computer vision technology that turns mobile devices into powerful 3D scanners. itSeez3D has developed the world's first mobile 3D scanning application that allows to create high-resolution photorealistic 3D models of people's' faces, bodies and objects. The application is available for iOS and Windows OS mobile devices powered with 3D cameras. In 2016 the company introduced Avatar SDK that creates a realistic 3D model of a face from a single selfie photo. To learn more about itSeez3D scanning software and 3D avatar creation technology, please visit www.itseez3d.com and www.avatarsdk.com.

      View full story
    • By khawk
      Unity has posted the Unity Austin 2017 playlist on YouTube. From their tweet:
      View the full playlist at https://www.youtube.com/playlist?list=PLX2vGYjWbI0TI_C4qouDw7MSSTFhKJ6uS or below:
      .

      View full story
  • Advertisement