The server for multiplayer games?

Hi all.
The time has come when we need to develop a server for online games (client will be android and / or ios), and this subject had many questions. Since the development of such things there is no experience, the questions can be extremely strange.


- First of all how to work the server? It needs all user actions in the moment of their execution immediately synchronize the server and saved in the same mysql?
Technology for the server itself? On the Internet I have seen many reviews about nodejs both good and bad. Therefore, there is some uncertainty on account of NodeJs. Also still interested in such a thing as ASP.NO. It is suitable for such purposes and justified to use it?
- For example when you select a Node in the client I need to handle the server response. This is understandable, but what is the format of the JSON response( all right) or I not correctly understand???
For dodatka(not the game) I used php + mysql "servers for data storage". Whether I did?
Would like to hear from you some tips in the build, optimization, correct choice of technologies for these servers which is designed for online play.
July 8th 19 at 16:36
5 answers
July 8th 19 at 16:38
Solution
Suitable Node.JS and PHP and C++, and Ruby and ASP.NET and Python and Java, etc., etc, etc.

I would suggest Go. With it the server load will be less.

And there is good documentation and templates on the interaction between server and Android for Google AppEngine.

Of the minuses - privlagies to Google AppEngine. From pluses - there is so much is out of the box and already sharpened for Android, and Android is sharpened by Google AppEngine.
During your work with Google AppEngine you used the paid version?? - Tressie.Williamson53 commented on July 8th 19 at 16:41
: Some projects never go beyond pay limits.
But the Bank card there, you need to bind anyway.

Some of the projects visited and already paid. The funny thing for visitors we pay a penny (well, there is at the level of 40 rubles a month), but the main costs are our own logic (the so-called backend, instance)

You can still be smarter - user experience implemented using the Google AppEngine, and basic logic to hang up immediately in Google on a regular VDS. - Katlynn_Ha commented on July 8th 19 at 16:44
The experience with Google was not yuzal only the authorization API, to sory for maybe stupid question... If I yuzayu APP ENGINE there realizovy some server logic, then creating a game on crossplatforming engine, a server will work with ios, win, android or just android? And if you can some material on this topic, useful, in your opinion, and that ignorant people may stumble on the fact that he doesn't need... - Tressie.Williamson53 commented on July 8th 19 at 16:47
: Saw the following thing, "You will receive a loan of USD 300 for 60 days. Funds from your actual account will not be debited until, until you move to paid account. To cancel the trial period at any time." I thought there is a limit one day and not the account as a whole... About it is possible more in detail? - Tressie.Williamson53 commented on July 8th 19 at 16:50
:
https://cloud.google.com/appengine/docs/quotas
Not yet exceed the Free Limits is free. Forever.

Limits (and the money in their excess) are considered for all separately on the traffic, CPU time, database, etc.

It has no time limits.

300 bucks will be spent as soon as you exceed the free limits. But to use 300 dollars of a limited time since activation, so do not activate them earlier than they really need. When 300 free dollars will end - will require real money.

Again focuses: If your website/service/game Ave. does not exceed the free limits, you pay nothing. This could go on forever

But Bank card still need to tie. It will take some pennies to make sure that you are serious. - Katlynn_Ha commented on July 8th 19 at 16:53
:
Hosting of Google is called Google Cloud Platform.
There are many different types of hosting. He of whom we speak is called the Google AppEngine.

The one that is closer to the classic hosting service called Google Container Engine, Compute Engine...

But we're not talking about him.

Google AppEngine is a PaaS type hosting, that is, in contrast to traditional hosting services that are IaaS, you do not need to administer.

The so-called zero administration. It is very convenient. And you can fit in the free limit, if properly programmed.

But it requires the development of strictly according to the rules of Google. Classic web application/web service/web site - quickly go over the free limits. Therefore, we strongly recommend to follow the examples for the Google AppEngine. Full of such examples.

