The creation of the space browser game. The first experience

In this article we will focus on the first experience of creating a space browser game. About the initial steps, first results, about mistakes and most interesting challenges of development, which had to face. We will be glad if readers of Habra will find this article interesting for yourself information.

introduction


Earlier, in the last 2 years, there were attempts to launch some browser games on a small scale, which were collected less than 1000 players, but in this article we will not touch. The story will focus on the first experience of creating browser-based online game, which in the future will seek to reach the masses.

The idea of creating a space game was born long ago. Why the space? Partly because space has always aroused my personal interest, and partly because of nostalgic memories from the pleasant pastime in "Space Rangers" when in the distant past...


what should I write?


Since the main view of my activity is web development, the choice fell on HTML+JavaScript in the client side, and PHP+MySQL in server. Perhaps this question is the subject of endless discussions, however, then the story will focus on the development of these languages. Of course, the Flash part of the animation is much more efficient than JavaScript, but Flash wasn't chosen purely because of lack of knowledge in ActionScript.

The server part was written from scratch — probably not the wisest decision, but I wanted to go all the way with a clean page index.php writing your own game engine.

development Process


So, it's a start. Invented and written a brief history of the game world, a story about the distant future of humanity, the Federation as the dominant authority, wars, corporations for planetary resources and Sarah extremely hostile advanced civilization from outer space. Developed the idea of the gameplay, the basic functionality and principles of the game.

Genre

All conceived ideas good fit in creating epic online game with elements of RPG, strategy, text quest and arcade. Implementation issues for the main game interface was solved for about two weeks. During this time: 7 models, 4 design options.

Interface

