Saturday, February 18, 2017

Good programmer ...

I don't know about you but after all this years that I'm into programming (18 year already) I'm still hesitate to call myself good programmer. I have some knowledge and experience but am I really good ? 

This question really often return when you look around in net. You founding another awesome looking project that somebody done. In my case is even worse because most of the time it's also done a lot quicker ( I'm 7 years stuck in the same project). Always then I feel a little bit down because there coming other questions like: what you done in all this time, what you achieved and are you really good.

I still don't have clear answer how to deal with this mood and thoughts. Do you have any ? If you have I'm really open to listen them.

So far I start to thinking that we are in time when a lot of people want to show of their skills and show how better they are than others. I'm sometimes have pity for them when they doing that.

Recently I was asked if one of my friend is better programmer than me and my answer was yes. And the more I think about it's great. By simple fact that I know that there are better people I know I have a lot of new possibilities in front of me. I still can be better than I'm right now.

So in the end who cares if I'm called good programmer. I'm just trying my best in programming and I think this is great because there is so much new interesting things to be discovered.


Wednesday, February 15, 2017

Editor disaster ... update

So I was digging a little bit more into my issue of TCP/IP on Linux and I found out about socket option:

One of description in given link is:
2. For this to be used effectively, applications must avoid doing small, logically related buffer writes. Because TCP_NODELAY is enabled, these small writes will make TCP send these multiple buffers as individual packets, which can result in poor overall performance. ...
In my case default behavior created delay because I was basing (probably stupidly) my whole system on fact that each message will be delivered as soon as possible.

This option switched everything to expected from me behavior. Of course I don't saying this is solution to all problems and probably introduce me some issues somewhere else.

I'm still feel like novice in serious network programming :/ But well as far as project go I'm really happy with all this improvements and knowledge that I gain in meantime of doing them.

But well time to return tracing bugs in my changes so I could push my code to repository before going sleep.


Monday, January 30, 2017

Editor disaster ...

So I'm still waiting for starting of my new job in Unity Technologies so I have some spare time. I use it to see Copenhagen, drink coffee, meet new people and of course as always: coding. 

This time in my coding journey I try to figure out reason behind my slow reaction time of editor. My windows machine handed everything perfectly fine but my a lot slower laptop with Linux gave terrible results :/ How bad? I tried to rotate scene and there was few second delay between action and reaction So really bad. There was no choice but to fix it. 

Wednesday, January 25, 2017

Resource building

As you may notice I like to push my tech to it's limit. Because of that I recently decided to switch to a lot better way of building resources. I took my app that were containing everything and split it on 3 different one.
They run as separate processes which connect with each other using TCP/IP. Comparing to previous setup this solution have a lot of advantages and this is some of them:
  • If one node crash I can just restart it and run whole setup further.
  • Whole node setup is scalable so I can have 100 of nodes.
  • I can run nodes on different machines. 
  • I can dispatch new version of building nodes to different machines automatically.
  • I can build specialized Python nodes for some of work.
  • Application don't need to have all this shitty code of resource compilation.
  • Whole concept became a lot easier to control.
So as you can see there is a lot of improvement :) comparing to previous one.

Friday, November 25, 2016

Engine interview question

My friend know someone who is going to have skype interview for a position as engine junior programmer. I was asked for some guide or hints for this person. I think that this topic is interesting enough to change my long reply into nice post and hear what you think about it:) My email to him looked like this:

" First he should stop being stressful and asking question of others what can be on interview. If he has knowledge and luck he will pass. Sometimes is more about luck than knowledge but generally If he will get too stressful, even luck won’t help him.

About question they can ask whatever they want from just:
  • How are you?
  • Where you were studding?
  • What you were studding?
  • Why do you decide to have interview with us?
To more technical one like:
  • What programming languages you know and how well?
  • What engines you know?
If he sent them CV there will be probably few question about stuff you put there. If he worked previously somewhere I would expect question like:
  • What you done in previous job?
  • Why you decide to change job?
  • What projects you done in university?
  • Why you think this position is for you?
After that may come true technical questions which can by anything from question about: pointers, graphics rendering, memory management, disc access and 1001 other topics. There is just too much of them to be prepare for them. 

