Tilt shift photography

Been playing a little bit with tilt shift photography today. My first try here (Stockholm). Not the best source image (sky especially, technique tends to look better with whole picture ‘busy’) and perhaps a little bit too strong blur, but still kinda captures the ‘fake miniature’ look: Old comments Riddlemaster 2010-01-26 09:19:38 That’s true. It should be easy to remove this using some clone/stamp/patch tool though. admin 2010-01-27 08:47:10 Nah, I don’t want to tamper with it too much, let it stay as a record of my first tries.

Remote debugging in Visual Studio

Today I’d like to describe a relatively unknown feature of Visual Studio that can be extremely useful in certain situations - remote debugging. Remember all those situations when application work perfectly on your machine, but crashes on tester’s? ‘Old school’ way of trying to debug this problem was to add a very detailed logging, then analyze it. Fortunately, there is a more convenient method - we can simply connect to his machine and attach debugger to running application.

To assert or not to assert

(or rather: how & when to assert). Assertion is probably one of my favourite programming tools, however there are still few areas that I’m not entirely sure how to solve in an optimal way. First, let’s start with things that I’m rather convinced about, few simple guidelines for my ideal assert macro (funnily enough, during my career I’ve never seen implementation respecting all those rules at once): when it breaks into debugger make sure it stops in the same line assertion actually failed, not two hierarchy levels down (so every time it’s triggered one has to rewind first to see what’s wrong exactly)!

Reflection in C++ - Load In Place

I played a little bit with my Load-In-Place system. It used to only support vectors of PODs (stored by value). Now it handles also vectors of pointers & vectors of classes. Sample structure that’ll be saved/loaded automatically: struct IntContainer { int* pInt; }; struct SuperBar { unsigned long i; // [Hidden] float* p; bool b; signed char s; Color color; SuperBar* psb; typedef rde::vector tVec; tVec v; rde::vector<Color*> someColors; rde::vector<SuperBar*> superBars; rde::vector containers; IntContainer ic; }; [.

Reflection in C++ – part 2

In a previous note I wrote a little bit about my experimental reflection system for C++. Today, I’d like to describe a simple load-in-place mechanism I built on top of that. Basic idea behind LIP is to minimize the overhead of any processing after data is loaded from a file. Ideally, all that needs to be done is call to ‘fread’ to a memory buffer. For more detailed description of such system see Fast File Loading article by Ent/Incognita.

Reflection in C++ - a teaser

Whether we like it or no - C++ is an ancient language. It doesn’t have many features that are considered normal in some more modern languages. One of such missing features is reflection. It also never been lucky enough to get any kind of standard implementation. Over the years programmers, both main-stream & gamedev - have been patching their own systems. Today, I’d like to present yet another approach that I’ve developed.

Demoscene tribute: French 3D revolution

1996 was one of the best PC scene years in my opinion. It was also the year when some legendary Amiga/Atari ST groups released their first PC productions. It started at Saturne’96 party. It wasn’t one of the great 3 events (The Gathering/Assembly/The Party), it was local party, with French groups mostly. In 1996 however, the competition level was just crazily high. To this day I’m still not sure which one of the first two productions I like more.

Cruncher# update

I’ve read this note on Rachel’s blog and found out there’s tool similar to Cruncher, just for ELF, named pahole. It has a nifty feature of showing cacheline boundaries. Had a little bit of spare time this weekend, so decided to add it to Cruncher# as well. By default, it assumes that object’s start offset corresponds with cacheline start, but you can set ‘prefetch’ start offset from context RMB menu.

Anatomy of Duff's Device

Duff’s Device is one of the most brilliant exploits of C syntax. It’s used to unroll loops and save some cycles spent on loop ‘maintenance’. Let’s take a look at typical fill_n function: template RDE_FORCEINLINE void fill_n(T* first, size_t n, const T& val) { for (size_t i = 0; i < n; ++i) first[i] = val; } Now, assuming that element is not too expensive to copy, execution time of this function can be heavily influenced just by loop ‘maintenance’ I mentioned (counter modifications + jumps).

Vector swizzling in C++

Everyone who’s done at least some vertex/pixel shader/HLSL programming has probably encountered mechanism called “swizzling”. It’s an operation where we create new vector using arbitrarily selected components of another vector (also a little bit similiar to SSE shuffling). Code snippet is worth 100 words, so some examples: a = b.zyzx; // a.x = b.z, a.y = b.y, a.z = b.z, a.w = b.x a = b.wy; // a.x = b.

Coders at work - observations

Recently, I’ve been reading “Coders At Work” book when commuting to the office. It only takes me 15 minutes, so it’s going rather slowly. It’s a collection of interviews with some of the most famous programmers, really interesting. I’ve only read about 200 pages so far (5 interviews), but already found two intriguing points: almost everyone so far insisted on using printf for debugging. Yeah, they use some GDB, but not much.

Sleepwalker Games

Another Polish gamedev company. Founded by ex-CDPR employees, some of main forces behind The Witcher (including Lead Gameplay Designer & one of Lead Programmers). Keep an eye on those guys, you can count on interesting stuff coming from them. Good luck! Old comments Mateusz Loskot 2009-10-13 08:30:59 Hmm, it’s interesting. I’m wondering what has happened these guys moved out from CDPR. Anyway, good luck! admin 2009-10-13 08:55:04 Well, if you read some latest press news carefully/trace Linkedin etc you can probably figure it out :)