Google Endpoints is the interaction with the outside world. In fact it is a RESTful API with a few twists.

It is compatible with anyone - with Android, iOS, c web sites using JavaScript.

Specifically for Android there are examples of how to use Google Endpoints. I think I can't remember what needs to be examples and iOS.

Physical limitations on client operating systems no no, because Google Endpoints is the most that neither is a universal REST. - Katlynn_Ha commented on July 8th 19 at 16:56
: The official documentation for Google AppEngine is a good example. Take specifically for Go. There are still other programming languages, but they are devouring server resources. - Katlynn_Ha commented on July 8th 19 at 16:59
There is and examples of how to organize the chat, etc., etc.
Communication with applications on smartphones.
Authentication
etc.
etc. - Katlynn_Ha commented on July 8th 19 at 17:02
: With Go I did nothing and through it all the same will ask how much more resources eats:
- java;
- php;
- javascript;
- pyton.
Where can I see those statistics.. - Tressie.Williamson53 commented on July 8th 19 at 17:05
:
From this list

Java is fast and reliable. But the likes of the RAM.
The rest are roughly equal. - Katlynn_Ha commented on July 8th 19 at 17:08
: On the Google AppEngine can and Java to run. - Katlynn_Ha commented on July 8th 19 at 17:11
I know that it is there can run all those languages if I am not mistaken there can be, but in a certain ratio in comparison with Go how this to needed resources or what it is there eating :) - Tressie.Williamson53 commented on July 8th 19 at 17:14
:
Go for the most economical use of resources compared to all of the above.

The difference is substantial. I recommend all the same to learn. - Katlynn_Ha commented on July 8th 19 at 17:17
:
It is a simple. - Katlynn_Ha commented on July 8th 19 at 17:20
:
The fact that Go compiles to native binary and ispolnyaetsya on the CPU without any virtual machines and without an interpreter, in contrast to the PHP/Java/JavaScript/Python/Ruby/Perl/Erlang. - Katlynn_Ha commented on July 8th 19 at 17:23
: I really helped, I think a couple of days to master on some level... But still would like to ask, even more to ask to you posovetovali a material on the Go, and something similar already on the AppEngine server, whether the at least the same Hello world... - Tressie.Williamson53 commented on July 8th 19 at 17:26
: And a very strange thing, honestly speaking even in Google searched but all what environment to use??? Eclipse + plugin or is there something more powerful and Ala Intelllij for java.... - Tressie.Williamson53 commented on July 8th 19 at 17:29
:
Documentation - good
https://cloud.google.com/appengine/docs/go/
https://golang.org/doc/

Tools for working with Google AppEngine
https://cloud.google.com/appengine/downloads
There are examples

That's just an example about the connection between the server and client,
if you need constant and quick interaction with the server
https://cloud.google.com/appengine/docs/go/channel... - Katlynn_Ha commented on July 8th 19 at 17:32
:
That habitually, and use.

