Making simple level with Blender

Dec 15, 2015

In this section we will have short but powerful introduction to Blender. We will cover just enough of model creation basics, you will need to create most of simple projects.

No, we will not cover animation, shaders or modificators here, but just enough minimum to create this ramp floor for our tutorial:

The desired result

You will find lot of keyboard shortcuts here. And this is one of the most awesome features of Blender - you can work without menus or panels! Everything you need can be done with keyboard!

So let’s dive in Blender now!

Read more

End-to-end testing with WebdriverIO

Nov 26, 2015

Small intro

Have you ever heard about end-to-end testing? Or maybe about testing automation? Those of you who had, may now be imaging Selenium. That’s right, in most of cases you will need to run Selenium Server and use Selenium Webdriver in your tests. Those come handy to run a standalone browser window, with no caches, filled-in fields or cookies and perform some operations in it.

In this article I will tell you my story of writing E2E tests for Angular webapp.

A brief of history

In my case, we first tried to use Protractor with Chai.js. That time we ended up with almost unsupportable bunch of code, succeeding in 100% of runs.

Next time we eliminated Chai and reworked all our tests to use Protractor only. So the code became more clear (I did not like the syntax, but it worked…), but after upgrading libraries (including Protractor), the ratio of successfull test runs decreased to just 40%.

We worked for two days, trying to fix those tests. And that’s how webdriverio came to our project.

And here’s a short tutorial on how to implement E2E tests with webdriverio in a sample project.

Read more

Loooong lists with Clojure

Oct 16, 2015


These days I was given a reeeeally interesting homework at the university. I was given a set of MD5 hashes, calculated from single words (taken from Libre Office’ dictionaries) with a given sault. And the task was to find all those words.

So, the first idea which came to my mind was using an internet service for MD5 breaking. But… aaarrrggghhh! There’s a sault, so the webservice, looking for words over a dictionary fails to find mines…

So the second idea was to take that dictionary from Libre Office and iterate through it. At the end, it worked =) And worked reeeally fast. But that is not an interesting part.

I wandered if I could find those words in my dictionary, generated by my own code.

Read more

Custom logging with timbre

Oct 5, 2015


At my job we recently started researching logging tools to make our RESTful API, written in Clojure, writing logs in JSON format. We were using Log4j already, but decided to use another tool for this task, making it less painful. So we felt into timbre. Is seemed so easy to use, but it is really undocumented.

According to timbre’s API, we needed to define our own appender for writing to a custom JSON file. And we found the output-fn option to configure this behaviour. But it is not documented at all, so we started looking for repositories, using timbre, examples and all the stuff. And finally, we ended up with our own solution.

Underneath you will find description of our way to use timbre from scratch.

Read more

Two sides of web application. Part 1: the tools

Sep 20, 2015


How do we usually create a web application? We run a bootstrapping script, which provides us with a skeleton of our application and then we just extend it with the features we need.

That’s exactly what we did at the last hackathon we were attending - we started with rails new twf and spent half of the day integrating our blank app with Angular, Paperclip, creating API methods and so on. But the effort we needed to accomplish our goal (quite a simple web app) was really huge.

So I decided to find the best combination of backend and frontend technologies that would cause less pain.

At the project I was recently introduced to, the line between frontend and backend is distinguished very clearly: we have an API, written in Clojure and thin frontend application, made with Angular that works on a generated set of static assets - HTMLs, CSS and JS files (but under the hood we are using HAML and SCSS).

The application I will be implementing throughout the whole article has the same architecture: it has RESTful API and MVVM on the frontend, made with Angular. I welcome you to the journey of research and new technologies!

Read more

Email validation regexp

Sep 16, 2015

At my work we’ve lately been having a discussions on email validation. I recalled a post on habrahabr, showing different options, including effective and psycho solutions.

Read more

Prepare to add some Newtonianity

Aug 29, 2015

At this point we have an application with

  • 1x Ninja, walking around
  • 1x sphere, hanging in the center of the screen
  • 1x cube, flying around the sphere

That’s our “game”? Doubtely… So let’s make things move like in real world! Or just like that…


First of all, go and get the Newton GD files. And unpack it… right to the source directory of our project! That’s right! I’m not insane and I’m aware you are going to put a lot of files in your project. But have no fear - you may always add them to .gitignore and skip them from being tracked in your Git repo:


You are using Git, right?.. Now, you place the Newton GD sources in your project directory and change your CMakeLists.txt file to look like this:

cmake_minimum_required(VERSION 3.1)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

option("NEWTON_DEMOS_SANDBOX" "Build demos sandbox" OFF)

set(NEWTONGD_PATH source/newton-dynamics-master)

set(NEWTON_LIBRARIES Newton dMath)



            NAMES Irrlicht
            PATHS ${IRRLICHT_PATH}/lib/
            PATH_SUFFIXES Linux MacOSX Win32-gcc Win32-visualstudio Win64-visualstudio)

    message(STATUS "Found Irrlicht: ${IRRLICHT_LIBRARY_PATH}")

