September 2011

Warning! Some information on this page is older than 5 years now. I keep it for reference, but it probably doesn't reflect my current knowledge and beliefs.

# Vector Register Size - Diagram

Sep 2011

It may be hard to imagine and remember what is the exact number of bits, bytes, words or floats in some piece of data, like a SIMD register. So today I've made following diagram/cheatsheet:

Vector Register Size Diagram - SIMD, MMX, SSE, AVX registers

Here you can find its "source" in OpenOffice Draw format: Vector_register_size.odg.

Comments | #hardware #math Share

# Handling Ctrl+C in Windows Console Application

Sep 2011

Just a small code snippet: Let's say you write a console application in native C++ for Windows. Closing the console by pressing Ctrl+C, Ctrl+Break or clicking on close window button [X] kills the process. Is there any way to handle such event and close the program gracefully? The answer is calling SetConsoleCtrlHandler() WinAPI function and implementing your own HandlerRoutine callback function. The template looks like this:

// Handler function will be called on separate thread!
static BOOL WINAPI console_ctrl_handler(DWORD dwCtrlType)
  switch (dwCtrlType)
  case CTRL_C_EVENT: // Ctrl+C
  case CTRL_BREAK_EVENT: // Ctrl+Break
  case CTRL_CLOSE_EVENT: // Closing the console window
  case CTRL_LOGOFF_EVENT: // User logs off. Passed only to services!
  case CTRL_SHUTDOWN_EVENT: // System is shutting down. Passed only to services!

  // Return TRUE if handled this message, further handler functions won't be called.
  // Return FALSE to pass this message to further handlers until default handler calls ExitProcess().
  return FALSE;

int main(int argc, char **argv)
  SetConsoleCtrlHandler(console_ctrl_handler, TRUE);

If your program performs some loop and you want the user to be able to break it by closing the console or pressing Ctrl+C, you can solve it this way:

static volatile bool g_exit = false;

static BOOL WINAPI console_ctrl_handler(DWORD dwCtrlType)
  g_exit = true;
  return TRUE;

int main(int argc, char **argv)
  SetConsoleCtrlHandler(console_ctrl_handler, TRUE);
  while (!g_exit)

Comments | #windows #winapi #c++ Share

# Windows 8 Developer Preview

Sep 2011

News about upcoming Windows 8 appear for some time. Information about the new Windows version directly from Microsoft, including technical details for developers, can be found in this PDF: Windows Developer Preview - Windows 8 guide. Recently Microsoft shared a full, development version of this system to download, install and test on your computer for free. It's a developer preview - it contains the new operating system along with new Visual Studio 11. You can download it as ISO image from Windows Developer Preview downloads. The system works in VirtualBox virtual machine. You can see my first gallery of screenshots here:

My first impressions after testing Windows 8 are... quite weird. Apparently they try to make desktop OS looking like a cellphone, with big fonts and all apps working in fullscreen. But that's only a half-truth. I feel that in Microsoft they always do it this way: a boss comes and tells that "we do it again from scratch only better, redefine everything, but we have to preserve backward compatibility", then a developer thinks how to implement it the simplest possible way and it ends in a new flashy UI containing several shortcuts to the most important commands with the old, good windows hiding somewhere under "Advanced" button. It was the same with Control Panel, with formatting functions in MS Office and now it's the same with the whole Desktop. You are presented a new screen full of colourful rectangles, but as soon as you move your cursor to the bottom-left corner of the screen and click "Start", you are teleported to the normal desktop with a wallpaper, taskbar and the Recycle Bin :)

Other things that attracted my attention: You now login to Windows using your Windows Live ID account. System is integrated with Facebook by providing some application to browse it. Explorer now uses the new Ribbon toolbar, just like new versions of MS Office, Paint or WordPad do for some time. There are lots of new games. New Task Manager is great because it now shows four columns with all most important statistics of every running program: the usage of CPU time, RAM memory, disk transfer and network transfer. Finally the new UI style: flat, colourful, minimalistic, full of solid filled rectangles.

Comments | #windows #visual studio #gui Share

# RiverWash 2011

Sep 2011

Last weekend, at same time as WGK Conference in Gdańsk, another interesting event took place - RiverWash 2011, a Polish demoscene party. This time it was held in Łódź. Last year and two years ago I attended it, so I really regret I couldn't be there this time. After looking at some photos from the party on Facebook, I guess it was lots of fun. About the productions, all stuff can be downloaded from It takes 1.43 GB (from which 933 MB is the "wild" subdirectory).