As planned, I wanted to create a game that requires players of a certain mental costs (by the way, until now, this goal is not considered achieved, and we're working on it). That is why the main task was the creation of the interface the most intuitive and the least crowded.

In the course of work on the design, has been viewed a lot of browser space games. It became obvious that the most successful of these games, with a carefully considered interface. And now, the main points that were taken over the rule:

the
    the
  • Where possible, texts should be replaced with icons. Visual symbols have always been perceived easier;
  • the
  • to not display various kinds of information over the locations outside of the designated blocks (to remove the chat, notifications, clarifications, assignments, and withdraw only in cases of extreme demand) — in General, to unload the work window, however, leave the possibility of transition to the necessary information one or two clicks;
  • the
  • trivial, but important: this is a legible font and appropriate color scheme;


The result is this:

image

Introduction located in the upper part of the screen (player level, rank, money, fuel, cargo Bay), as well as basic navigation buttons (profile info, events, diplomacy, etc.). Game settings and reference information is in the lower right corner.

However, since the game takes place not only in space, was required to make a convenient transition between locations. It was therefore invented center button. Through it is returning "one level above" the logic of the takeoff of a spaceship from the planet up into space (if we are in prison — when you click on the center button, return to the surface of the planet, from the planet — star system to star system in free space). The logic of action of the center button down as shown in figure below:
image


In certain locations there are additional blocks, top or right, depending on which part of the screen used for the main gameplay:

image

image

Looking ahead, it is worth noting that after launching the alpha test of the game, no complaints in terms of ease of interface from players were reported, and the logs said that the players are well oriented in the basics of management.

So, even though we don't have a staff of professional game designers and artists, minimal forces we have managed to create an acceptable interface, which later turned out to be very clear to the players.

coding

The first version was written about 4 months. Knowing that eventually the game will evolve, functionality — to expand and, consequently, to increase the amount of code needed to define its architecture. It turned out to be not so easy in view of the fact that:

the
    the
  • is constantly coming up with new ideas and therefore new, more rational methods of implementation of those ideas;
  • the
  • the current code is optimized and is appended, which often entails the processing and restructuring of the entire file, and then some (just to everywhere to have a single logic, and in the future not to get lost);


This applies, in fact, to any project, however, as practice has shown, the development of game this problem manifests itself most acutely.

On this basis, the decision was fairly simple:

All customer requests are handled via a single file req.php which depending on the receive a GET request, connects and executes the necessary scripts. The scripts themselves are in a conventional folder data/ and named for the principle to its direct purpose: planets.dat solars.dat colonies.dat ships.dat, users.dat etc. Inside these files describe the classes and functions divided into three major assignments:

    the
  1. data Output to the player
  2. the
  3. Create/modify/delete data
  4. the
  5. other General functions of the engine (validation, caching, etc)


This approach allowed to minimize the difficulties in processing the structure of the code because of the expansion of gaming opportunities: expand the capabilities of the ships open ships.dat, add new types of planets — planets open.dat. All changes generally execute within one or two files, so you don't forget anything.

Read more about the technical aspects of development, I'd be happy to tell in the following articles. And now let's move on...

Launch project


So, the pilot version is ready. The next question is where to start the project? This question, of course, was still relevant at the stage of early development. Really special you can do there — either it is an independent browser game, or this app in one of the social networks.

Realizing that the budget tends to zero, and the is game need considerable investments, it was decided to use the platform where you can get a good starting audience of players, and preferably free.

The choice fell on Vkontakte. "Contact" - hosted Apps offers games a good start, and a fairly loyal audience who are ready to take part in the testing and development of the game, and willing to ignore some flaws and bugs.

To get to the app catalog, it took:

the
    the
  • explore API Vkontakte to implement some social features (logging in, inviting friends, ratings);
  • the
  • rent a server. Was originally leased mediocre KVM VPS CPU Intel Xeon (4 CPU) with 4GB RAM and SSD disk;
  • the
  • to buy and mount your SSL certificate (for free can be purchased at startssl.com);
  • the
  • apply for moderation;

  • And now, two days after the filing of the application, the moderator approved the application and it appeared in the catalog.

    App in the application catalog Vkontakte

    In itself, the listing is not particularly leading players, but after a week the app has already played a few people.

    Statistics applications. The first visitors

    The situation changed radically when the app hit the block "New".

    Statistics of the application after entering the New block apps

    For the first day the app came about 6,000 people. In the future — less, but the flow was quite large. Within a week of placing the application installed about 15,000 people (meaning those who haven't deleted the app after installation).

    the First serious problems


    Fell server

    In the first place, because load database. In principle, it was expected, therefore, had to double server capacity (up to 4 Intel Xeon CPU and 4 GB of RAM). And of course, optimization, optimization and again optimization...

    Because optimization is needed to carry in record time, so as not to lose the audience, decisions are made very quickly. It was rewritten many lines of code, in particular relating to the database query. The partial load assumed CPU. Has been simplified the output data from the database: in certain places that required a comparison and selection from multiple tables, set a simple SELECT-s from each table separately, and then taken out the necessary data by comparing arrays in PHP. And all because JOIN-s require a lot of resources (as it turned out, this is not true because the speed of joins depends on how well they are optimized, but time is not there, and we decided to shift some of the load on PHP).

    Help! The application was stabilized. And though the optimization is still not the last, this problem no longer arises so acutely.

    Bugs, lots of bugs...

    The players in the game have found a variety of bugs — from the obvious to the unimaginable. It was obvious that, as the experience in creating such games is actually the first, bugs will be very much. It was. Someone wrote about the bugs in the game, someone, realizing the seriousness of the situation, he wrote personally, and someone quietly used these bugs, twirling his money, or other characteristics. With the last was the hardest, because they're not easy to track, even harder to roll back wound up to the adequate values.

    In the course of the work, bugs eliminated, the game process "podrachivala" and became more familiar and comfortable. Most of the vulnerabilities, of course, does not affect the gameplay dramatically, no one is breaking the base, not bore record, however, small gaps in the code and in the rules of the game revealed another serious problem.

    Imbalance

    This is perhaps one of the most significant problems facing a newly minted game developers.
    Balance is necessary in everything. Otherwise users are not interesting to play, either immediately or in the near future. Consider the balance in advance, at the stage of preparation for the introduction of varying features in the game.

    Our first mistake was that we did not consider one obvious fact: players spend in the game different period. And so, one of our players spent in the game about 5 hours a day. After a week, his finances grew to a nine-digit number. What was he doing? Engaged in trade. Found a planet where one resource was sold cheaper than bought another. Of course, experienced game developers will consider this point first. For us, it was a discovery.
    After that, we did read a lot of books about game balance (good information about this abound), and we realized that he needed to pay much more attention.

    What next?

    As a result of this article, I want to mention some of the most important insights that have been made since the birth of the idea to its realization:

      the
    1. game Development is an incredibly exciting experience;
    2. the
    3. Test, test and again test... In any project testing and eliminating bugs is a significant amount of time. In the game — three times more;
    4. the
    5. design of balance — one of the main tasks when creating a game that must be laid at the stage of formation of the basic game features;
    6. the Idea that "I know how to look like a game that I want to create" — is correct only partly. Active players and testers can make a meaningful contribution to the development of the game. Do not neglect communion with them, preferably starting from the earliest stage of development; the

    7. You must be entirely covered by your idea. Development will take a lot of your time. And the fewer people working on it — the more time it will take you;


    On the project work over a year (with some interruptions, because it requires personal financial investment). Has done a long way, but there is still a lot of work. Rejoicing in small accomplishments, making mistakes, we move on, what we wish everyone who read this article! In the end, it is interesting that all of this happens... :)

    I will be glad to talk in future articles about the technical details of the development, about our approach in the implementation of various aspects of the game.

    Thank you!
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

The release of the new version of the module modLivestreet 0.3.0-rc

mSearch: search + filter for MODX Revolution

Emulator data from GNSS receiver NMEA