So returning to first line if he has knowledge he will answer questions better or worse but he will do this. From my experience, there are always different questions on each interview (but maybe this is just for me). He should chill-out and just see this as learning experience. If he will fail, world don’t end and he should just learn from it and try again. If they will see potential in him there is still big chance they will at least give him programming task.


Tuesday, August 16, 2016

Game development

This time something inspired by this twit:

If you look really general on game development you can compare it to assembling puzzles. A lot of people know about game development from articles, making of videos and few other sources. They also know that there are different options that developer choose when they started:
  • 5000 pieces - Making small game on ready technology.
  • 8000 pieces - Making small game with technology.
  • 12500 pieces - Making game on ready technology.
  • 25000 pieces - Making game with technology. 
This don't sound so bad, so why developer don't make their job properly? People complain about some bugs, some features, about how simple it would be to just add this one feature. This is so frustrating for them because this is so simple (like assembling puzzles).

Wednesday, June 1, 2016

Code pollution

Well time fly by and animation system starting take shape. Thanks to it I could do even some not bad looking animations in game ( but well this is just another milestone in road to finished game. 

Because of this thoughts I already moved to next issue: recovering of movie system. So far its going fine I added new movie resource, movie editor module. No I starting adding basic functionality: adding keys. This operation require list of selected objects in level.

This part was designed great :D Because I can have N levels loaded in memory in the same time I created new level component which exist only in editor. It contain some editor specific data i.e. selection. It's added on loading from editor and it's not saved with level. When you want list of selected objects just pick component from level and I have access to selection. Great idea right ? 

I thought this way when I was writing it. Right now I think it was good direction but it's still "Code pollution". Editor code and game code start mixing which is always harder to manage. On top of that Editor tools component is visible in level properties and yes I know I could hide it in code but then you create hack/some new code path which create new issues. Leaving it is also not any option because this is weird for person who work in tools. When there is something you didn't add you have temptation to remove it (I know what this it and that I shouldn't remove it but still don't like how it pollute my level setup) :D

My another iteration over this problem will be: 

LevelEditorModule would replace level component and thanks to that became independent from level. Advantage of this system is that it should be relatively easy progression from existing code. Just a little bit of time. 

This may look like something stupid to do when I'm already limited by time and doing so many other stuff. Yeah you may be right. I never was too wise in this situations I prefers spending evening or two improving code which works than add new feature to game. Thanks to that I won't have maybe nice feature which will look nice at picture or video but I will have code which will supporting my efforts in creating games. Then features will be easier and funnier to work on :)


Tuesday, May 17, 2016

C++ riddle

This time small C++ riddle which took me some time to figure out :)

My editor currently use sockets connection to pass data between Qt UI and "Editor module" in engine. Inside editor module this happen on two threads:
  1. Processing events on editor module side
  2. Receive data and send result of events back to UI. 
Code of two main function execute on them can found bellow:

This worked fine except my editor were crashing sometimes. This happen on random operations : moving, selecting, changing properties. Visual Studio debugger where showing me that crash were happening in this code:
    eventResult->next = m_eventsToFinalize;
while (wrAtomic::compareexchange(&m_eventsToFinalize, eventResult, eventResult->next) == eventResult->next);

Data in eventResult was looking like corrupted event or already deleted class.

What is wrong with this code :D ?

EDIT: There was small mistake in original version of code which should not be there (I fixed this in post). Line :
while (!wrAtomic::compareexchange(&m_eventsToFinalize, eventResult, eventResult->next) == eventResult->next);
should be:
while (wrAtomic::compareexchange(&m_eventsToFinalize, eventResult, eventResult->next) == eventResult->next);

Wednesday, May 11, 2016

My little monster

This story started long ago while I was still student at University of Technology in Wrocław. It was probably year 2006 but I'm not sure right now. With time passing by all previous years slowly starting blending together but well I'm already at this age where this is pardonable.

On one of C++ courses we got exercise to do program of our choice to show that we learned language. I decided that isometric game in SDL software mode will be great idea. And so I started working on it. What a great joy I had when everything finally started working together and I was able to send it to person conducting classes. I got passing marks and this was end of story. 

Well at least for a lot of project this would be truth but in this cases there is a lot more. Some time passed and with friend we decided to make casual game. Code from course project was really useful but software rendering were too slow so I switched whole stuff on OpenGL and some time later we finished "Pirate Crystal's: Adventure of Julia".

