Everything is malware

Posted in Uncategorized on January 31st, 2009 by admin

Right now google.de and google.com have a rather annoying defect. They think every site is malware and wont direct you to this site. Even when you google for google, google is telling you that this site, in this case google.com,  may harm your computer. I would find this rather funny if I wouldnt need google right now.

This shows that the google malware system is probably really broken.  One possibility is that someone used an * to describe which sites are malware or there is an error in the algorithm or there malware detection server are down and without them everything is marked as a malware just to be sure.  I hope the last idea isnt true, because this would be a really bad design choice in my eyes.

Update:

Now google forbids me to go to a site with this error message:

Your client does not have permission to get URL /interstitial?url=http://premake.sourceforge.net/about from this server.

And one minute later it works :)

Books to read: The pragmatic programmer

Posted in Books to Read on January 30th, 2009 by admin

So 2 days late, my review of the old classic “The pragmatic programmer“.  This week I was able to get this book from my local library and it is pure gold. Every programmer should read it if he hasnt already. The book contains a collection of tips and tricks on how to become a better programmer. Some of them are rather obvious like using source control. The book is old, so maybe when it was published it wasnt  normal to use source control like these days. Besides obvious tips there are a lot of great ones,  like how to make your code testible, why you should use design by contract and how to do refactoring right. All the information can be found in other books as well, but this books destills and collects them.  Each tip is coverd in four to six pages making it perfect to read before you go to bed or during a small break.

One thing I found amusing while reading was that they described the techniques I use for my game framework completely.  I want to try design by contract in the near future, it sound helpfull but I dont know how to use it in C++. There are some librarys which implements the needed features, but they dont look that good to me.  And before this I have to finish writting Unittests for my framework, another tip in this book, which I already did before reading it :).

Additional information to Visual Assist X

Posted in Uncategorized on January 25th, 2009 by admin

This weekend I found a very interesting blog which started reviewing programming tools . The first review was about Visual Assist X which I love and it seems the author does too.  So if you want to know why he loves it, read his blog. He also describes a bit more about Visual Assist X and what features he uses. All in all its an interesting post.

http://smaton.blogspot.com/

Networking and why you should do it

Posted in Uncategorized on January 22nd, 2009 by admin

As a programmer I try to belief that when you get a good job offers it is because you are simple a good programmer. This isnt entirely true, much more important is your network and how you try to maximize you opportunities. Skill plays a big part in this, because if you suck at programming nobody important/interesting is going to waste time talking to you. But once you have reached a certain level you will get some offers and often they will be unexpected. Of course there are different level, if you are a student and a hobby game developer there simply wont be a person offering you a job as lead programmer. But their might be a person who asks if you are interested in writing an article about the hobby gamedeveloper scene in Germany for a national developer magazine. This happened to me and from their on I wrote an article about the GCDC every year for them. Or you submit a small paper you have writen in your freetime to a conference just to get some feedback on how to improve it and get accepted.

Most people would think this is luck, which is almost totally wrong, luck does play a small role. But much more important is that you try to be in a position where “luck” can help you to get interesting offers. Go to conventions, conferences, local game developer meetings and talk with other people. But be carefull, dont run around asking every person you meet if their have a job for you, just talk about you, what your interests are and get to know as much as possible about the other person, it will someday be helpful. And besides all these arguments, talking to other game developer is fun

Books to read: The Cg Tutorial

Posted in Books to Read on January 19th, 2009 by admin

For anyone who is interested in learning how to program graphic cards using shaders I would suggest reading The Cg Tutorial. CG is a programming language from nvidia which has a similar syntax like c and comes with a great set of tools, like  FX Composer. The Cg Tutorial is also from nvidia and covers all basics needed to create shaders using cg. With the book comes a learning tool, which encapsulate all the details and just let you copy and modify the examples shaderes used in the book. I find this a great way to teach shaderprogramming, because it protects you from all the details which normally stops you from actual writing shaders.

I bought this book some months ago and started reading it some weeks ago and it is simply great, easy to understand, even if you dont have all the needed mathematical basics. And if you already know how to program, which Im sure you do, otherwise shaders wont be any use to you, cg is easy to pickup and to use.  Difficult is to tweak the shaders so they look good and have a decent performance, but there are other books which cover these topics

Mirrors Edge

Posted in Uncategorized on January 16th, 2009 by admin

