The Documentation Challenge

July 28, 2009 @ 21:58 | In Programming | 2 Comments | del.icio.us digg devbump rss
Image with lots of books

Documentation is the part of the development process where usually less time and money is invested. Few resources implies a poor infrastructure for something that, as the project gets bigger and bigger, becomes a very important part of the overall process.

I want to share in this post the approach we are following for a project I have been involved with for over two years. This project (I will be able to give details about it very soon) is mainly a framework composed of libraries to be used by other companies. Basically, a work from developers to developers, clearly a context where documentation becomes very important.

Click to read the full article »



Compile-Time Strings

April 28, 2009 @ 23:19 | In CodeGems, Programming | 6 Comments | del.icio.us digg devbump rss

It would be nice if we had such a feature in the C language, wouldn’t it? The term ‘compile-time string’ is referred here as strings that are converted to unique integer identifiers at compile time. At run-time those identifiers are simple integers that can be compared and hashed very fast. In other languages, like for example Smalltalk, the concept of Symbol implements a similar idea. The following post describes a possible implementation of this feature in C/C++.

Click to read the full article »



Stripping comments from Shader bytecodes

January 15, 2009 @ 21:37 | In CodeGems, Programming | 1 Comment | del.icio.us digg devbump rss

In DirectX, when compiling a shader with D3DXCompileShader() a buffer containing the shader bytecodes is received. Apart from the bytecodes, extra content like debug and symbol table information is embedded. That extra information is added in form of comments that probably can be eliminated because you are already processing it at compile-time and it is not needed at run-time when loading the shader.

If you can do without that information the following code will help you to save a few bytes, even halving the size of the byte-code in the best cases.

Although not documented in the DirectX SDK, this CodeGem is not an undocumented hack. The Direct3D shader code format is documented in the MSDN, so it probaly won’t change in future revision of DirectX v9.0 (if there is going to be any more…)

D3DPtr<ID3DXBuffer> StripComments(const D3DPtr<ID3DXBuffer>& code)
{
    // Calculates the new size (without comments)
    int* codeData = static_cast<int*>(code->GetBufferPointer());
    unsigned int sizeInWords = code->GetBufferSize() / 4;
    unsigned int strippedSizeInWords = sizeInWords;
 
    for (unsigned int i = 0; i < sizeInWords; i++)
    {
        if ((codeData[i] & 0xffff) == D3DSIO_COMMENT)
        {
            int commentSize = codeData[i] >> 16;
            strippedSizeInWords -= 1 + commentSize;
            i += commentSize;
        }
    }
 
    // Creates a new buffer with the original code but omitting the comments
    D3DPtr<ID3DXBuffer> strippedCode;
    V(D3DXCreateBuffer(strippedSizeInWords * 4, strippedCode.GetPtrForInit()));
 
    int* strippedCodeData = static_cast<int*>(strippedCode->GetBufferPointer());
    size_t offset = 0;
 
    for (unsigned int i = 0; i < sizeInWords; i++)
    {
        if ((codeData[i] & 0xffff) == D3DSIO_COMMENT)
        {
            int commentSize = codeData[i] >> 16;
            i += commentSize;
        }
        else
        {
            strippedCodeData[offset++] = codeData[i];
        }
    }
 
    return strippedCode;
}


Three free productivity booster tools

December 20, 2008 @ 17:30 | In Internet, Programming | 4 Comments | del.icio.us digg devbump rss