There were two full-size, newschool demos. 1st place went to "Machineris" by Futuris. Unfortunately it doesn't work correctly on my machine (probably because of the AMD graphics card). High-quality video recording can be found here: Machineris by Futuris @ YouTube.

4k intro category had 3 entries. 1st place was taken by "Chaos theory 4k" - an intro by KK from DMA, known on Warsztat as Krzysiek K. Congratulations on winning two competitions on two different parties, in two different cities on the same weekend! It's a remake of "Chaos Theory" by Conspiracy - a 64k intro presented on Assembly 2006. He managed to squeeze it into 4 kilobytes :) High-quality video is here: Chaos theory by KK / DMA | 4k @ YouTube.

There were 3 entries in Game category. 1st place was taken by "Vampire rabbits attack" by AsmCode and Presto - a 3D FPS shooter with toon shading. Generally the games are not very impressive - apparently demosceners are not so committed to game development as we are on :)

Graphics and photos are also worth attention. 1st place in "Newschool GFX" category - "Last Train To Nowhere" by Slayer - is great, but I especially like "Halfway to yesterday" by Azzaro, which became my new wallpaper.

Of course there were other categories in the competition, like Amiga demo or Chip music. But I pay attention mostly to newschool PC demos and intros and I keep dreaming about making one. The vision of coding demos is very tempting for someone who likes graphics programming, because unlike in developing games, it's simpler and does not require dealing with gameplay and other things.

Comments | #competitions #demoscene #events #riverwash Share

# WGK 2011 - Our Compo Game

Sep 2011

Part of the National Conference on Computer Games Development was COMPO Games Bonanza - a competition where teams of up to 4 people have to develop a game in 9 hours. Our team was: Krzysztof Kluczek (Krzysiek K.), Tomasz Dąbrowski (Dab), Piotr Iwanicki (zxc) and me. That was our first participation in a contest in such configuration and it worked quite well. Zxc made all the graphics, sound and recorded voice. He was also doing game design by insisting on making this game cool, while we focused more on technical details :) Rest of us was coding. Music is done by Krzysiek K. in Fruity Loops, also during the contest.

Here is a video recorded by 2009xor. You can see our game presented by Krzysiek K. from the beginning of the video until 1:50.

The theme for this competition was "surrealism". We came up with a game about Salvador Dali. His thoughts (the players) are fighting in his mind - that's the story. Obstacles on the map are eyes which always look at some player. Periodically some bigger object appear, like a cat in a box or a guitarist with spider legs - so thanks to zxc's creativity the game is really surreal/psychedelic :)

Our work went quite well. We managed to implement most of what we planned - a difficult task. Of course we weren't happy about how the project is going all the time, there was some rush and frustration. But there were also epic moments, especially when Krzysiek K. implemented bloom shader literally in 10 minutes, right before deadline!

The game is written in C++. We used a framework coded by Krzysiek K., same as on IGK conference in previous years, that just initializes Direct3D, handles texture loading, mouse and keyboard input etc. Playing sound and music is implemented using FMOD library. Right before the competition I figured out how to handle multiple gamepads using Raw Input API. Unfortunately that decision forced us to implement only particular models of Logitech gamepads - the ones that we took with us and used during the compo.

Our game makes sense only for 2-4 players playing simultaneously. During the presentation we used two wired gamepads, one wireless gamepad and the keyboard. Players moving on the top-down view fight each other. By killing opponents they gain experiance, and after leveling up they upgrade to better weapon.

I'd like to thank everyone who voted for us, congratulate other teams that participated in the competition and thank organizers for arranging this competition - so traditional in our community - during the conference. See you next year!

Comments | #competitions #compo #events #igk #productions Share

# WGK 2011 - Links

Sep 2011

WGK 2011 - First National Conference on Computer Games Development - took place 2-4 September 2011 at Gdańsk University Of Technology. It's time to aggregate links to information and multimedia about this event:





Comments | #competitions #compo #events #gallery #igk Share

# WGK 2011 - My Photos

Sep 2011

First National Conference on Computer Games Development in Gdańsk is over. I didn't take many photos this time, but I have some - see my gallery WGK 2011 @ Picasa.

Comments | #competitions #compo #events #igk #gallery Share

[Download] [Dropbox] [pub] [Mirror] [Privacy policy]
Copyright © 2004-2020