Comments on: Refactoring for Task Concurrency In games, you only care if it looks right, not if it actually is right. In this case, we're rendering while the texture is loading. We might want the screen to render with all the right shapes, but maybe with the wrong textures. Or, maybe even without the meshes. What matters is we don't render anything that looks wrong: which just means only render correctly part-loaded data, or textures that say "loading". And we want the system to be responsive, so it must keep rendering and responding to user input while loading.Most game developers will have fiddled things to get them to look right. In the past, I worked out that objects (and even parts of the land) could just be moved left and right as the camera moved. It wasn't necessary to do a re-projection (which involved an expensive matrix-multiply-and-division) on far objects every frame. Most frames, you could just move vertices, and then reproject them occasionally. You could hardly tell the difference. What was noticeable was gaps between sections of land, which had to be corrected by copying vertices from one land block to another. In the far distance, you could completely get rid of perspective altogether and just do a matrix multiply. The data was "incorrect", but you couldn't tell the difference. You could tell that you could see further than you could in other games of the time. In games, you only care if it looks right, not if it actually is right. In this case, we’re rendering while the texture is loading. We might want the screen to render with all the right shapes, but maybe with the wrong textures. Or, maybe even without the meshes. What matters is we don’t render anything that looks wrong: which just means only render correctly part-loaded data, or textures that say “loading”. And we want the system to be responsive, so it must keep rendering and responding to user input while loading.Most game developers will have fiddled things to get them to look right. In the past, I worked out that objects (and even parts of the land) could just be moved left and right as the camera moved. It wasn’t necessary to do a re-projection (which involved an expensive matrix-multiply-and-division) on far objects every frame. Most frames, you could just move vertices, and then reproject them occasionally. You could hardly tell the difference. What was noticeable was gaps between sections of land, which had to be corrected by copying vertices from one land block to another. In the far distance, you could completely get rid of perspective altogether and just do a matrix multiply. The data was “incorrect”, but you couldn’t tell the difference. You could tell that you could see further than you could in other games of the time.

]]>
By: dvyukov/2011/02/03/refactoring-for-task-concurrency/#comment-426 dvyukov Sun, 06 Feb 2011 08:00:37 +0000 dvyukov: I do like the term incorrect; it certainly isnt deferred processing (although the example here is, and the middleware section from my last post), and double buffering isn't even in the same category in my opinion. Relativistic system is a possability. Although it is more like non determinism - if you were to flatten the task graph of a frame into a single serial execution (taking into account for dependencies) then that would be the correct result, everything computed by the time you needed it. Incorrect may not be a great name in academic terms, maybe near-correct is better?Renders can be complex beasts - Arseny has explained it well there. It could lead to rather nasty lockups. Remember this is an Asset Loader - it can load meshes too!I would be interested in hearing how you would deal with the list example when something was to go wrong (maybe a mid-list insert?). Without locks of course! :) dvyukov: I do like the term incorrect; it certainly isnt deferred processing (although the example here is, and the middleware section from my last post), and double buffering isn’t even in the same category in my opinion. Relativistic system is a possability. Although it is more like non determinism – if you were to flatten the task graph of a frame into a single serial execution (taking into account for dependencies) then that would be the correct result, everything computed by the time you needed it. Incorrect may not be a great name in academic terms, maybe near-correct is better?Renders can be complex beasts – Arseny has explained it well there. It could lead to rather nasty lockups. Remember this is an Asset Loader – it can load meshes too!I would be interested in hearing how you would deal with the list example when something was to go wrong (maybe a mid-list insert?). Without locks of course! :)

]]>
By: Arseny Kapoulkine/2011/02/03/refactoring-for-task-concurrency/#comment-424 Arseny Kapoulkine Sat, 05 Feb 2011 12:27:14 +0000 dvyukov: In my case the deferred processing is due to some steps of loading having to be done in the main "renderer" thread, where OpenGL was initialized (texture uploads, shader creation). dvyukov: In my case the deferred processing is due to some steps of loading having to be done in the main “renderer” thread, where OpenGL was initialized (texture uploads, shader creation).

]]>
By: dvyukov/2011/02/03/refactoring-for-task-concurrency/#comment-422 dvyukov Fri, 04 Feb 2011 06:56:39 +0000 Regarding the list example, it's unclear what's wrong with it. I can modify a list concurrently with other operations, and most of the time it won't cause any problems, because the list is consistent all the time (regardless of the fact whether a reader notices a new node or node). Regarding the list example, it’s unclear what’s wrong with it. I can modify a list concurrently with other operations, and most of the time it won’t cause any problems, because the list is consistent all the time (regardless of the fact whether a reader notices a new node or node).

]]>
By: dvyukov/2011/02/03/refactoring-for-task-concurrency/#comment-420 dvyukov Fri, 04 Feb 2011 06:47:52 +0000 This is exactly how I am doing it in my resource loading code, and it works good :) This is exactly how I am doing it in my resource loading code, and it works good :)

]]>