We, as programmers, see optimization opportunities everywhere, and more when they can be applied to our work tool, the computer. What follows is an enumeration of three tools that will save you precious time in your daily work. To me, they have become indispensable tools. Hope they will become the same for you:

  • Launchy. Launchy is a keystroke launcher that clones the behaviour of Quicksilver in Mac OS. With this tool you will say goodbye to your start menu and desktop icons. Everything is now accessible from a few keystrokes: folders, applications and even websites, all with a simple alt + space. The perfect complement for Launchy is StartKiller, a tool for removing the Start button from the taskbar. To me, Launchy is as revolutionary as 4DOS was back in MS-DOS days. How much time did you save? (bonus: and now that you can have a 100% clean desktop it is time to use a decent wallpaper…).
  • AutoHotkey. Whatever can not be done with a few launchy keystrokes most likely can be programmed with an AutoHotkey macro. AutoHotkey incorporate a powerful script language that will allow you to automate almost anything: instant access to disk folders, internet tabs, activate tray programs, change visual studio layouts, send email, check calendar, etc.
  • xplorer². xplorer² is a file manager with enough features to say good bye to Windows Explorer (Microsoft, admit it, it is not designed for advanced file manipulation). Although there is a professional version, the free lite version is enough to me, especially the Tabbed dual-pane interface feature. With AutoHotkey you can easily redirect Win + E to xplorer².

And that closes out my small contribution to reduce energy wastage in the world 8-) . I am sure you can share more gems like these. One more time, thanks for reading.



Hacker’s Delight

November 4, 2008 @ 4:56 | In Books, Hacking, Programming | 11 Comments | del.icio.us digg devbump rss
Hacker's Delight book image

Hacker’s Delight
Author: Henry S. Warren, Jr.
Pages: 306
Published: 2003

You may think that I have become obsessed with books about hacking but this book is totally different from any of the others. In this book the term hacker is meant in the traditional sense (before the negative definition was popularized) of someone interested in understanding how things work and how to solve problems efficiently. Although the hacker term can be applied to whatever domain, in this book the domain is computing technology.

‘Hacker’s Delight’ is a book about bits and small programming tricks applied to machines. With ’small’ I mean that you won’t find here a description of the Merge sort or Radix sort but, for example, you will learn to determine in constant time if an integer is a power of two or not.

In more that 300 pages and with a mixture of pseudo assembler and C you will find all kind of tricks for arithmetic bounds, counting bits, searching bits, multiplications, elementary functions, floating point, etc. Even wondered if the base2 used by computers is the most efficient? This question and a lot more are covered in this book.

Although the book is a little bit oriented towards compiler developers, every ‘real’ programmer can get a huge benefit from reading and thoroughly understanding this book.

I read this book on several flights and really enjoyed this little gem book of tricks. I would definitely recommend to have it in your bookshelf.

Rating: 8 / 10



Tangential Software Usage

September 30, 2008 @ 9:30 | In Internet, Programming | 6 Comments | del.icio.us digg devbump rss
Image for Tangential Software Usage article

As you probably know I am working in a very small (3) team through internet. We do not share a physical place and we have very limited resources. All the infrastructure is based on servers we have at our own home (code repository, wiki, bug tracking service, build machines, web server, backup machines, NAS servers, etc). As you can imagine, we try to optimize our time and bandwidth as much as possible. I want to share with you in this post two examples of this optimizing philosophy with the idea of discussing them and discovering other interesting usages you may be doing (if you want to share of course)

  • Twitter: I like to know where the rest of the team is working on. We have weekly voice meeting, we have emails and IM accounts but that is not enough to know with precision where each part is working on. Twitter, a micro-blogging service you probably know is ideal for this purpose. We have private twitter accounts (nobody out of the team can read it) where we update or current status: developing a new package, fixing a ticket, writing documentation, meeting a client, etc. With a simple look at your twitter account you get the status of the team.
  • Dropbox: I am absolutely impressed with this software. If you don’t know about it I recommend that you have a look at its tutorial. The service is incredibly simple to use and it just works without problems. We have created a dropbox account for internal distribution and testing of our binary releases. Our build machine copy each generated distribution to a shared dropbox folder. This dropbox folder is shared with our team giving us the following advantages:
    • Every member on the team have the binaries everywhere and in all machines we want to test.
    • Logs for each execution are saved in the shared folder and are automatically synchronized in all the accounts. The logs give us useful information about the execution of the software that every developer can inspect.
    • Crashes are stored as minidumps in that same folder. And, as we distribute pdb with our releases, this means that everybody in the team can open any dump from any release and reproduce the exact crashing conditions everywhere. For more information about symbols, read my previous article about Setting up a Symbol Server