Granted, even the Android Studio plug-in for Go can be (it's the same as Intellij IDEA, only sharpened).

You can use LiteIDE. Easy and quick written using the Go.

As far as I know, most people prefer to use Intellij IDEA.

Plugins for Go are available for the basic programmer editors: for Sublime, Emacs, Atom for, for Vim. - Katlynn_Ha commented on July 8th 19 at 17:35
: Well, still what I will study, thank you very much if what I'll write :) - Tressie.Williamson53 commented on July 8th 19 at 17:38
July 8th 19 at 16:40
Solution
To start is to decide if a game will require real-time network code, or not.
If not (99% of situations), then write the server in any convenient language in the web (PHP, Java, C#, Python, Ruby) with REST API. Specific asynchronous solution (Node.js Go) it is better not to take.

If required, the tools will be different, should stick to java.nio, or Go Node.js. On other stacks is also possible, for example, using ReactPHP, but it's not the most popular decision.
As for me, after each task must maintain a certain result, as will a certain gaming location in which to 20 "Ala tournament", and between these characters will be some kind of action, I understand that need real-time, and using that ( java.nio, or Go Node.js.)? - Tressie.Williamson53 commented on July 8th 19 at 16:43
This is why Go is better not to take?
Because personally you have not mastered, or what?
Go just well for the game that makes better use of server resources than Java, PHP, Net, Python, Ruby. The game is, IMHO, important.

Exterior - RESTful, for example - from language in General well does not depend. - Katlynn_Ha commented on July 8th 19 at 16:46
: I wrote that Go is a good option, and even wrote, in what situations.
You my answer to read to the end?
Or you like to apply the newly learned technology to the entire row, not thinking that for certain tasks, some tools fit better than others?

: if it's the interaction between players in real time, you need solutions such as java.nio, or Go Node.js. - Tressie.Williamson53 commented on July 8th 19 at 16:49
: js, java - all the rules, you can write with Go is not punched. And despite all this, advise where better to start studying... And right now, it is easy to find on Google PoE**camping another week and then find out that it's all wrong, bad attitude, etc. - Tressie.Williamson53 commented on July 8th 19 at 16:52
it is better to delegate this task to someone with experience.
Article will help with the choice, look at the examples code to see which language you like more: https://habrahabr.ru/post/197926/
Node.js I would have to consider did not, if you didn't have before Affairs with JS. - Katlynn_Ha commented on July 8th 19 at 16:55
:
Can with Java, but eats more resources. - Katlynn_Ha commented on July 8th 19 at 16:58
:
You yourself are new. I Go for 4-th year. - Katlynn_Ha commented on July 8th 19 at 17:01
: but the messages still to be read and not learned. It is necessary to answer, and there is no need to read. - Katlynn_Ha commented on July 8th 19 at 17:04
: Write simple and people will understand you. - Tressie.Williamson53 commented on July 8th 19 at 17:07
: how you can even easier to write?
I suggested two options, one of which will Go bad and the second good.
Expected from the author of a question of clarification, what's his option. It turned out that the second. - Katlynn_Ha commented on July 8th 19 at 17:10
:
Yes, there will be none of the options are bad.

Except for one thing - if you great to know another language. - Katlynn_Ha commented on July 8th 19 at 17:13
: the first situation - a common website with the API.
Since when Go became a good writing tool sites outside the scope of hayload for conventional business logic? - Tressie.Williamson53 commented on July 8th 19 at 17:16
:
If you're talking about primitive sites that you can use HTML and engine servers to mix sort of PHP best.

For all other tasks that Python that JavaScript (Node.Js) that the Java that PHP, Ruby, Go - all equal from the point of view of ease of writing. - Katlynn_Ha commented on July 8th 19 at 17:19
:
Well, as it is CMS made with PHP... - Katlynn_Ha commented on July 8th 19 at 17:22
: not equal. In some areas (XY*q, XY*to and in production) are better PHP, Python and Ruby in the other (bloody enterprise), Java, C#, and PHP, in the third (hayload) - Java, Go, and Node.js.
Universal instruments. For different tasks different tools. - Katlynn_Ha commented on July 8th 19 at 17:25
:
PHP because it is easier for the simplest of sites thanks to the integrated HTML.

All "normal" languages of equal capability.
I don't understand what prevents the use of Highload-languages for simple tasks.
Go - Erlang some. There are as simple as in Python, Ruby, Node.Js Java. - Tressie.Williamson53 commented on July 8th 19 at 17:28
: why the simplest? For complex it is also one of the best options (along with Java and C#). Code to modern PHP does not like PHP 4, which you have in mind.
I was working with a huge project on PHP (one of fifty developers in the company), and not present it even in the Python or Ruby ecosystem. And to write something on Node.js or Go is just suicide.
By the way, was forbidden any code optimization, which went to the detriment of readability ;) - Tressie.Williamson53 commented on July 8th 19 at 17:31
:
PHP has a generic there is one difference - it is easier other listed above on the simplest sites.

That PHP is not suitable for complex sites - I did not write. - Katlynn_Ha commented on July 8th 19 at 17:34
:

I was working with a huge project on PHP (one of fifty developers in the company), and not present it even in the Python or Ruby ecosystem. And to write something on Node.js or Go is just suicide.


If the project is confined to "real" HTML templates PHP, then Yes. For other languages would be a different architecture. - Katlynn_Ha commented on July 8th 19 at 17:37
:
> it easier for other listed above on the simplest of sites
I do not agree. Baseless judgement based on nothing.

> If the project is confined to "real" HTML templates PHP, then Yes. For other languages would be a different architecture.
And again you're wrong.
To write a system of hundreds of man-years with a monolithic app? I hope you're joking.

> For other languages would be a different architecture.
Another portion of the conclusions based on a misunderstanding of how the currently used language.
I repeat: do not confuse the modern PHP and PHP 4. - Tressie.Williamson53 commented on July 8th 19 at 17:40
:
To write a system of hundreds of man-years with a monolithic app? I hope you're joking.


Since when in the language there were restrictions - one may not be monolithic to write, the other does not.

Bredyatina. - Tressie.Williamson53 commented on July 8th 19 at 17:43
:
Another portion of the conclusions based on a misunderstanding of how the currently used language.


Intrigued. Describe the architecture of the PHP project.
Do not believe that it is impossible to write efficiently in other languages. - Katlynn_Ha commented on July 8th 19 at 17:46
:

> Since when languages appeared restrictions - one may not be monolithic to write, the other does not.
This limitation is common sense. The more man-years service, so it is difficult to maintain. Therefore, the system is divided into a number of services.
A monolithic application to a lot of startups in the early stages.

> Intrigued. Describe the architecture of the PHP project.
A dozen apps connected, and applications in other languages (where you need a high performance) at the SOAP and the tire, some of them look to the corporate network via REST API (as SPA). And only one service looks to the Internet and renders pages on the server. - otho.Mraz23 commented on July 8th 19 at 17:49
:
This limitation is common sense. The more man-years service, so it is difficult to maintain. Therefore, the system is divided into a number of services.
A monolithic application to a lot of startups in the early stages.

We are having a conversation about languages.
So I ask - what you gave an example about the monolith/neonlit in the context of languages?
Languages are there any restrictions? - Tressie.Williamson53 commented on July 8th 19 at 17:52
:
A dozen apps connected, and applications in other languages (where you need a high performance) at the SOAP and the tire, some of them look to the corporate network via REST API (as SPA). And only one service looks to the Internet and renders pages on the server.

And what is the limit? You wrote that "only under the PHP task to go and you have no idea how to implement it in Go" - otho.Mraz23 commented on July 8th 19 at 17:55
:
> what you gave an example about the monolith/neonlit in the context of languages?
About it began to speak to you:
If the project is confined to "real" HTML templates PHP, then Yes. For other languages would be a different architecture.


> You wrote that
Don't need your words in my mouth to invest. I did not write. - Katlynn_Ha commented on July 8th 19 at 17:58
:
Don't need your words in my mouth to invest. I did not write.


What:

I was working with a huge project on PHP (one of fifty developers in the company), and not present it even in the Python or Ruby ecosystem. And to write something on Node.js or Go is just suicide.


You never gave an example - why not in Go or Python. - Katlynn_Ha commented on July 8th 19 at 18:01
: reformulate: don't see her as the same quality and time frame (because it is impossible). Although the previous wording was quite clear.

I repeat: for different tasks are better suited to different tools. Writing start-UPS in java as inappropriate as the enterprise in ruby. - otho.Mraz23 commented on July 8th 19 at 18:04
:
in the same quality and time frame (because it's impossible)


in addition to a huge number of cheap PHP coders see no other reason. but trust cheap PHP-coders complex system.....?


Writing start-UPS in java as inappropriate


LinkedIn


as the enterprise in ruby.


You are aware of the history of the formation of Ruby as a serious and useful tool? With the advent of Rails went to a fashion.

And why were the Rails? Because it was written Basecamp, which is not the homepage. - Katlynn_Ha commented on July 8th 19 at 18:07
: the feeling that you picked up somewhere sketchy knowledge, but the experience you have there.
For the sake of interest find out how to get the PHP developers with experience of 5+ years.
You're stuck in the last century, in the times of PHP 4.

> LinkedIn
Don't want to refresh his memory and read when it was founded, and in what Millennium was founded another project Hoffman, him prior?

> it was written Basecamp, which is not homepage
In which the business logic at the level of CRUD. - otho.Mraz23 commented on July 8th 19 at 18:10
:
For the sake of interest find out how to get the PHP developers with experience of 5+ years.


The law of supply and demand. PHP-ists is full, compared with Goшниками. Wages to Goa and a half times more. Checked. - Katlynn_Ha commented on July 8th 19 at 18:13
we watched hh in Moscow, filtering for 175+. No jobs for programmers Go. Vacancies for PHP programmers there. - otho.Mraz23 commented on July 8th 19 at 18:16
:
Don't want to refresh his memory and read when it was founded, and in what Millennium was founded another project Hoffman, him prior?


Probably for the same reason that in your opinion still, already in 2016, not yet on the Go.

In which the business logic at the level of CRUD.


You're talking about user interaction?
;) - Katlynn_Ha commented on July 8th 19 at 18:19
:
looked hh in Moscow, filtering for 175+. No jobs for programmers Go. Vacancies for PHP programmers there.


Patamushta PHP is 85% of the market. And Go - not the remaining 15% and less.

I don't mind. Err on. Me less competition.
The work is. - Katlynn_Ha commented on July 8th 19 at 18:22
: work very little, get paid little, or not specified salary fork.
Or data the largest labour exchange in Russia for you not the authority?
Incidentally, we are not competitors. - otho.Mraz23 commented on July 8th 19 at 18:25
:
You see the ads, that is only something that you dream employers. You see the ads because they are hanging for months.

Everything is fine with the work.
))) - Katlynn_Ha commented on July 8th 19 at 18:28
:
To write a system of hundreds of man-years with a monolithic app? I hope you're joking.


