Runner for iOS with five characters

Hello, Habr!

It so happened that quite a long time I am developing for iOS, but here's the thing — I never wrote the game. After the snake in 13 years at IBM 386 came a break until 2014 when I was well enough to bring a warm tube-like dream into reality. What came out of it? The schedule was as follows:



And the gameplay we wanted to make look like this:


If interested, I ask under kat! (many pictures!)

The project is non-commercial, without purchase, advertising for free, and at the current stage looks more like a concept. Perhaps the readers of Habra familiar the second picture — one fine day I saw her in this post, Yes, my enthusiastic comments. First a few words about the schedule.

the

Graphics


I, fortunately or unfortunately, the usual programmer and draw pretty pathetic, so I had to find the artist. And what kind of budget could offer married man for his razvlekalok? Well, in retrospect, is about $1000, but of course this is not enough for a professional game artist, so after some time went on the girl, who is very good paints in watercolor, but photoshop does not see it in your eyes. We started with the background and since I always wanted to do horror, creepy trees. Scans was out (pictures are clickable):





Last scan — platform — so all reminded me of something the first StarCraft on the color scheme. And so I have this watercolor I liked that I decided not to translate it into the vector and leave as is, cut and a little podretushirovat in photoshop. As a result of the many sketches in the game there are 13 types of trees, 2 variations of platforms and 5 characters, for which it is proposed to simultaneously play a player. In the paper, it looks like this:



C the characters get more complicated. From many options kids, we chose a very long time. Initially I didn't even know how many keys was more natural, but on the screen of the iPhone place not so much as on your midi keyboard. After much experimentation they were 5. The entire list barely fit on the photo:



After just a screenshot of the winners looks like this:



All the characters were given nicknames, for example the skinny — Auschwitz. Someone called in honor of the resemblance with colleagues. Animation was difficult, Auschwitz even had to redo it (in the current version he's twitching like a paralytic, in version 1.1 dump updated). Drove all the layers in photoshop, checked the animated GIF. To the mixing and clipping one character took about 3 hours:



But the result I am very pleased. Of course, contemporary designers and animators rebuked little FPS animation — it consists of eight frames for each player — but the pictures turned out very much like the cartoons of the 20-30s of the last century:



I was immediately interested — all those dots, dashes, scuffs that appear on frames in old cartoons have appeared due to aging of the film, or the same as ours — from the random movements of the pencil on paper? They do not have the concept of post-production, the picture was probably otnimalis and glued as is. If anyone has information or suggestions, please share in the comments.
the

Programming


Initially, I developed a fully working prototype in Cocos2D+Box2D, but I didn't like some nuances:
the
    the
  • From the point of view Box2D, each player represents a parallelepiped. If I ran single player, some of the flaws and errors of calculation of physics would just be invisible, and when the synchronous running of the five players in arbitrary regions of time the distance between them is reduced to a few pixels, on the contrary increased. What was the reason, I did not understand, but found on the Internet information that such complex engines do not use the runners at least for this reason — it turns out that I'm not alone stumbled into the same trap;
  • the
  • I don't particularly like Cocos2D, because of its weak encapsulation in SpriteKit code is shorter and more understandable, due to the lack ОГРОМНОГО_ВИДА_OPENGLES3_КОНСТАНТ and other direct OpenGL calls, which I sometimes like a nightmare WinAPI — you either know it thoroughly, or smoke a lot of documentation and forums that will ultimately lead to thorough knowledge of a huge number of constants, without which life is good to me.


In the end, I rewrote everything in SpriteKit (and that have the right project of mine), and as physicists have written a primitive engine — not more than that required for 2D-runner, 100 words on it. Nothing interesting or new in it, any programmer will write the same day. But the units of measurement of the spherical vacuum turned into pixels on the second and on second squared — with such it is quite nice to work with, as opposed to abstract device for the meter :)

But the world had notably to Tinker — I originally wanted to write an infinite scroller with auto generated world that brought me a lot of pleasant and unpleasant experiences. All the layers of the visible world is generated randomly, according to certain laws, some of which (e.g., the generation algorithm of trees in the background) I can not understand until now. The code is full of magic constants of the "three root two by two", which over time has lost meaning for me — but looks cool! Probably, it would be worth to write a separate article.

I also quite cleverly made the parallax of the trees when you turn the phone in hand, they portray the 3D effect. Added invisible view, a parallax which calculates itself iOS, and on each tick of the game read Delta the coordinates, which is multiplied by the distance of the tree from the user (1 is the most remote, 0 — the melee) and stack with (X; Y) of the tree. It turns out quite nice and productive.

By the way, the performance also had a lot of trouble, but there is more inexperience — for example, the biggest brake was what I turned to UIKit element on each cycle redraws. I finally understand why in game engines have their own buttons and laslocky! And I, ignorant, did HUD on a normal iOS-oriented the controls.

the

Conclusion


Music I have an acquaintance wrote the leader of a Belarusian rap group for a nominal fee of 1 jar of grandma's adzhika, which he loves since learning at the Institute. I think she's beautiful in itself (and music, and adjika). Other sounds found by our tester Igor on drains, for which he thanks and to all who helped me in the creation of toys. I almost forgot, link., enjoy the game! I will be glad to every comment!

UPD: the link video of gameplay.
Article based on information from habrahabr.ru

Комментарии

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

Why I left Google Zurich

2000 3000 icons ready — become a sponsor! (the table of orders)

New web-interface for statistics and listen to the calls for IP PBX Asterisk