Do you have more interesting related ideas? Please, share them with us.



Practical Efficient Memory Management

August 19, 2008 @ 3:26 | In Programming | 27 Comments | del.icio.us digg devbump rss
Gamelab 2008

A good memory management architecture is one of those key features that can make the difference between a successful application and an unsuccessful one. For realtime applications the memory architecture becomes critical. This article discovers how memory management is more than tracking where your malloc() and free() are located. Although the focus will be on realtime applications implemented in C, all the techniques described here can be translated to other scenarios because the terms described are language-independent.

The best memory management is doing no allocation at all. You should architect your software to minimize the interaction with the memory manager. In the past that was a realistic option but in modern architectures that objective becomes harder to achieve. Modern requisites for realtime architectures like, for example, content streaming or hot loading force us to have frequent interactions with the memory manager. This article describes how this can be done efficiently. The ideas provided plus the links to other articles will give you enough information to implement your own solution. No downloadable code is provided with this article but if you need help implementing the ideas described here do not hesitate to contact the author.

Click to read the full article »



GameLab 2008

June 27, 2008 @ 2:01 | In Programming, Videogames | 8 Comments | del.icio.us digg devbump rss
Gamelab 2008

Oviedo will hold the fourth edition of the GameLab conferences on July 10th – 11th. Undoubtedly the place to be if you want to meet lot of interesting people related to the Videogames industry. This event is growing bigger and bigger each time and is becoming a point of reference here in Spain.

Like the last year I will be giving a course on Advanced real-time 3D techniques the first day.

Hope to see you there! :)



Teaching at Oviedo – Noesis Engine

April 23, 2008 @ 11:23 | In Programming, Videogames | 9 Comments | del.icio.us digg devbump rss
Jesus teaching at Oviedo University

This weekend just finished the course I have been giving at the Oviedo University. The course is about programming graphic engines for videogames. In 30 hours / 6 days I tried to explain how to architect a solid engine for realtime purposes.

This is the first time I talk about the task I have been involved in the last months: Noesis Engine (a provisional name). Till now, it has been developed by a very small team and contributed to two commercial products. A small videogame is under construction now. I expect to give more information about this in the future.

A link to the first session of the course: Noesis – Core. The document reveals not too much information if you are not attending the class, but may be you find something interesting there (or wrong, and we can discuss). The first part is a global introduction to the course, the second one is about the core technology being used for the rest of the course. The document is in Spanish, I have no time now to translate it (I would be really grateful to any volunteer helping in this). Sorry for that.

And following with Spanish documents, I contributed to several tutorials in codepixel, a daily mandatory read if you understand Spanish, about the same topic, Graphics in Realtime. The hard part was done by Javier Loureiro / derethor. Iq / RGBA helped to this documents too, The tutorials:

And nothing more for today. As you can see I am still alive and working really hard. :)

UPDATE: Thanks to Ricardo Amores and Miguel Herrero for translating the powerpoint to English. It can be downloaded from: Noesis – Core – Eng



Implementing a Graphic Driver Abstraction

March 3, 2008 @ 19:26 | In Programming | 8 Comments | del.icio.us digg devbump rss
A screenshot from a mesh in wireframe mode

If you are a graphic programmer you have probably implemented lot of times what I will refer here as the graphic driver of the engine. The graphic driver is an abstraction over a low level graphic API like DirectX, OpenGL, libgcm, etc. I want to dedicate this article to some ideas and rules that have worked fine for me in the past when implementing this part of an engine. Probably your mileage may vary, so the comment section is open to discuss any detail you want.

Click to read the full article »



Sat, 07 Nov 2009 18:01:52 +0100 / 20 queries. 1.976 seconds / 5 Users Online

gentoo link wordpress link apache link PHP link

Theme modified from Pool theme. Valid XHTML and CSS