Tenerife

I’m on a short vacations these days, just got back from Tenerife. Really, really interesting place (way more than I’ve expected). Funnily, I went there by ‘accident’. Originally, we wanted to go to Madera, but I was trying to be too smart and waited for last minute offers so long that they were no longer available. I had to decide quickly on another place to go and Tenerife looked as good as anything else, so I though ‘what the hell, let’s try’.

Game Engine Architecture – review

Took me a while to dig through this one, book is over 800 pages. It has been written by Jason Gregory, who’s currently working as programmer at Naughty Dog. Jason has years of practical experience in the gamedev (Midway, EA, ND) and it really shows. There are too many books out there written by people who have never shipped anything bigger. This is not the case. When he writes how to do/don’t something, he usually backs it up with a real-world scenario.

Optimization is a full time job!

From time to time, when I have a spare moment, I like to run the game under profiler and see what’s changed since the last test. I do it every 3-4 weeks, roughly, and the basic conclusion is that code is like food - it has an expiration date, later it rots. It doesn’t really matter that just 2 weeks ago you eliminated 1000 cache misses, now they’re back, in a different place perhaps, but total number of misses per frame is almost the same again.

Crunching bytes. Harder.

Been doing some size/layout optimizations again, recently. Cruncher# proves very useful for tracking problems, however it’s not that great when I want to quickly examine the progress. I have to compile/link application again (takes time, especially if modified structure is included from many files) and reload PDB (in case of bigger projects - takes some more time). Luckily, we can force the compiler to do the work for us. It’s possible to configure MSVC to warn about all padding it adds after structure fields.

Ordering randomness

One of the things that game developers hate the most are ‘random bugs’. I’d love to get an euro for every time I got a bug report and when asked how could I reproduce it, received: ‘I don’t know, it’s random’. Thing is, it simply is not true in majority of cases. There are no truly random bugs, they are caused by certain sequence of events. Sure, sequence may be incredibly rare, very unlikely, but usually - it’s not random.

Random links, 31/08/2009

Some interesting links: Recast & Detour libraries. Recast is library that automatically generates navigation meshes from level geometry, Detour is a pathfinding library. Both created by Mikko Mononen. Demosceners may remember his Demopajaa tool (demo authoring tool) or Moppi Productions demos. Pierre Terdiman uses Recast in his Konoko Payne project, you can read about his experiences at his blog. Konoko Payne is a one-man project, Oni-meets-Max Payne game.

Demoscene tribute: Untitled/Dust

Untitled/Dust is IMHO one of the most underappreciated demos ever. Sure, it won The Party 1993, but I don’t think it later got the recognition it deserved. One reason may be that it was quite difficult to launch it on many machines (IIRC) + it required lots of conventional mem (I was lucky enough to have PC that was compatible with this demo, but it required some config.sys+autoexec.bat wizardry). Not as difficult as with Optic Nerve (great demo, as well), but still’ It may be not be the best example of flawless design (to put it mildly), but codewise - it’s amazing.

Blast from the past

I’ve found my old USB stick recently and discovered a nostalgic picture there: That’s a photo I made with my cellphone 27th of August 2007, around 5am. It could as well be titled ‘Final Days of The Witcher’ (well, there still was almost one month ahead). Can wall grew a little bit bigger, but ultimetely has been torn down. Hard to believe it’s been almost 2 years already (coincidentally, the game has just entered Steam Top 10 charts…).