📜 ⬆️ ⬇️

Dev Story: Raildale - a game about the railway for iOS and Mac

Raildale icon I am the developer of the game Raildale , and in this article I will tell you the history of the development. But first, I will say a few words about the game itself. On the field appear multicolored cities that need to be connected by rail. Trains leave the cities, and they need to be sent to the city of the appropriate color, using arrows and traffic lights and avoiding collisions. There are also various additional features: repair trains, express trains and others. In my opinion, the game was very interesting, and so far I have received only positive feedbacks. The game is not easy and it's really difficult to pass Raildale is available for iOS and Mac OS X on the App Store.

image
More information about the game can be found at www.raildale.com .

Prehistory

2 years ago (autumn 2012) I worked as a programmer and at that time worked in enterprise management systems for 10 years. Such systems have one common feature: these projects never end. I liked the job, the project and tasks were interesting, but for 10 years I was tired of this area. In addition, we wanted more freedom in making technological and interface decisions.

Therefore, I thought about the implementation of my project. I was thinking about developing an application or a game for iOS. In the end I decided to make a game. This is as far as possible from what I did before, and therefore it is very interesting. Of course, the project should not have been very large, since I had no experience in game development or marketing.
')
I had a lot of ideas, but I stopped my choice on trains. This was the game that I would love to play myself. Frankly, the idea is not new, as a child I played a similar game. I expected to find something similar under the iPad, but everything that I did not like at all. So I decided that this is a great option for the first project.

In general, I decided to quit and take up my project. My salary was good, so there were some savings. Therefore, finances did not prevail and it was possible to work quietly for some time without profit, especially as the wife continued to work. But when the conversation about dismissal came, the management suggested some interesting problems for me, and I decided to stay for a while. As a result, I quit only in June 2013. All this time I have been developing the game a little bit in parallel with the work in my free time, but I could not spend much time on it. Then in July, I went to Iceland for another 3 weeks. So in full, I only plunged into work in August 2013.

2D

Initially, I developed the game in 2D in an isometric view . I used Cocos2D - the most common engine for 2D games under iOS today. I can not say that I liked him. The main problem is that he uses the sprite model. And this virtually eliminates the division of the game into layers (model, controller, presentation) and makes it impossible to isolate the state. I didn’t work with him to get a code that I liked. All the time, a self-terminating code was obtained. I tried to find analogues, but everything that I found was built on the same principle. But Cocos2D still has good documentation and an active community, which is definitely a plus.

For development I used JetBrains AppCode . XCode is also a good IDE, but it's hard for me to compare, I used IDEA before and got used to a lot. I can say for sure that the debugger is much more convenient in AppCode. True, XCode has a great tool for debugging drawing in OpenGL. She can display all the operations of a single frame, which is sometimes very convenient, even trying to suggest something. So, you could say I used Xcode too.

After a while, I realized that Objective – C annoys me. There are many reasons, I wrote an article about it. Of course, not everyone agrees with me, but my methods of developing Objective-C are definitely not very well suited, although there are interesting ideas in Objective-C. Therefore, I developed my language in parallel with the development of the game and called it Objective – D. I wrote about this a separate article on Habré .

For drawing sprites, I used Sketch - a vector editor for Mac. A good overall program, a bit buggy, really. Moreover, for some reason there is no possibility to upload the result to an arbitrary resolution. Only in the one in which is drawn or 2 times more for the retina. What is very strange and inconvenient, especially for the icon: you have to copy and reduce manually. And another drawback - the unreasonably large file size, which is inconvenient when working with VCS .

I ran into the problem of train turns. To do this, you have to draw cabins at every angle, which took a lot of time. And the result was not very good - the train was twitching. To avoid this effect, it was necessary to draw a lot of angles. Then I got the idea to use a 3D editor for this. I chose Cheetah3D , bought a model van for a couple of dollars, set the camera angles as in an isometric view, set up the light. I rotated the trailer around my axis and took pictures. It turned out much faster than drawing, but a satisfactory result was achieved only with a very large number of rotation angles. Therefore, the file with these angles was enormous, especially for retina. With such a file, my iPad coped badly - everything frankly braked.

3D


image
I decided to try to abandon 2D and go to 3D. Moreover, I have already met a bit with the 3D editor. I began to look for an engine for 3D and probably the most obvious choice would be Unity3D . There is a lot of documentation on it and it is mostly praised. But I did not like the fact that there are a lot of operations done in the constructor, but I wanted to write code.

I tried Cocos3D - Cocos2D extension to 3D, but I didn’t like this library at all. The same problems as Cocos2D, plus the almost complete lack of documentation. As a result, I did not find a single engine that would fit me, and decided to just try OpenGL.

I suffered a little in order to achieve the output of the triangle and the screen cycle. He began to develop the game, at the same time highlighting the common library for future games. The main idea is the separation of code into layers and isolation of variable data. Thus, almost all changeable data is isolated in the controller layer, and the display layer contains only pure drawing functions. In the display layer, mutable data is allowed, which is required only for caching or animation. I covered the controller layer with automatic tests. As a result, I was satisfied with the quality of the game code, I am pleased to refine something there and I want to improve the game. When the code is bad, such a desire does not usually arise.

