http://asawicki.info/ Graphics programming, game programming, C++, games, Windows, Internet and more...
.net algorithms c++ competitions compo demoscene directx engine events flash fractals gallery games ggj graphics gui hardware homepage humor ideas igk java libraries life linux literature math mobile music networking origami philosophy politics productions redmond rendering scripts shopping software software engineering stl studies teaching tools video visual studio warsztat web webdev winapi windows
Simple 3D game developed in Unity during Global Game Jam 2014.
Simple 2D game developed during Global Game Jam 2013, for Windows.
|FX Batch Compiler 1.1|
This Windows application supports compilation of FX effect files and HLSL shader files using fxc command line compiler included in DirectX SDK. You can compile many files at time or one file with different settings.
My first Flash game. Coded with FlashDevelop in ActionScript 3.
Universal library for C++, created especially with game programmers in mind. Includes: math module (vectors, matrices, quaternions, planes, rich set of collision functions and more), string operations, conversions, smart pointers, configuration files handling, date and time module, exception class hierarchy for error handling, file system handling, stream class hierarchy, FreeList - free memory allocator, complex logger, profiler, library for threading and synchronization, tokenizer, wrappers for compression with zlib.
Language: C++. Platforms: Windows and Linux. License: GNU LGPL. Optional support for Unicode. Optional integration with D3DX. Documentation made with Doxygen.
|Aqua Fish 2|
Game for children - clone of PacMan. Player swims as a fish and collects points, as well as special items. Player also have to run away from enemies or destroy them. 60 maps in 6 different titlesets. Low hardware requirements. See also YouTube videos: , . Game was published by Play Publishing company.
Calculator for game programmers. Basic data unit is a vector of 1-4 floating point numbers, which can be treated as (x,y,z,w) vector or (r,g,b,a) color. Next to basic calculations like addition, multiplication or sinus, vector operations are also available, e.g. vector normalization, conversion between degrees and radians, color conversion between RGB and HSB, finding linear an quadratic function coefficients and much more. Instead of entering single number, here you can see all the history of your calculations in form of stack and all operations are performed on that stack. Data can be entered and retrieved in different formats, like "D3DXVECTOR4(0.0f, 0.5f, 0.752f, 1.0f)" or "0xFF0080C0". Platform: Windows. Language: C#. License: GNU GPL.
(Polish) Architektura wspó³czesnych gier video - Prezentacja
Zapraszam do obejrzenia slajdów z mojej prezentacji zatytu³owanej "Architektura wspó³czesnych gier video", któr± pokaza³em dzisiaj podczas targów Kariera IT w Gdańsku, 13 grudnia 2014.
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.
PGA + ZTG 2014 - Photos
Last weekend I've been in Poznań on PGA - Poznań Game Arena (gaming expo) and ZTG - Zjazd Twórców Gier (gamedev conference, happening in same time and place). Here are my photos from these events: PGA i ZTG 2014
Writing OFX Video Processing Plugin
Computer graphics is a broad topic and GPU-accelerated real-time 3D rendering is just one of its parts. Another one is photo and video processing. Video editing is an art by itself, but from the technical point of view there are various interesting effects that can be applied. While not essentially real-time and often done on CPU, of course it could also be GPU-accelerated and also should be as efficient as possible. There are many video editing programs, from Windows Movie Maker to Adobe Premiere. The one of my choice is Sony Vegas Pro. Such programs come with a bundle of standard effects, but for a graphics programmer what can be more fun than writing own plugin?
Vegas Pro supports plugins in OpenFX (OFX) standard. They are written as native code compiled to DLL library with appropriate interface. I'm learning how to write such plugins. Below is a description of how you can start experimenting with this technology plus my "Hello World" example that performs simple color inversion. Maybe later I will write a tutorial with detailed description of this API. For now, here is C++ source code of my example with Visual Studio 2013 project and compiled binaries (Win32 and x64): OfxTest1.zip (21 KB). Inside Vegas Pro it looks like this:
A brief description of how to start coding such plugins:
c:\Program Files\Common Files\OFX\Plugins\Basic.ofx.bundle\Contents\Win64\Test1.ofx.
Note that examples provided on SourceForge next to includes package are broken. When compiled in Visual Studio, they assert in Debug configuration due to usage of uninitialized variables and stack corruption! Patch for these bugs is submitted for over 2 years (#1 Basic in Examples - uninitialised variables) and the author is not fixing it. My example has all of this fixed.