Another semester started and in advance C++ course I decided to connect physics to engine which at this point had already some basic 3D functionality. This wasn't easy because this was my first encounter with proper physics implementation. But well all of that couldn't prepare me for what came on other course conducted by Kornel Kisielewicz about shaders. I still remember his comment when he was rejecting my idea of doing normal mapping: but this is standard now. 

This may sound silly but for me this meant a lot. I was hiding in save zone avoiding shaders however I could but then I was informed that I'm far behind what happening in industry. This was crucial moment for me because I quickly get out of my save bubble, learned shaders and decided that I never want to stop learning new stuff and ending in this bubble again.

But what the hell this post is about? This is for sure not post about me but "My little monster". I sometimes hate it, sometimes need break from it sometimes I messing with it but in the end this is my "little monster" which I put a lot effort into and try to make it the best engine I can.

Why Monster ? 

People who done work on bigger projects probably know this feeling of being lost in code. In my case it often happen when I move to new part of code which I never had occasion to work on. Now imagine the same situation happening in your own code base. This is moment when you start understanding how big project you working on really is.

Other thing is that a lot of people seeing personal projects as "toys" they don't treat it seriously when you talk that you work on them. In my case I don't see difference between my personal project and projects I worked on in work. Of course code base is smaller but if you look on how much code is handled by programmer then I'm sure that I handle a lot more in my personal project.

There are also issues which you need to deal with yourselves:
  • Code paths that aren't used quickly became broken. 
  • There is issue of tools that you don't compile when I do some changes in engine.
  • Differences between GPU vendors.
  • Memory management,
  • Threading issue like: timing, race conditions.
  • Multi platform development.
  • Code which you don't even know how worked in first place.
  • Build system.
  • Building of game package (ideal if it was automatic).
  • And a lot more.
I personally don't try hack any of this or just do quick prototype. I try to make proper solution which I would also create if I needed to resolve this issue in work. And this change really a lot. 

This was really visible when I were changing work. The first time when I was doing it and mentioned my project people were like good you do something on your own but what you done in previous job. Things changed last time. When I was showing it to people that interview me they sometimes even skipped some tests and we ended talking how I done stuff or they give me their opinion how they would do something. This project was seen as one of projects that I was working on commercially and I think this was great.

Why Little Monster ? 

Well this is not name of engine because its called White Rabbit Engine. This is name that I using when I end in bed after doing some work for engine and finally realizing what kind of technology I creating. I'm scared of it complexity because sometimes I got lost in my own code. What will future bring I don't know but this project carring ten years of development, all my knowledge and well it still my "little monster". I may sometimes have enough of but but I still like what I do and will carry work on it for a little bit more :)

Friday, April 29, 2016

My bookshelves.

I realize recently that I'm weird programmer. If you would look on my bookshelves you will find there:
  • manga, 
  • fantasy books,
  • movies art books,
  • games art books,
  • books about drawing, 
  • books about anatomy,
  • books about animations,
  • D&D manuals.
What you won't find there is any programming book. My only book kind of in this topic is Showstopper about development of windows NT on my kindle. Which is in the fact not programming book but more story of people who created it and I'm still in middle of reading it :) 

The other book I reading is  "The Animator's Survival Kit: A Manual of Methods, Principles and Formulas for Classical, Computer, Games, Stop Motion and Internet Animators." which is for me really interesting. So far I finding there a lot of interesting advice which some even apply to programming.

And this is weird because as programmer I probably should read some books in my field of work. But I don't fell any push into this direction. I don't wan't to read book about programming language because what for? I tried long time ago and they are boring like hell :/ If I need to learn syntax I can just look into online tutorials.

All new stuff about C++ I learning when I searching online for solutions of problems or discuss with others. Sometimes I spend more time on trying understand small piece of example code than on fixing the initial issue. This happening mostly because I go from one page to another and finding more and more interesting stuff.

I would really love to read programming book which is not about language or algorithms but more about programming itself. I imagine such a book would contain stories of development, tips and tricks how to be better programmer. You know this kind of book which you start reading and before you noticing its ends.

Do you know book like that ? If you know I would really like to know its title.