The partitioning of the source code in a separate turnips does not necessarily require that the result was a number of separate services, sootvetstvuyushie number REP.

Oh, the fashion for microservices and Zavis to Zuckerberg - all see themselves as second Facebook and smolodu preparing for scaling out.

To the idea of microservices perfectly wrote a huge application where thousands of programmers worked for years.

Not the solidity is only a tribute to scaling out. If this is not necessary, the separation only 2-3-4 piece separate for the vast majority of tasks (to be able to do graceful restart, if you suddenly begin to experience problems with memory) - is enough.

Monolithic app itself and works faster and easier development. If you do not need horizontal scaling.

Hundreds of man years - not to blame at all. - otho.Mraz23 commented on July 8th 19 at 18:31
July 8th 19 at 16:42
"The time has come when you need to develop a server for online games"

Judging by your questions, the time has not come yet.
Write for example the online chat.
email server online chess or naval combat, with the ability to play two, the rest of the watch. Time will take a bit, but you learn how to formulate questions.

Because your questions sound like "I want to write an abstract server online games, I have no idea quake/DotA/bulbs online, but how to make that all worked instantly for any client." That is, no concept, no requirements, no understanding of what is critical and what is not.
July 8th 19 at 16:44
nodejs+socket.io is a very good choice for a private server. There are lots of ready-made solutions.
Suggest to get acquainted with this series of articles. A lot of interesting.
July 8th 19 at 16:46
I have php + go + mysql + redis + nginx

Find more questions by tags Development of gamesMobile development