Simple 2D racing in space under Tizen or How to win the Tizen Association hackathon

    FriedCroc Tizen Hackathon

    Last weekend in Moscow on Bersenevskaya Embankment, a hackathon organized by Intel, Samsung and FRUCT was held at Lightbox Studio Red October, dedicated to developing applications for the Tizen platform.

    Our young (but very promising!) FriedCroc team took part in this wonderful event. Yes, and not just accepted, but also won first place! We decided to talk about this community, share our experience and lay out the sources of our prototype.

    Our project


    Why 2D racing in space? Some time ago, we posted several games in the AppStore. One of them is devoted to rabbits that steal carrots from farmland. And since rabbits are not only valuable fur, they were safely launched into space to collect carrots there and dodge asteroids. As a result, everyone is busy with his own business: Samsung launches Tizen for earthlings, and FriedCroc launches rabbits into space.

    As befits any hackathon participant, we had ambitious plans. We wanted to make a race with an opponent, upgrade missiles, pick-up boosts and the like interesting things. Of course, we will make them before putting the toy in the Tizen Store, but the prototype does not have all this fun. We did not even have time to make sound effects, although we planned.

    Tizen


    Our acquaintance with the Tizen platform did not happen at the hackathon itself, but a week before it, at the final of the MDDay hackathon in Yakhroma, where we also participated (but, to our disappointment, won nothing). The Tizen platform is still damp and far from perfect, and we had the pleasure of stepping on some rakes in Yakhroma. Fortunately, Samsung sends great mentors to every event, who are ready to solve developers' problems for days on end. These guys do not give up until they find a solution, for which many thanks to them. But the problems were decent: the emulator didn’t start, one of the test devices didn’t work (I had to reflash it), there were difficulties with setting up the project. As a result, we spent about 4 hours solving these problems. But to the hackathon in Red October we have already come fully armed.

    So, we were a little familiar with the platform. We already had test devices (we got hold of them in Yakhroma, and it’s completely free: it only took to sign an obligation not to sell these devices). It would seem, what other difficulties may arise?

    Eclipse vs CLI


    The Tizen SDK uses Eclipse as a development environment. They explain this by the fact that it’s easy for Eclipse to write plugins.

    All FriedCroc programmers had experience working with Eclipse, and all of us, without exception, are sick of it. Basically - because of its buggy (which is worth only "hanging" markers of syntax errors in files that are treated solely by restarting the environment).

    That is why when we learned that the Tizen SDK has utilities for working with projects from the command line, we definitely decided to develop using these utilities. However, as it turned out, console tools are pretty raw. For example, the Makefile that these utilities generate requires the location of all the sources in one directory and does not support subdirectories. In addition, there is practically no documentation on this method of assembly: it is not clear how to add compiler flags, how to specify a directory with source codes, etc.

    As a result, we still used Eclipse-projects: they support subdirectories, allow you to set define'y and other flags of the compiler and can still do a lot of things that console utilities can not.

    C ++ 11


    We write games in C ++. Moreover, we write games in C ++ 11. The latest version of the language has a bunch of goodies that reduce the amount of code and speed up development. Moreover, it’s already 2014 and all mainstream compilers have already pulled themselves up to at least 80% support for this standard.

    To our great disappointment, the Tizen SDK contains a very old version of GCC and libstdc ++ (4.5), so it doesn't even smell like normal C ++ 11 support. For this reason, in Yakhroma, we wrote our project in C ++ 98.

    Naturally, we were not going to put up with this state of affairs, so we began to look for a way to compile C ++ 11 code under Tizen. First of all, we are fortunate that the Tizen SDK also includes the clang compiler. And although he is also very ancient, he still understands C ++ 11, even if it falls periodically into the crust. The problem of the lack of support for C ++ 11 at the library level (in the Tizen SDK the old libstdc ++) we solved very simply: we took the fresh libc ++ sources from clang and put them in our project. After making some small changes and adding a couple of define'ov to the project, libc ++ got together safely, which we were extremely happy about.

    image

    image

    image

    By the way, for the code to be built in C ++ 11 mode, the compiler needs to add the –std = c ++ 11 flag. Unfortunately, if you edit the list of compiler flags in Eclipse, it will be overwritten during the next build (Samsung engineers, take note!). As a result, I had to use the “Other optimization flags” field, which, in general, is intended for other purposes. But on the other hand, it is not overwritten during assembly and the flag reaches the compiler.

    image

    Enough about Tizen, let's talk about the project.


    We used Box2D for physics. The project has debug draw (which is disabled only in the release build). Do not be surprised that the boat has four "wheels" - we took as a basis some kind of sample from the Internet, there were cars.

    Management is made very simple: the screen is divided vertically into three parts; pressing on the left side makes a left turn, on the right - right, and the central part is not used.

    It is worth noting here that we really liked the idea implemented in Angry Birds Go, when the machine “tries” to go in the right direction even if the player does not control it. Therefore, in our toy, the boat also tries to follow the route, although not very successfully, if it is not helped.

    We draw the picture with the usual OpenGL ES 2.0. We are not even trying to discard invisible geometry (this is a hackathon, after all). Fortunately, the test device copes with this inefficient code and produces playable FPS.

    By the way, here are screenshots of what we got:

    Screen shot 1Screenshothot 2

    With debug rendering:

    Screen shot 3Screen shot 4

    Level editor


    Levels in the game are described by a simple XML file. In order not to write it by hand, as part of the hackathon, we wrote a very simple level editor in Groovy. We will not publish its sources for now, but if you are suddenly very interested, write, we’ll come up with something.

    Resource Files


    We did not manage to deal with the resource mechanism in Tizen. In order not to take risks (time on the hackathon is very limited), we wrote a small tool that distills resource files into C ++ arrays.

    Source code


    The source for the game is available on github: github.com/friedcroc/tizen_spacerace under a very liberal license (MIT), so use it. The code there is sometimes Hackathon's (minimum optimizations, a bunch of some hard-coded parameters and the like disgraces), but it is quite readable. Pictures are replaced by simplified black and white, do not be offended.

    Once again a little about us


    We are young, progressive, promising and just cool! We really like to make games, which we are doing and doing successfully. Sometimes we also do mobile applications.

    If you want to get acquainted with our games in the AppStore, links to them can be found on our website. And what is our site, I hope you can guess.

    For sim let me take my leave, thank you all for your attention!

    Also popular now: