http://asawicki.info/ Programming, graphics, games, media, C++, Windows, Internet and more...
My Lecture on CareerCon
CareerCon is an event organized in various cities in Poland, dedicated to all kinds of jobs in IT, e.g. for programmers. You can find there many companies advertising their job offers. Entrance is free, but requires previous registration on their website. There are also some presentations every time.
13 December 2014 the event will take place in Gdańsk, where I will give a lecture "Architektura wspó³czesnych gier video" ("Architecture of modern video games"). If you are a professional programmer or a student interesting in career in IT, I'd like to invite you to come and listen.
PsyChill Evening - my first music visualizations
Yesterday I had an opportunity - for the first time - to show my visualizations as a VJ on a music party. The party was called PsyChill Evening, took place in Paszcza Lwa, Gdańsk, Poland and its musical style was described as "Psychill, Psybient, Downtempo, Psydub and Ambient".
Just like DJ is someone who plays music, a VJ is an auxilliary role of someone who makes visualizations in real-time, displayed using a beamer. There is some software dedicated for this, like Resolume or ArKaos, but what can be more fun for a graphics software enginner than coding my own software? So I made one. Honestly, I planned to write program like this for years, while now I had to do it in just one week, right before the party. It's written in C++ using DirectX 11. Here is how the result looks like:
As you can see, the rendering here is not very sophisticated, CPU- or GPU-intensive. There are just some 2D textures transformed and blended together (plus feedback from previous frame, plus symmetry) - all fading in and out smoothly, as it was for chillout music. But that's not the point here. There is some interesting code under the hood, like the way a "scene" is described in memory with all these changes that happen over time. Time is expressed inside the program not in seconds, but in beats, so after setting right BPM (Beats Per Minute), it synchronizes nicely with the music. The movement of these textures, as well as color transformations are all procedurally generated and random, so it's somewhat different every time. Of course, there is much more to be done here. But now all I need is some sleep :)
I love electronic dance music, so I'm very happy I could connect it wih my profession - graphics programming :D
Microsoft Visual Studio Community 2013 !!!
Microsoft just released a new edition of Visual Studio that will replace Express. It's called Visual Studio Community 2013 and it's free, while it has all the features of the commercial edition, including support for plugins and many advanced tools. You can download it from Visual Studio Downloads, web installer or DVD ISO. It works with "old" Windows 7 as well. Good move Microsoft! For me it's probably the news of the month :) So far, I installed the IDE and tested on my home project CPU profiling:
...and Graphics Analyzer, which replaces good old PIX:
Experience with Game in Scheme
Last week I talked with a colleague about optimizing performance of his game project. It's written in Scheme (functional programming language, dialect of Lisp), using SDL and OpenGL. The bottleneck was GUI rendering.
When analyzing code, we found that the function for rendering text renders TTF font to a new surface with function
TTF_RenderUTF8_*, then creates another
SDL_Surface to convert format, then creates and fills OpenGL texture with
glTexImage2D. The texture is then used just once for rendering... to another freshly allocated
SDL_Surface, to perform clipping. All this happens for every GUI control, in every frame! Finally the objects are freed by Scheme garbage collector.
He then asked me whether we should find a way not to render the GUI part of the screen every frame, but only when something changes. He also cited the famous and often misused quote of Donald Knuth: "Premature optimization is the root of all evil".
I explained to him that modern GPU-s are able to render millions of triangles every frame and redrawing whole screen every frame is a standard practice. It's resource creation (allocation and filling of surfaces and textures) what should be avoided and not done every frame. If using SDL_ttf for text rendering, a final texture/surface should be prepared once and used to do just rendering in every frame, until the text changes. Additionally, calls like
glDisable(GL_DEPTH_TEST) also don't have to be made for every object in every frame.
When thinking about it now, the general rule of game optimization could be:
About functional programming and stuff like that, I think such high level concepts are good for software development as long as they are accompanied with understanding of what's under the hood. Some principles of functional programming, like avoiding side effects and just transforming one list of items to the other, are similar to the idea of DOD (Data-Oriented Design), used in game development for efficiency and scalability. But I don't agree that thinking about efficiency should be avoided until necessary or that optimization makes code complex and unreadable. Quite contrary - I believe simple code is both readable and efficient.
As I have little experience with functional programming, for me it was also fascinating to learn basics of Scheme. It's based on simple principles yet it is so powerful. I'm now thinking about how a language like this could be applied everywhere, from program configuration and as a description language, to game scripting and procedural media generation :)
Agile Methods and Real Life
I've received an e-mail recently from a student asking me about what career path to choose. I generally don't feel good as an authority, but when trying to write some reasonable answer, I recalled this diagram - "The Project Paradox":
It basically says that when planning everything in advance, we have to make the most important decisions at the beginning, when we actually know the least about the project. In software development, we may know the final goal, but we usually don't know how exactly the implementation will look like and what problems will we encounter during the project (unless w already done something similar in the past). That's why agile software development methods were invented.
I think something similar happens in real life. What is more, we don't make the most important decisions like about job and marriage only by ourselves (it also depends on the decisions of others) and we don't do it by only rationally weighting pros and cons - we also follow our hearts. So instead of thinking all the time about the big, lifetime goals, it's better (it feels better and is more efficient) to just focus on the next step to do. That's also what GTD (Getting Things Done) method advices.
So in this case, I'd recommend not to consider theoretically what career path is better, more interesting, more profitable etc., but just try to do different things (like learn a bit and code some simple game, mobile app, web page, setup Linux server or whatever) and see how it feels for you to do these things.