include_directories(${IRRLICHT_PATH}/include ${NEWTONGD_INCLUDE_DIRS})

set(SOURCE_FILES source/main.cpp)
set(EXECUTABLE_NAME irrlicht_newton_game1)

add_executable(${EXECUTABLE_NAME} ${SOURCE_FILES})


Try to compile your project - it should be just fine. And observe the power of CMake!

Read more

First script

Aug 28, 2015

As we discussed, we will describe the whole game in scripts, and the core functionality we will define in the core. In this chapter we will be adding Lua to our application. You do not need to download Lua itself - you’d better install it with your system’s package manager (yum or apt or whatever your Linux uses, brew for OSX…).


The only thing you need to download from Internet this time is Lua wrapper called luacppinterface. So go and get it from Github.

And unpack it… right to the source directory of our project! That’s right! That’s really small library so it will not pollute your project with tons of files.

Now, I mentioned dependency managers earlier. This is how we will handle them in our C++ application - we will simply put the sources of all the libraries we depend on, with the versions we depend on, right in our project. Given that, you may put Irrlicht there as well - you are free to do anything with our project!

Read more

First application

Aug 27, 2015

Install Irrlicht

First of all, you will definetely need the Irrlicht engine, so go get it.

Then you will need to compile it. Compilation process depends on the operating system you use, but it’s really similar on every one.


Install these dependencies with your system’ package manager: libenet-dev libxxf86vm-dev zlib-dev cmake.

Unzip Irrlicht, go to the directory you unpacked with the terminal and run the following:

cd source/Irrlicht

Belive it or not, but that’s all!


Unzip Irrlicht, go to the directory you unpacked and open the VisualStudio project (depending on VisualStudio version, you might want to open a bit different file) in source/Irrlicht:


Build it with VisualStudio - and you are done!


The steps are a bit complicated. And they require you to install XCode and Command-Line Tools - those could be found either in AppStore or on the Apple website.

  • First of all, you need to install a bunch of dependencies (I use brew for this purpose):

      brew install tinyxml enet lua cmake
  • Get a list of all compilers available for your OSX version:

    xcodebuild -showBuildSettings | grep DEFAULT_COMPILER

    I got something like this:

    $ xcodebuild -showBuildSettings | grep DEFAULT_COMPILER
  • Now the build process:

    cd source/Irrlicht/MacOSX
    xcodebuild -project MacOSX.xcodeproj
  • And the final step - copy the library to the lib/MacOSX directory:

    cp build/Release/libIrrlicht.a ../../../lib/MacOSX

Phew! That’s a damn bunch of commands, don’t you think?

Read more

Application architecture

Aug 26, 2015

Basic terms

Let’s talk a bit about our application before we create it. In order to make the development process sequential and least painful, we need to design the application well. The design of an application or the application architecture is the hardest thing to change on later stages of development. Thus it must be well-thought at the very beginning to prevent suffering in the future.

Well, there are number of application architecture’ levels:

The highest level defines which modules will the whole application consist of and what functionality will each of those modules have.

The next level is how the modules communicate to each other, how they work together.

The lower level is the structure of each module - what classes, entities, data structures and similar things will the module consist of.

One of the lowest, yet still very important architecture levels is how files are organized.

From the highest architecture layer point of view, I can advice a very simple architecture:

  • a stable, rarely changed core
  • a set of assets (models, textures, sounds - any content, made by artists and used to be presented to the player)
  • a bunch of scripts, defining all the logic of a game (how character looks like, how the menus are shown and how they react to player’s actions)

The main benefits of such an approach are:

  1. scripts and assets may be changed at any time
  2. scripts and assets define what we show to the user and how the application behaves, so we can changes them without the need to re-compile the core
  3. we can modify the core (for example - optimize some features) without changing the application behaviour

We can make the core so flexible that we may re-use it in the future projects.

The tools

We will use Irrlicht engine because of its simplicity. And it satisfies all our needs - it does not need much content preparation; it provides GUI; extending it with IrrKlang will give us very simple interface to sound and music playback.

Newton Game Dynamics engine we will use to simulate physics. It is easy to use and is really powerful - you would be impressed!

The last, not the least, we will use Lua scripting language to write scripts. Lua is a lightweight programming language and perfectly suits that goal.

One of the most beautiful parts of this tutorial, will be the part on making of assets. We will use Blender 3D to create a couple of 3D models.

I also found CMake kind of user-friendly. It is not that handy as any of dependency managers for all those languages, supporting them (npm for JavaScript, go get for Go, RubyGems for Ruby, leiningen for Clojure and many others). Yet it makes your project a little more portable, helps to handle your dependencies, totally eliminates the need of all those How to configure VisualStudio for OGRE tutorials. Just try it!


Remember all the three rules for our architecture. And keeping them in mind, let’s get to some coding already!

Next chapter