I bought Mirrors Edge today and it is good, not fantastic but good and something new, so it makes a lot of fun. But there is one bug I find very annoying. During the synchronization of the German version, they apparently managed to make the ambient noise louder than the person which is speaking. So I just gave up following the story.

Another annoying thing is that a there isnt a easy way to restart a race in the time race game mode. Time race is a mode where you can run against the clock in already finished levels. Your time is also submitted to a server and you can compare yourself to other players. So I try to find the best possible route, which is often the most difficult, so I need to restart often. To restart I need to press escape, select restart race and then press ok. Why isnt there a key for this , like in Trackmania the delete key. I hope for an update an will contact Dice about this.

Tags:

Unittesting

Posted in testing on January 13th, 2009 by admin

For my game framework Hinge3D Im using unittesting to test my core classes. This helps me refactoring my code without breaking it unwillingly. I hope every programmer who reads this know what unittesting is, otherwise go and read about it. I tried several different unittesting frameworks and it took me a long time to find a decent one,Boost::Test. Boost::Test uses functions to define new testcases, most other frameworks I tried only offered macros to do this. It also supports a treelike structure for testcases, allowing me to run only the testcases which are relevant to my current changes, which saves a lot of time.

Another nice feature of Boost::Test is that every testcase detects memory leaks, so during testing I can be sure that I dont introduced new memory leaks in the core of the framework. Another good thing about unittesting is that you can use it as regression tests. That means you write a testcase for every bug you fix, preventing that the same bug is introduced back in the codebase during later refactoring of bugfixing. If probably used unittesting is an important tool to create bugfree code and keep the code bugfree.

Tags: ,

Code completion to the rescue

Posted in programmming on January 10th, 2009 by admin

Often when talking about programming many programmers, especially Linux programmers, say they dont use a IDE, which I find rather disconcerting. After asking them you often hear things like:

  • I dont need such fancy things, it distracts from the real programming.
  • Im working on Linux, there is a different tool chain from windows, we dont need IDEs we have vim and make.

This itself are valid arguments and I dont think everybody needs an IDE, but everybody needs code completion, if he isnt working on a small project with just a few hundred lines of code. It doesnt matter it the code completion is done by a IDE or by an text editor like vim or emacs. The important thing is that you use code completion, and a good code completion.

What is a good code completion

With good I mean a code completion which knows the following

  • which files you are using
  • which library you are linking to
  • which header to you include
  • and so on.

Not a simple one that just knows what you have written in this file and offers you only keywords from this file. Also very important is that the code completion sorts the proposed word using an intelligent algorithm, which takes into consideration what you have written the lines before, often you want to use a variable after defining it but also offers syntax based proposals, like variables if you writing a for-loop and class names if you are inheriting.

The code completion should also be namespace aware and for me the most important point, be always be shown. I dont want to ctrl + space to get a proposal,  I want a small pop up window below my cursor which is always there and offers a proposal which is accurate enough that I only need the write 3 or 4 characters before hitting enter and let the code completion to its work.

My favorite code completion systems


Of course what Im describing is the ideal code completion, which wont ever exist, but there are some which are pretty close to my description, for one there is Code::Blocks which has a good code completion, the sorting is often suboptimal and it only works if you have types two or more characters, but besides these point it works pretty good, much bettern then the eclipse c++ code completion.

My favorite is Visual Assist X, a Visual Studio plugin, which does everything almost perfect, but has sometimes problems and wont react at all while waiting for the parsing result, but this happens once a month or so and takes just 30 secs to wait, so nothing really bad. Sometimes its just wrong, especially if templates are involved, but I havent seen a code completion which handles them always correctly. Maybe there are some vim or emacs plugins which do code completion, but I havent found them or found somebody how uses them with all the above described features. Often it is more like a simple code completion.

Use the power


But if you have a really good code completion it fantastic, it just doesnt saves you some typing, it is a form of documentation. Often I dont know what the name of the function is, only some bits, my code completion will help me. I dont have to remember all the parameters and what they are doing, my code completion helps me there to. With a good code completion I dont have to use the documentation of librarys most of the time, only when I need a totally new function. This is even more true when the author of the library used doxygen comments, my code completion shows them to me and this helps a lot. So every programmer how dont want to spend his time looking up functions and parameters should try to get his hands on a good code completion.

Tags: ,

Books to Read: GPG

Posted in Books to Read on January 7th, 2009 by admin

