Archive for the ‘programming’ Category

Dev Diary: Lokomotywa – Julian Tuwim

February 8, 2013 Leave a comment

Kids always says the truth. Creating application for kids is simple from one point of view but really hard from the other one. They will not tell you that animation lost couple of frames, but will tell you that this character is ugly and don’t want to play any more.

Peaple outside Poland probably hadn’t heard about Lokomotywa poem by Julian Tuwim, but in my country it’s one of the best know children’s poem ever. Big Rabbit made a marvelous job exploring it again in a completely new way. You can notice wonderful ilustrations, exclusive soundtrack composed especially for this book and narration made by Piotr Fronczewski (famous polish actor). Big Rabbit is a group on nice peaple who want to make things that are just outstanding.

Read more…

One Game A Month

January 2, 2013 Leave a comment

One Game A Month logo
Following couple of game developers on twitter lead me to fantastic game development initiative called One Game A Month (1GAM). Generally you create a game each month. It’s not for the community, not to be reach, it’s just for yourself and just for fun. By creating game I mean not creating proof of concept, but whole working game. It’s really hard, because I already have couple unfinished game projects and I know that the road between idea with couple lines of code to the final product is rough. This topic is great covered by @McFunkypants (the initiative founder) in his keynote below.



So, my plan is to create games! Currently, I’m motivated to create all 12 of them, but the time will show how it gonna end. I chose to make iOS games. My little game development experience told me, that one month is hell small amount of time when you have family and normal job, and 1GAM is only your hobby shared among other in spear time. Because of time and my will to learn new technologies, I plan to create games in Unity game engine. Some time ago I got free license for iOS platform, so it fits perfectly.

According to games, I will try to create as simple games as possible, but simple doesn’t mean boring. The game should bring lot of fun and joy, so in reality it’s damn hard to create simple and interesting game.

I’m pretty excited and curious how it’ll end up. All games I will create I will describe here on my blog. I hope to write 12 posts till end of 2013. I wish luck to all people taking part in 1GAM.

Scripting iOS games with LUA (lua-wax)

April 6, 2012 Leave a comment

Creating game for iPhone/iPad is one thing, but making it enjoyable is way harder. Most of current games use physics for animation, to make scenes more realistic and not repeatable every time you start the same game level. You can teach your level designer Objective-C to code different behaviors for different things, but the simpler method is to script it in LUA. Lots of previous and today games use this scripting language to describe AI, events and many other things.

I wanted to implement LUA to my upcoming game and found pretty good library called wax. Its pretty impressive. All you have to do is:

- (void) runLuaScript
    wax_start("your_script.lua", nil);

The problem was that you were unable to execute wax_start() function again (it was possible, but had no effect, script was not executed once again). It lead to big problem, how to load different scripts for different levels? To achieve it you have to clone/fork/download my forked version of wax that fixes that issue.

Steps to do:

  1. You can add my repository as submodule to your XCode workspace by executing command:
    git add submodule
  2. Add libwax.a from your workspace to “Link Binary With Libraries” building phase
  3. Finally add “$(SRCROOT)”/wax/lib path (with recursive search) to your “User Header Search Paths” in Build Settings.

Now you will be able to do it this way in your application:

- (void) runLuaScript
    wax_start("your_script.lua", nil);

You can call runLuaScript method as many times you want.

Using you Objective-C classes in lua wax is really simple.

-- your_script.lua sample
local my_object = MyObjcClass:init
my_object:oneMoreMethodWithArgument_secondArgument("hello", "lua world")

For more details for lua wax take a look at Wiki page.

My commits have been pulled to the original repo, so now you can use it instead of my fork.

Code Smells After Reading “Clean Code”

July 27, 2011 Leave a comment

I created projects that I don’t want to look at any more, because of complexity and total mess. You probably heard about “Clean Code” by Robert C. Martin, if not I encourage you to buy this book and read it.

I thought that having technical knowledge is enough to create great applications. It’s not true. Source code is written by developers for developers. Having clean code is one of the most important things in software development. It’s very wide idea but I will write the most important (for me) code smells that I will try to use in my all projects. Read more…

Print TODO/FIXME Comment as Warning in XCode

July 12, 2011 Leave a comment

When I’m implementing new functionality I start with the general design and then I’m implementing newly created classes and methods. Sometimes I leave a method or two for later implementation (i.e. after creating unit test for this method) and almost always putting comment:

// TODO: nice comment here

It already happened to me, that I left this comment unnecessary or (the worst case scenario) I forgot to implement this TODO part 😦 To get rid of these mistakes you can add Run Script phase in Build Phases of your project’s target with some nice shell command. To do this, click on your target, move to Build Phases tab and in right-bottom corner click Add Build Phase and choose Add Run Script. Leave shell as it is and in the content of the script paste following two lines:

find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.mm" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
At the end of second line you can add i.e.:
| grep -v ExternalSources
This will prevent from printing warnings for TODO/FIXME comments in file paths containing “ExternalSources”. It’s in case you use third party source code that still needs some work to be done 🙂
The latest revision of this script can be found at my github repository: todo xcode gist
Categories: mac, programming Tags: , ,

Moving Files in XCode

July 12, 2011 2 comments

Couple of times I made silly mistake of creating new files in XCode project not in the place I want them to be in filesystem. Groups and “real” folders still confuse me. When you have such file in your project that is in correct group, but not in correct folder on the disk and you don’t want to remove it’s reference and add the same file again I have two steps solution for you.

First you open Finder (or any other file commander tool) and move the file to the correct location. When you will open XCode you will see that this moved file is red now (this is expected behavior, XCode cannot find this file under old location):

What you have to do is to highlight this file and open File Inspector (menu View -> Utilities -> File Inspector or by keyboard shortcut <command> + <option> + <1>). Just under Location combo box there is specified current location for this file. Hit the little folder icon on the right and choose the new path of the moved file:

And that’s it. The drawback of this solution is that you have to repeat this steps for each file you want to move, but if you have plenty of them, probably it’s better to remove references and add them again.

Categories: mac, programming Tags:

Learning Ruby with Project Euler

May 2, 2011 Leave a comment

After completing Ruby Koans it’s time to move forward. Next step is Project Euler. There are plenty of problems to solve, so learning advanced Ruby programming will be neccessary.

I created github project where I will post all my solutions. You can also see this project page on my blog, where I will post updates if any.

Categories: programming Tags: , ,