In the beginning, I found not very successful OpenGL tutorials. They used things like stack matrices, for example. When I got to write the shaders, it turned out that the matrices in the shader are not transmitted, and indeed all this has long been outdated, like so much more. I had almost everything that I did before this remake into modern manners. So it is important to immediately find the right guide. I would recommend this .

Initially, I developed it just for Mac, it's easier to test: you don't need to connect the device to a computer. It is useless to check the game emulator at all - it is terribly slow. When something began to emerge, I decided to try to transfer to iOS. The main problem was that the shader language in OpenGL ES is slightly different from the usual. But I managed pretty quickly.

The game has a fairly simple lighting model - one global directional light source (the sun). I did not have any shadows at first, and I decided that it would be great to add them. For this, I used shadow maps . It was not very difficult for my lighting, but the shadow map eats up a lot of resources, since you have to draw many things twice. The game began to slow down, and I started optimizing.

Apple's tools are pretty good at this: there is a special tool that shows you possible problems and suggests how to solve them. Very useful tool for the novice developer OpenGL. For example, for me it was a discovery that you should not call OpenGL functions that change states with the same parameters. They are directly transmitted to the graphics processor, without checking whether this state is the same as the current one. So you need to do this check yourself. Oddly enough, this small change greatly improved performance. In addition, Vertex Array Object (VAO) has greatly improved the situation.

To revive the pictures added to the game wind, rain and snow. Wind tends trees, demolishing the smoke of trains and precipitation. The main direction and strength of the wind does not change during the level, but occasionally gusts of wind occur. The loudness of the sound of the wind varies depending on the strength. In addition, also to revitalize, added the sounds of birds. They differ for different locations and weather, they are reproduced at a random time with an average frequency specified for a particular sound.

I screwed the Bullet physics engine in order to simulate the scattering of trailers in a collision. The first results turned out to be quite boring - the trailers just got off the rails. Then I decided to apply the effect that is often used in films to enhance the entertainment: I threw the carriages into the air at the moment of the collision and gave them a random rotation. In my opinion, it turned out great.
image

Completion

My wife was testing the game. For her, testing was not a novelty - she has been developing software and testing she has had a lot to do before. She was able to identify many problems and shortcomings. She completed the game on three different devices, which I have not yet managed. I was stuck on the 15th of 16 levels, but sooner or later I still expect to go through it. Oddly enough, I myself am interested in playing Raildale. Honestly, I thought that by the end of the development I would have no desire to play.

Closer to readiness, I posted a version on TestFlight for organizing beta testing. Great service and amazing free. I built their SDK, which allows you to set control points to understand where the testers went. It also collects crash reports, including those already on the working version. This is very useful, as these reports should seem to appear in iTunesConnect, but it works very strange and they are not always there. I can not say, however, that beta testing is very successful. I posted a test proposal on the forums. People responded, but their goal was mostly not testing, but just playing. Therefore, I did not receive the bug reports, but at least I played on different devices, and the game did not fall.

When the game was already close to readiness, I ordered a transfer to One Hour Translation . I liked the service: I did not find it quickly, conveniently and cheaper. True, it's hard for me to say about the quality of the translation. You can order very small texts. I added a 5-word phrase later. The price is determined only by the number of words. I ordered translations from English to Brazilian Portuguese, French, German, Italian, Spanish, Japanese, Korean and Chinese Simplified. I translated myself into English and ordered proofing , that is, my text was checked by an English-speaking person. It turns out about 7 times cheaper than translation, and more qualitative, I think. So a good way, if you speak English well.

There was a small problem with localization. For text output, I used bitmap fonts. That is, there is a picture with letters and a file in which it is written where the letter in this picture is located. But this method is not suitable for Asian languages. So I had to quickly change the text output system and first draw the texture with the letters using iOS methods.

In general, localization was not a quick process. iTunesConnect is very inconvenient and works unhurriedly. It seems to be a simple task to translate the name of the boards in GameCenter turns into torture. But I managed to find a solution - iTunesConnect Transporter. It allows you to write everything that is in iTunesConnect, in the xml file and download it along with screenshots. It saved me.

During development, I recorded how much time and what I spent. At the time of this writing:


This is my first game, so you could spend less time on everything. About marketing, for example, I was forced to read a lot of information, try something that does not make sense. Anyway, I can not understand how it happened so much time. When you do marketing, time is running out, but it seems that you didn’t do anything.

Aprouv took 2 days for Mac version and 5 days for iOS. At the moment the price is $ 1.99. 15 promotional codes for the iOS version can be obtained here . It would be very interesting to know your opinion. I'm going to improve the game and therefore I would like to hear that you would improve in the game, what you liked, what you did not.

I know that on Habré like to read also about application marketing. Of course, it is interesting to get an idea of ​​the profits, to learn from the mistakes of others and successes. But now it is a bit early to talk about it, since the game was released quite recently. I think conclusions can be made in about a month.

Download Raildale here .

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


All Articles