I have a bookshelf full of programming books, so I was surprised that apparently not every programmer has at least some books he read to gain some new knowledge. Coding Horror has a interesting article about it with whom I fully agree: http://www.codinghorror.com/blog/archives/001108.html . On this blog there is besides great posts a list of books every programmer should know and read at least one time. The list is excelent, but is naturally missing some game programming books, game programming being not the author’s focus. I will extend this list here with some game programming specific books I have read and found useful for me.

I start with a series of book every game programmer should have and consult before solving a game specific problem, often the answer is in these books. Of course Im talking about the Game Programming Gems series. Right now there are 7 books, each in its own an irreplaceable helper for me. Each book consists of several article covering game programming topics like general programming techniques, graphics, network and more. Not every article is interesting or helpful, but there are some gems in each of them which influenced my work and design approaches. My game framework Hinge3D is based on a combination of two design ideas, each of these two where explained in a game programming gems article. Every time I encounter a problem in my projects I take a look in the table of content of sometimes there is already a solution to look up. But not only directly usable solution makes these books excellent, there are also many interesting ideas which might not be of any help for a existing problem, but chance the way how you thing about certain aspects of the game development or give you some great ideas how to improve your own work. All in all this is a must have for all game programmers and Im eagerly waiting for the 8th book.

At the end the links to amazon
Game Programming Gems 1
Game Programming Gems 2
Game Programming Gems 3
Game Programming Gems 4
Game Programming Gems 5
Game Programming Gems 6
Game Programming Gems 7

If you dont want to buy all of them, there is a “Best of Game Programing Gems” book which contains a selection of articles from the first six books
Best of Game Programming Gems 1-6

Tags: ,

Automated doxygen comments

Posted in documentation on January 4th, 2009 by admin

Writing code is fun, thats why we are programmers. Documenting code isnt fun, thats why there are so much undocumented or badly documented code in this world. Every programmer always says he want to document the code he is writing after he has finished just this small feature or fixed a little bug. Often this means code doesnt get documented at all, I know this is true for me, so Im trying to document code at the same time Im writing it. This helps to document every piece of code Iwrite, but It also slows down the development process and if I want to finish a new feature and see it in action Im also tempted to document this little piece of code later and finish the feature. To prevent this from happing, documenting ,my code should be as easy and fast as possible. Its is always important to lower the barrier for tasks that arent fun so you do them nevertheless because it isnt much work.
I use doxygen to generate the code documentation directly from my code. I hope everybody who programs in C++ knows doxygen, otherwise go and read about it: http://en.wikipedia.org/wiki/Doxygen. The only problem is that sometime it is tiresome to write doxygen keyword in the comments to document the code. They are often always the same, especially for functions. So I thought it would be nice to automated the documentation process so I can press a hotkey and my IDE creates all the doxygen keyword to document a function for me and I just have to fill in the actual documentation at the right places. Using Visual Studio and Visual Assist X there was a easy way to do this. Visual Assist X already parses your code and gives you the option to write your own macros. Now when I wrote a function, I select the functionname and simply press Alt + D and behold, above the function the doxygen code is insert.
As an example let us take a look at this function:
void subscribeToMessageList(HINGE::String listname,HINGE::String funcname,pBasic_MessageFunction func);
The generated doxygen code looks like this

/// \fn  void HINGE::COMS::Basic_Component::subscribeToMessageList(HINGE::String listname,HINGE::String funcname,pBasic_MessageFunction func)
/// \brief
/// \param listname
/// \param funcname
/// \param func
/// \return   void

It isnt perfect because this functions doesnt have a return value so I have to deleted it by hand, but it save a lot of time. Now I only have write a brief description of the function after the \brief and describe every parameter with a short sentence. After having this macro Im tending to document code during writing it, because it doesnt cost much time and is easy. If you use Visual Studio and have Visual Assist X try the macro code below. If you use Visual Studio and dont have Visual Assist X go and buy it, it saves a lot of time you can use to develop. If you dont have Visual Studio, Im sorry I cant help with already finished macro, you have to write it yourself.

Here is the macro code:

/// \fn  $SymbolType$ $SymbolContext$($ParameterList$)
/// \brief
/// \param $MethodArgName$
/// \return   $SymbolType$

Update:
Another way to write the doxygen comments is using this script which will create the same documentation and looks a bit nicer, thanks to fkrauthan for this tip.

/**
* @brief
* @param $MethodArgName$
* @return $SymbolType$
*/

Tags: ,