
Your browser is the mouse path: WHY?
Start: habrahabr.ru/post/249625
Frankly, I planned to limit myself to one short article, in which I was going to briefly list the difficulties in the way of anyone who wants to have their own server in the farm with a browser game on the OpenSource engine. However, it suddenly turned out that all I wanted to say was simply not interfering with one article of a reasonable size. Well, then it will be several articles. Now you can not try to push everything into one post and analyze in detail all the rakes in the path of the future administrator of the browser.
The first article of the series unexpectedly even for me turned into general recommendations about the behavior of the Server Administrator. But now it’s obvious that this is a run ahead of the engine. Before someone decides to install a browser and shut down the admin, he must answer his main Question. And this question sounds like this: “WHY ?!”
But before giving possible answers to this question, I would like to clarify for whom this series of articles is intended.
As you know, it is better to be rich and healthy than the poor and sick. In our case, it is better to have money for development and promotion and / or to have our own experience in this field. If you recognize yourself in this description, then these articles are not for you. Really - if you have money for development, then why do you mess with free engines? It’s easier to hire professional professionals who will do this job better, faster and, as a result, with less hemorrhoids. How to act in such cases, described in dozens and hundreds of excellent articles on the same here, on Habré. Look and read them.
If you have experience in developing browsers, then again, you do not need to read this article. You yourself can quickly and beautifully write your own engine, and then sell it to a publisher or cooperate with a promotion specialist.
If you have experience in promoting network projects, you don’t need to get involved with the development, installation and support of your engine. It’s easier for you to find an already more or less working server and offer your services to the administrator for a share in revenue. If you are a really good specialist, then any administrator will gladly seize on the chance to increase the attendance of his server and his income.
Now that we have cut off the "rich and healthy," only the "poor and sick" remain. Those who have neither money nor skills, but only have a burning desire to become the administrator of their server. And now you can try to answer the question asked above: "Well, why do you need all this?"
I really do not want to dispel the dreams and hopes of future administrators, already mentally managing servers with thousands of registrations and hundreds of online. But reality is sad and cruel. For the first few months (or even years), you can’t offer the players ANYTHING:
- You are using any of the ready-made engines - which means that numerous variations of such servers are already scattered across the network;
- You still do not have any skills to somehow isolate your server from hundreds of similar ones;
- You do not have money to hire at least any specialists - that’s all, i.e. ABSOLUTELY ALL you have to do yourself! Starting from the configuration of the operating system and ending with the administration of the forum (which, incidentally, will also have to be deployed to you) and in-game chat;
- You don’t even have money for promotion and advertising - so even you have to do it yourself. You will have to study the CEO to stand out from the host of identical clones with at least meta tags. You will have to register in dozens of directories yourself in order to get at least some number of registrations and at least some online. You will have to search for thematic forums yourself and advertise your game - where it is not prohibited by the rules.
Still have a desire to launch your browser? Then answer yourself the question “Why?”. Just be honest even with yourself! There are a lot of possible answers to this question. I will try to consider only a few of them - and explain why they are poorly suited as a reason to launch my own browser. So ... The
answer is no - MONEY
As mentioned in the previous article, there is no fish here. At least some kind of exhaust can be expected only with serious investments of forces and / or means. And often - both of them. But even so, at least “to zero” the browser will not be released very soon.
The first answer is - CLEAR YOUR FREQUENCY
There is absolutely nothing wrong with that. As a motivator, scratching the FWM will probably be stronger than even the desire for profit. But I say right away - it’s not worth it. You can scratch the ChSV in easier ways. For example - to find an already open server with the same "poor and sick" admin and ask for moderators. Costs and responsibilities - minimum, profit and size of FWM - at the achievable maximum, given the complete lack of skills and money.
The second answer - LEARN
Do you want to learn a new language - say PHP, which most browsers are written in - and couldn’t come up with anything better than learning it using the free engine code? Really! There are much better and painless ways to learn PHP! The network has a huge number of training courses with examples for any level of difficulty - starting with "Hello World!" and ending with examples of creating a simple game from scratch. With detailed explanations of each step, commented code, a community ready to answer your questions. In general, virtually any other way to learn a new language is BETTER than delving into the shit in the next free browser.
And I know what I'm talking about - the code of literally every ogame-like clone engine I’ve looked at varies in quality from "monstrous" to "very bad." Including even my SuperNova code. There are objective reasons for this. Very rarely, the entire lifetime of the engine, its code is written by the same command. As a rule, the code of a free engine represents a hodgepodge of fragments written by different people with different levels of experience and different approaches to writing software. All these different pieces are somehow docked together. The database structure is usually terrible. There are no foreign keys and even important indexes in the tables, records are not standardized, the data in often duplicate each other, and for the same data several different tables are used simply because different pieces of code were written by different people at different times.
But even if the engine was developed by one person / one team, then here you are not immune from a miscellaneous code. The fact is that it is human nature to learn. New techniques are being developed, new practices are added, the arsenal of funds is expanding. Yes, and as it is finalized, the engine grows and develops and provides more and more tools for standard actions. And what a year ago seemed to the programmer to be the pinnacle of skill (and it was them, judging objectively) in a year will only cause a nervous smile and a sense of awkwardness. Yes, of course - if you initially planned the architecture of the game, painted the database structure and clearly followed your plans, then all this could have been avoided. Only, alas, people who can do this have long been working either for themselves or for "uncle." And free engines are written by enthusiasts.
The third answer - MAKE YOURSELF
I have to disappoint here too - at first most of the time you will understand terrible someone else’s code just so that you can move on to the smaller part - fixing someone else’s mistakes. Almost any free engine contains: an almost complete lack of verification of input parameters for type compliance and correctness; direct insertion of data from the user into the table without escaping - the path to SQL-injection; direct data output from users both in HTML code (the path to the appearance of virus and malicious scripts in your browser) and in JS code (at best making your scripts inoperative, and at worst - allowing you to execute hostile code on the page); direct recording of data into database tables with complete ignoring of competitiveness - and this is a direct path to deadlocks, race condition situations, loss of units, resources and other game nishtyaks. And this is just the tip of the iceberg! Few engines make full-fledged “type-system-data” checks, and trust the data from the browser too much - which in the long run gives malicious players the opportunity to appropriate resources or even manipulate other people's accounts. And I haven’t mentioned the wrong choice of data types in the database yet, when after a couple of years of work the top players have an overflow of fields in the tables with all the accompanying elusive glitches, or an incorrectly selected internal data storage format - when line 070 when converting to a number suddenly becomes number 56.
And even when you close the main holes and correct the most egregious glitches, the curse of the INHERITED CODE will always prevail over you. Any of your attempts to do something of your own, new and interesting, will come across the fact that with the current code and the current database structure it will simply be IMPOSSIBLE without rewriting a noticeable piece of the game. Or when fixing a glitch in one place leads to the appearance of a completely different glitch in a seemingly unconnected section of code - simply because the old glitch was already taken into account and corrected by someone else in its fragment.
Really - if you just want to participate in the development and do something your own - join any existing project. Even if you are not accepted into the team (and who needs you without skills and money?), Then at least you can try to write some kind of mod and get advice and help on the project forum.
Still want to install your browser? Well, mice! Welcome to the country of hard and prickly cacti! Here are just a few plants that you will have to completely chew on your way.
Cactus One - LONELY
I wrote this above, but I emphasize once again - get ready for the fact that you have to do everything yourself. Starting from configuring the server for the game and ending with the layout of the pages and even drawing pictures for the game. Or at least to redoing free pictures from an Internet. If you have a familiar admin who will help you set up your server, a familiar layout who will help you make up pages, or a familiar artist who will draw pictures for you - you are very, just incredibly lucky!
However, immediately tune in to the fact that this help is temporary and / or episodic. You can only answer for your desire to make the Ideal Browser, and only you have an incentive to continue working on it. If one of those with whom you started the project has cooled down over time - do not blame him. Say "thank you!" for the work done and continue on without him. If someone helped you out as a friend, you should not consider him your debtor and count on the fact that you can use his skills always and without restrictions. If possible, carefully observe what and how your friend was doing so that the next time he would repeat these actions himself, and seek help only in extreme cases. If you do everything right, then you will have to seek help less and less,
Cactus Two - LACK OF SKILLS
At first, any action will raise a bunch of questions. At first it will not be clear even where to start and what to grab. This is normal. This is to be expected and is to be prepared in advance. At the very beginning, you will not only have skills, but you won’t even know where to find answers to your questions and even sometimes you won’t understand how to formulate the question. As they say - read the docks, they rule. Sometimes free engines contain the simplest instructions for installing the game in the standard / basic configuration.
Often on the forums you can find answers to the most frequently asked questions. But remember that the question on the forum is the expense of a “help loan." Just because you downloaded the engine and wanted to install it does not make the author of the engine something indebted to you! Therefore, avoid spending your credit on general questions like “How to install MySQL?” or "How to configure PHP?". Such answers are easier to find in Google - with a huge degree of probability there is already the right answer, which was given for a case similar to yours or very close.
It also makes no sense to ask questions on the forum on the forum - in Google there are answers to all your questions - usually much more, better and in more detail than they will be answered on the forum. Even the questions on the engine are best answered independently. In the end, your engine will be OpenSource, and the ideal code documentation is the code itself.
And some IDE will help you understand the intricacies of govnokod. Personally, for example, I use phpStorm. In addition to the free trial version, JetBrains provide free licenses for authors of OpenSource projects. The most useful functions when learning new code are Alt-F7 - “Found Usages” (find all places where this variable / constant / function / etc is used), Ctrl-B - “Declarations” (go to the place where the variable / constant is declared / functions / etc) and Ctrl-Alt-F - “Found in path” (global search for a string in the entire project).
In general, an IDE (not necessarily phpStorm) greatly helps in the initial development of the language. Syntax highlighting, an indication of syntax errors and possible logical errors in the code, automatic formatting - all this greatly facilitates familiarity with the code. The confusion file with broken formatting can be easily reduced to a neat, readable look by using the built-in Ctrl-Alt-L - “Reformat code ...” function.
And here it can help if you already have some adjacent skills.
Can you draw pictures? SUMPTUOUSLY! You can make a unique game “out of the box”! It’s enough to put the standard engine, replace some of the pictures with the ones you painted, and this will already give an influx of players. Because let it be a “regular ogame-clone”, but the appearance will attract attention for the time being, for the time being mask the complete standard of the game. Meet - on clothes. True, they are escorted - wisely, so sooner or later you will have to switch to working with code. But this will not be so painful, since you have already done some work replacing the pictures in the game (which, by the way, can be very nontrivial in some projects!)
Know how to typeset? It's almost as cool as drawing skills! You can give your game an appearance by simply manipulating the standard blocks in the templates. Moreover, you can take the standard game template and remake it for mobile users, which will immediately give you +100 new players! All the engines I've seen sin that playing games based on them from mobile phones is either very inconvenient or impossible at all (for example, due to too active use of the mouseover, mouseenter and mouseleave events, or right-click) .
Do you know how to CEO? Well, then it is not clear why you are reading this text at all. You yourself know how to cut money on clones of other people's sites.
Cactus Three - NO FREE TIME
Be prepared for the fact that at first you simply will not have free time. Work-food-dream-browser - this will be your cycle for the first few months until you get at least basic knowledge and skills. At what time will be spent not only and not so much on the modification and development of the code itself, but on related actions: tuning and optimizing the OS; tuning and getting used to the work environment; deployment, configuration and moderation of the forum; game moderation; promotion of the game - all this, I remind you, you will probably have to do it alone.
If you are working on your browser and you have free time, either you are not working / studying anywhere, or you are doing something wrong and are not putting the necessary amount of effort into the game.
The fourth cactus - MEDIUM-GRATITUDE “GRATITUDE” OF PLAYERS
I note - "ingratitude" is not in vain quoted. As practice shows, most of the players are normal and adequate. And usually you will not even notice their presence, except for a change in the number of online. However, inadequate cases are also sometimes found. And this fly in the ointment that will spoil the barrel of honey. It is very difficult to remember that the bulk of your players like everything when in a chat appears inadequate and starts throwing feces left and right.
For your own moral health, I recommend that you do not enter into correspondence with such inadequacies and block them immediately. You’ll be healthier. However, in more detail on communication with users I plan to tell in one of the following articles. In the meantime, you should remember: the most important value of a novice admin browser is his mental health and self-confidence. You and so will have reasons and reasons for disappointment and frustration to add to this list of communication with inadequacies.
And again, almost 17 kb of text was imperceptibly typed. Therefore, on this major note we finish this article.
Continuation: habrahabr.ru/post/257165
Frankly, I planned to limit myself to one short article, in which I was going to briefly list the difficulties in the way of anyone who wants to have their own server in the farm with a browser game on the OpenSource engine. However, it suddenly turned out that all I wanted to say was simply not interfering with one article of a reasonable size. Well, then it will be several articles. Now you can not try to push everything into one post and analyze in detail all the rakes in the path of the future administrator of the browser.
The first article of the series unexpectedly even for me turned into general recommendations about the behavior of the Server Administrator. But now it’s obvious that this is a run ahead of the engine. Before someone decides to install a browser and shut down the admin, he must answer his main Question. And this question sounds like this: “WHY ?!”
But before giving possible answers to this question, I would like to clarify for whom this series of articles is intended.
As you know, it is better to be rich and healthy than the poor and sick. In our case, it is better to have money for development and promotion and / or to have our own experience in this field. If you recognize yourself in this description, then these articles are not for you. Really - if you have money for development, then why do you mess with free engines? It’s easier to hire professional professionals who will do this job better, faster and, as a result, with less hemorrhoids. How to act in such cases, described in dozens and hundreds of excellent articles on the same here, on Habré. Look and read them.
If you have experience in developing browsers, then again, you do not need to read this article. You yourself can quickly and beautifully write your own engine, and then sell it to a publisher or cooperate with a promotion specialist.
If you have experience in promoting network projects, you don’t need to get involved with the development, installation and support of your engine. It’s easier for you to find an already more or less working server and offer your services to the administrator for a share in revenue. If you are a really good specialist, then any administrator will gladly seize on the chance to increase the attendance of his server and his income.
Now that we have cut off the "rich and healthy," only the "poor and sick" remain. Those who have neither money nor skills, but only have a burning desire to become the administrator of their server. And now you can try to answer the question asked above: "Well, why do you need all this?"
I really do not want to dispel the dreams and hopes of future administrators, already mentally managing servers with thousands of registrations and hundreds of online. But reality is sad and cruel. For the first few months (or even years), you can’t offer the players ANYTHING:
- You are using any of the ready-made engines - which means that numerous variations of such servers are already scattered across the network;
- You still do not have any skills to somehow isolate your server from hundreds of similar ones;
- You do not have money to hire at least any specialists - that’s all, i.e. ABSOLUTELY ALL you have to do yourself! Starting from the configuration of the operating system and ending with the administration of the forum (which, incidentally, will also have to be deployed to you) and in-game chat;
- You don’t even have money for promotion and advertising - so even you have to do it yourself. You will have to study the CEO to stand out from the host of identical clones with at least meta tags. You will have to register in dozens of directories yourself in order to get at least some number of registrations and at least some online. You will have to search for thematic forums yourself and advertise your game - where it is not prohibited by the rules.
Still have a desire to launch your browser? Then answer yourself the question “Why?”. Just be honest even with yourself! There are a lot of possible answers to this question. I will try to consider only a few of them - and explain why they are poorly suited as a reason to launch my own browser. So ... The
answer is no - MONEY
As mentioned in the previous article, there is no fish here. At least some kind of exhaust can be expected only with serious investments of forces and / or means. And often - both of them. But even so, at least “to zero” the browser will not be released very soon.
The first answer is - CLEAR YOUR FREQUENCY
There is absolutely nothing wrong with that. As a motivator, scratching the FWM will probably be stronger than even the desire for profit. But I say right away - it’s not worth it. You can scratch the ChSV in easier ways. For example - to find an already open server with the same "poor and sick" admin and ask for moderators. Costs and responsibilities - minimum, profit and size of FWM - at the achievable maximum, given the complete lack of skills and money.
The second answer - LEARN
Do you want to learn a new language - say PHP, which most browsers are written in - and couldn’t come up with anything better than learning it using the free engine code? Really! There are much better and painless ways to learn PHP! The network has a huge number of training courses with examples for any level of difficulty - starting with "Hello World!" and ending with examples of creating a simple game from scratch. With detailed explanations of each step, commented code, a community ready to answer your questions. In general, virtually any other way to learn a new language is BETTER than delving into the shit in the next free browser.
And I know what I'm talking about - the code of literally every ogame-like clone engine I’ve looked at varies in quality from "monstrous" to "very bad." Including even my SuperNova code. There are objective reasons for this. Very rarely, the entire lifetime of the engine, its code is written by the same command. As a rule, the code of a free engine represents a hodgepodge of fragments written by different people with different levels of experience and different approaches to writing software. All these different pieces are somehow docked together. The database structure is usually terrible. There are no foreign keys and even important indexes in the tables, records are not standardized, the data in often duplicate each other, and for the same data several different tables are used simply because different pieces of code were written by different people at different times.
But even if the engine was developed by one person / one team, then here you are not immune from a miscellaneous code. The fact is that it is human nature to learn. New techniques are being developed, new practices are added, the arsenal of funds is expanding. Yes, and as it is finalized, the engine grows and develops and provides more and more tools for standard actions. And what a year ago seemed to the programmer to be the pinnacle of skill (and it was them, judging objectively) in a year will only cause a nervous smile and a sense of awkwardness. Yes, of course - if you initially planned the architecture of the game, painted the database structure and clearly followed your plans, then all this could have been avoided. Only, alas, people who can do this have long been working either for themselves or for "uncle." And free engines are written by enthusiasts.
The third answer - MAKE YOURSELF
I have to disappoint here too - at first most of the time you will understand terrible someone else’s code just so that you can move on to the smaller part - fixing someone else’s mistakes. Almost any free engine contains: an almost complete lack of verification of input parameters for type compliance and correctness; direct insertion of data from the user into the table without escaping - the path to SQL-injection; direct data output from users both in HTML code (the path to the appearance of virus and malicious scripts in your browser) and in JS code (at best making your scripts inoperative, and at worst - allowing you to execute hostile code on the page); direct recording of data into database tables with complete ignoring of competitiveness - and this is a direct path to deadlocks, race condition situations, loss of units, resources and other game nishtyaks. And this is just the tip of the iceberg! Few engines make full-fledged “type-system-data” checks, and trust the data from the browser too much - which in the long run gives malicious players the opportunity to appropriate resources or even manipulate other people's accounts. And I haven’t mentioned the wrong choice of data types in the database yet, when after a couple of years of work the top players have an overflow of fields in the tables with all the accompanying elusive glitches, or an incorrectly selected internal data storage format - when line 070 when converting to a number suddenly becomes number 56.
And even when you close the main holes and correct the most egregious glitches, the curse of the INHERITED CODE will always prevail over you. Any of your attempts to do something of your own, new and interesting, will come across the fact that with the current code and the current database structure it will simply be IMPOSSIBLE without rewriting a noticeable piece of the game. Or when fixing a glitch in one place leads to the appearance of a completely different glitch in a seemingly unconnected section of code - simply because the old glitch was already taken into account and corrected by someone else in its fragment.
Really - if you just want to participate in the development and do something your own - join any existing project. Even if you are not accepted into the team (and who needs you without skills and money?), Then at least you can try to write some kind of mod and get advice and help on the project forum.
Still want to install your browser? Well, mice! Welcome to the country of hard and prickly cacti! Here are just a few plants that you will have to completely chew on your way.
Cactus One - LONELY
I wrote this above, but I emphasize once again - get ready for the fact that you have to do everything yourself. Starting from configuring the server for the game and ending with the layout of the pages and even drawing pictures for the game. Or at least to redoing free pictures from an Internet. If you have a familiar admin who will help you set up your server, a familiar layout who will help you make up pages, or a familiar artist who will draw pictures for you - you are very, just incredibly lucky!
However, immediately tune in to the fact that this help is temporary and / or episodic. You can only answer for your desire to make the Ideal Browser, and only you have an incentive to continue working on it. If one of those with whom you started the project has cooled down over time - do not blame him. Say "thank you!" for the work done and continue on without him. If someone helped you out as a friend, you should not consider him your debtor and count on the fact that you can use his skills always and without restrictions. If possible, carefully observe what and how your friend was doing so that the next time he would repeat these actions himself, and seek help only in extreme cases. If you do everything right, then you will have to seek help less and less,
Cactus Two - LACK OF SKILLS
At first, any action will raise a bunch of questions. At first it will not be clear even where to start and what to grab. This is normal. This is to be expected and is to be prepared in advance. At the very beginning, you will not only have skills, but you won’t even know where to find answers to your questions and even sometimes you won’t understand how to formulate the question. As they say - read the docks, they rule. Sometimes free engines contain the simplest instructions for installing the game in the standard / basic configuration.
Often on the forums you can find answers to the most frequently asked questions. But remember that the question on the forum is the expense of a “help loan." Just because you downloaded the engine and wanted to install it does not make the author of the engine something indebted to you! Therefore, avoid spending your credit on general questions like “How to install MySQL?” or "How to configure PHP?". Such answers are easier to find in Google - with a huge degree of probability there is already the right answer, which was given for a case similar to yours or very close.
It also makes no sense to ask questions on the forum on the forum - in Google there are answers to all your questions - usually much more, better and in more detail than they will be answered on the forum. Even the questions on the engine are best answered independently. In the end, your engine will be OpenSource, and the ideal code documentation is the code itself.
And some IDE will help you understand the intricacies of govnokod. Personally, for example, I use phpStorm. In addition to the free trial version, JetBrains provide free licenses for authors of OpenSource projects. The most useful functions when learning new code are Alt-F7 - “Found Usages” (find all places where this variable / constant / function / etc is used), Ctrl-B - “Declarations” (go to the place where the variable / constant is declared / functions / etc) and Ctrl-Alt-F - “Found in path” (global search for a string in the entire project).
In general, an IDE (not necessarily phpStorm) greatly helps in the initial development of the language. Syntax highlighting, an indication of syntax errors and possible logical errors in the code, automatic formatting - all this greatly facilitates familiarity with the code. The confusion file with broken formatting can be easily reduced to a neat, readable look by using the built-in Ctrl-Alt-L - “Reformat code ...” function.
And here it can help if you already have some adjacent skills.
Can you draw pictures? SUMPTUOUSLY! You can make a unique game “out of the box”! It’s enough to put the standard engine, replace some of the pictures with the ones you painted, and this will already give an influx of players. Because let it be a “regular ogame-clone”, but the appearance will attract attention for the time being, for the time being mask the complete standard of the game. Meet - on clothes. True, they are escorted - wisely, so sooner or later you will have to switch to working with code. But this will not be so painful, since you have already done some work replacing the pictures in the game (which, by the way, can be very nontrivial in some projects!)
Know how to typeset? It's almost as cool as drawing skills! You can give your game an appearance by simply manipulating the standard blocks in the templates. Moreover, you can take the standard game template and remake it for mobile users, which will immediately give you +100 new players! All the engines I've seen sin that playing games based on them from mobile phones is either very inconvenient or impossible at all (for example, due to too active use of the mouseover, mouseenter and mouseleave events, or right-click) .
Do you know how to CEO? Well, then it is not clear why you are reading this text at all. You yourself know how to cut money on clones of other people's sites.
Cactus Three - NO FREE TIME
Be prepared for the fact that at first you simply will not have free time. Work-food-dream-browser - this will be your cycle for the first few months until you get at least basic knowledge and skills. At what time will be spent not only and not so much on the modification and development of the code itself, but on related actions: tuning and optimizing the OS; tuning and getting used to the work environment; deployment, configuration and moderation of the forum; game moderation; promotion of the game - all this, I remind you, you will probably have to do it alone.
If you are working on your browser and you have free time, either you are not working / studying anywhere, or you are doing something wrong and are not putting the necessary amount of effort into the game.
The fourth cactus - MEDIUM-GRATITUDE “GRATITUDE” OF PLAYERS
I note - "ingratitude" is not in vain quoted. As practice shows, most of the players are normal and adequate. And usually you will not even notice their presence, except for a change in the number of online. However, inadequate cases are also sometimes found. And this fly in the ointment that will spoil the barrel of honey. It is very difficult to remember that the bulk of your players like everything when in a chat appears inadequate and starts throwing feces left and right.
For your own moral health, I recommend that you do not enter into correspondence with such inadequacies and block them immediately. You’ll be healthier. However, in more detail on communication with users I plan to tell in one of the following articles. In the meantime, you should remember: the most important value of a novice admin browser is his mental health and self-confidence. You and so will have reasons and reasons for disappointment and frustration to add to this list of communication with inadequacies.
And again, almost 17 kb of text was imperceptibly typed. Therefore, on this major note we finish this article.
Continuation: habrahabr.ru/post/257165