📜 ⬆️ ⬇️

The story of creating a world map for the game “C & C Tiberium Alliances”. Postmortem

Hello! In this post I would like to share the experience of creating and developing a service for one well-known online game.

Life in it is still warm, but I think it is already possible to sum up the final results.

I learned about this game long before its release, and I was able to get into the number of first beta testers. I didn’t expect much from a browser game, but I took my interest. Pretty quickly, I found an adequate Russian-speaking community and joined one of the clans.

The first question that got up is “where am I?”. Following the canons of the genre, I suggested that I need to build a radar. But for some reason he was not. Further, I was surprised to find that the game does not provide a minimap at all. Which was very strange, considering the gigantic playing space. In addition, as it turned out, in the immediate plans of developers its creation was not included.

Having studied a little server API, I found where to get the data I needed - lists of users with their databases. For a couple of hours I wrote a parser in php. Difficulties arose only with authorization. It was a two-level, with hashes and its headers, but she succumbed. He drew a page on his knee, where he simply put the names of the players in absolute positioning, uploaded to a free hosting. Search on the map was carried out by means of the browser “ctrl + f”, exactly like scaling the map through “ctrl + mousewheel”. I shared this creation with my clan. It turned out that the card was not enough for me. Having seen her, the clan members were very happy, and the clan’s leadership “ordered” not to spread about the map outside the clan’s boundaries.
')
The next day I posted information about the map on the general game forum. For which he was expelled from the clan, but received a ton of positive feedback from the players. Inspired by such a reaction, I decided to develop the map further.

At first I tried to replace the players' names with markers from html tags, but it all looked terrible when scaling. The second attempt was to use svg, but the performance left much to be desired. There was only a canvas, and here everything was rustling much faster.

The first release on the canvas looked like this:



After the introduction of a couple of features, the number of visits to my resource reached ten thousand per day. Along with the growing number of users, more and more game servers were opened in the game. At that moment, one server (game world) parsed about an hour. It turned out that with the growth of their number, the map of each individual server was updated less and less. The relevance of the data quickly fell, users began to complain.

The introduction of curl multisocket, although it reduced the time of parsing one world in half, but could not finally solve the problem. On my luck, I was unsubscribed in a personal one of the developers. Pointing to the functions in the code that were responsible for working with the data transfer protocol, creating queries and parsing information for drawing the in-game landscape. After several experiments to minimize the number of requests, the parsing time of one server was reduced to 6 minutes.

Inspired by such good fortune, I with double zeal began to saw new features. Added the ability to draw tactical maneuvers on the map and share them, completely change the color scheme and customize the icons. And again, everything came up against the parser, when the number of worlds approached the mark of 100.


It was decided to rewrite the backend completely. The basis was taken by ZeroMQ, authorization, parsing, apload managers appeared, respectively, a set of workers for them + a system for monitoring this joy. The question remains where to seize it all. For the normal performance of the project, the cost of hosting would be just space. Search server in the gaming community did not give the desired results. I decided to buy a new hardware home with hardware-assisted virtualization. Especially since long wanted to dig deeper. I made one virtualka myself, having forwarded there a vidyuhi and part of our ports. On the rest, I picked up the system, and some of the virtual locks were linux, some of the windows. In connection with the implementation features of the binding 0mq. There were also problems with service uptime, yet not tier 4 :), but changing the provider, everything has stabilized. A heated parser with a new iron coped with hundreds of worlds in a couple of minutes.

The map took the following form:



In parallel with this, I started developing a client for android. I took my php API, ported to Java and expanded it, implemented basic functionality. At about the same time, a coder from Chicago wanted to connect to the development, to which I was quite surprised. On his shoulders lay the task to implement the player's e-mail notification of the attack or the destruction of his base. A colleague in C # wrote subscriber to the parser, which tracked all the bases of all players on all worlds.

But everything stopped in an instant. My “insider” said that EA considered the project unprofitable. Their team was disbanded and scattered over other projects. The development of the game froze. Accordingly, the development of the client and the service also ceased to be appropriate for a dead project, and I put an end to them.

At the moment, my card attendance 2.5 thousand people. Advertising revenue since July 2012 amounted to 5 thousand dollars. Donat is less than 200.

PS While hetzner was writing an article, he was suddenly offended that I was making 100kk post requests per day from the same IP and uploading 5TB of traffic per month.

Libu, who wrote to work with 0mq, can be found here: https://github.com/limitium/0MQ . If you are interested in someone, I will issue a readme and make a package for the compositor. Nothing flows, plowing 24/7 for 2 years.

The project's face can be found here: github.com/limitium/C-CTA-map-frontend

Source: https://habr.com/ru/post/226571/


All Articles