I am starting to wonder if I will complete my list of tasks before Xmas ...
The best method seems to be to work with a Todo list, basically a notepad document that contains lists of bugs found during test sessions. If I spend too much time on the Todo list I sometimes find myself writing down things that can be fixed in a matter of minutes, so the list isn't my main focus of attention.
Wednesday, 21 December 2011
Tuesday, 20 December 2011
Back to the Old Skool with D3D9
I remember an early problem with D3D9 rendering windows was that the viewport projection matrix would resize everything in the viewport if and only if the window was resized vertically and not horizontally. This is the fault of the limited functions Direct3D supplies for manipulating projection matrices. I recently decided to delve into the mathematics for 5 minutes and found this quick fix for my display system ... the fault occurs when the screen resizes ... here is some code ...
[code]
/*
D3DXMatrixPerspectiveFovLH( &matProj, D3DXToRadian( 45.0f ),
(float)w / float(h), 0.1f, 100.0f );
produces this matrix:-
xScale 0 0 0
0 yScale 0 0
0 0 zf/(zf-zn) 1
0 0 -zn*zf/(zf-zn) 0
where:
yScale = cot(fovY/2)
xScale = yScale / aspect ratio
*/
/*
D3DXMatrixPerspectiveLH(&matProj,
(float)w, float(h), 1.0f, 100.0f );
produces this matrix:-
2*zn/w 0 0 0
0 2*zn/h 0 0
0 0 zf/(zf-zn) 1
0 0 zn*zf/(zn-zf) 0
*/
// the solution - to have a Field of View parameter using the top matrix this will fix the problem.
D3DXMATRIX matProj;
if( w > h )
{
D3DXMatrixPerspectiveFovLH( &matProj, D3DXToRadian( 45.0f ),
(float)w / float(h), 0.1f, 100.0f );
}
else
{
D3DXMatrixPerspectiveFovLH( &matProj, D3DXToRadian( 45.0f ),
(float)h / float(w), 0.1f, 100.0f );
float temp = matProj._22;// =
matProj._22 = matProj._11;
matProj._11 = temp;
}
[/code]
as shown the xscale and yscale parameters do not depend upon the values of x and y, and so they can be swapped. Additionally the aspect ratio must be h/w if the height is greater than the width.
(I don't know if anyone actually reads this).
[code]
/*
D3DXMatrixPerspectiveFovLH( &matProj, D3DXToRadian( 45.0f ),
(float)w / float(h), 0.1f, 100.0f );
produces this matrix:-
xScale 0 0 0
0 yScale 0 0
0 0 zf/(zf-zn) 1
0 0 -zn*zf/(zf-zn) 0
where:
yScale = cot(fovY/2)
xScale = yScale / aspect ratio
*/
/*
D3DXMatrixPerspectiveLH(&matProj,
(float)w, float(h), 1.0f, 100.0f );
produces this matrix:-
2*zn/w 0 0 0
0 2*zn/h 0 0
0 0 zf/(zf-zn) 1
0 0 zn*zf/(zn-zf) 0
*/
// the solution - to have a Field of View parameter using the top matrix this will fix the problem.
D3DXMATRIX matProj;
if( w > h )
{
D3DXMatrixPerspectiveFovLH( &matProj, D3DXToRadian( 45.0f ),
(float)w / float(h), 0.1f, 100.0f );
}
else
{
D3DXMatrixPerspectiveFovLH( &matProj, D3DXToRadian( 45.0f ),
(float)h / float(w), 0.1f, 100.0f );
float temp = matProj._22;// =
matProj._22 = matProj._11;
matProj._11 = temp;
}
[/code]
as shown the xscale and yscale parameters do not depend upon the values of x and y, and so they can be swapped. Additionally the aspect ratio must be h/w if the height is greater than the width.
(I don't know if anyone actually reads this).
Thursday, 15 December 2011
Better debugging
Amazing how a completely fresh copy of windows xp will complain about the slightest code problems ...
My app on windows 7 has a constructor for a graphical pane and the graphical pane has member variables
int w; // screen width
int h; // screen height
now the constructor has an error,
int w = this->GetWidth();
int h = this->GetHeight();
and this is incorrect because they are already declared in the class definition. But the constructor already works in Windows 7!!??!!
My app on windows 7 has a constructor for a graphical pane and the graphical pane has member variables
int w; // screen width
int h; // screen height
now the constructor has an error,
int w = this->GetWidth();
int h = this->GetHeight();
and this is incorrect because they are already declared in the class definition. But the constructor already works in Windows 7!!??!!
Friday, 9 December 2011
UI tutorial
http://wiki.eclipse.org/User_Interface_Guidelines
The part about icon lighting is very interesting ... also I can just imagine a tooltip that says something like
"DO NOT PRESS THIS BUTTON" causing a crash in a demo .... LoL
The part about icon lighting is very interesting ... also I can just imagine a tooltip that says something like
"DO NOT PRESS THIS BUTTON" causing a crash in a demo .... LoL
Friday, 28 October 2011
Google Chrome or Chromium
I found out yesterday that Google Chrome (also called Chromium) is open source ... I decided to look at the code ...
This experience made me realize that using design patterns, macros, heavy object orientation can be good, but also that it can be a bad thing. Google Chrome is such a large scale project that the leading developers need to use object orientation to that extent, but in small scale projects (i.e. solo projects) there is nothing wrong with using code like
if( A ) then B
else if ( C ) then D
instead of using objects for the same simple purpose. The point I realized is that just because it is heavily object oriented does not mean that the logic is correct.
The question is really, what should a solo developer do when faced with the task of writing a potentially commercial app? Heavy object orientation or good plain 'ol code? I am really not sure. I think that actually the good plain 'ol code technique is much more flexible ... so perhaps old-school procedural programming (i.e. everything in one big page of logic) will make a come-back later with the title "flexi-code".
This experience made me realize that using design patterns, macros, heavy object orientation can be good, but also that it can be a bad thing. Google Chrome is such a large scale project that the leading developers need to use object orientation to that extent, but in small scale projects (i.e. solo projects) there is nothing wrong with using code like
if( A ) then B
else if ( C ) then D
instead of using objects for the same simple purpose. The point I realized is that just because it is heavily object oriented does not mean that the logic is correct.
The question is really, what should a solo developer do when faced with the task of writing a potentially commercial app? Heavy object orientation or good plain 'ol code? I am really not sure. I think that actually the good plain 'ol code technique is much more flexible ... so perhaps old-school procedural programming (i.e. everything in one big page of logic) will make a come-back later with the title "flexi-code".
Friday, 21 October 2011
Text Control Blues
I found out earlier that I was calling GetTextExtent( textString, &length, &height, &extent )
on an empty string! The "height" variable was very important to my program.
on an empty string! The "height" variable was very important to my program.
Friday, 7 October 2011
Website unsused ...
I am thinking about improving the theme on this page (still unused). The problem is that the site layout is very art-dependant.
http://superlifefood.co.uk/
http://superlifefood.co.uk/
Monday, 3 October 2011
Blue Screen of Death!
The windows 8 blue screen of death has a new face ...
http://www.digitaltrends.com/computing/windows-8-blue-screen-of-death-gets-a-revamp-and-a-sad-face/
This means your computer is badly broken ...
Anyway ... here are some images of the older blue screens...
http://www.google.co.uk/search?q=blue+screen+of+death&hl=en&biw=1366&bih=667&prmd=imvns&tbm=isch&tbo=u&source=univ&sa=X&ei=c3iKTrjYBeit0QX167C9BQ&sqi=2&ved=0CFgQsAQ
http://www.digitaltrends.com/computing/windows-8-blue-screen-of-death-gets-a-revamp-and-a-sad-face/
This means your computer is badly broken ...
Anyway ... here are some images of the older blue screens...
http://www.google.co.uk/search?q=blue+screen+of+death&hl=en&biw=1366&bih=667&prmd=imvns&tbm=isch&tbo=u&source=univ&sa=X&ei=c3iKTrjYBeit0QX167C9BQ&sqi=2&ved=0CFgQsAQ
Tuesday, 20 September 2011
Interesting tools
Some interesting tools available for catching chess cheaters,
http://chesstools.wordpress.com/
The tool still only processes to depth 3, however the results show that known cheaters do show up ... I tested this and hopefully some updates will be available soon.
http://chesstools.wordpress.com/
The tool still only processes to depth 3, however the results show that known cheaters do show up ... I tested this and hopefully some updates will be available soon.
Sunday, 10 July 2011
Cross Platform Game Editor
http://game-editor.com/Main_Page
This software makes game creation easier and allows developers to port the game to other platforms, including PC, Mac, Linux, Iphone, IPad, Windows phones, Handheld PC's, GP2X.
I think there is also an android port available on the site - in fact they supply a service for ports, and the sourcecode is available for developers.
This software makes game creation easier and allows developers to port the game to other platforms, including PC, Mac, Linux, Iphone, IPad, Windows phones, Handheld PC's, GP2X.
I think there is also an android port available on the site - in fact they supply a service for ports, and the sourcecode is available for developers.
Monday, 4 July 2011
The battle against Flicker
Not the website that stores photographs - this is the battle against flickering windows ...
The old way to fix window flickering was to use double buffering, this basically means that the text/images are drawn onto a picture (called a buffer) instead of to the screen, the flickering is removed because the Paint() function does not draw the new buffer, and instead draws the old buffer. The new buffer is drawn on the next frame and the old buffer is recycled so there is always an offscreen buffer ready to be drawn to. This technique is perfectly fine since humans are ok watching a 30 frame per second video game, or even a 24 frame per second DVD.
So I found an interesting way to combat the flickering of rapidly updating windows without actually writing a double buffer ...
http://wiki.wxwidgets.org/Flicker-Free_Drawing
The old way to fix window flickering was to use double buffering, this basically means that the text/images are drawn onto a picture (called a buffer) instead of to the screen, the flickering is removed because the Paint() function does not draw the new buffer, and instead draws the old buffer. The new buffer is drawn on the next frame and the old buffer is recycled so there is always an offscreen buffer ready to be drawn to. This technique is perfectly fine since humans are ok watching a 30 frame per second video game, or even a 24 frame per second DVD.
So I found an interesting way to combat the flickering of rapidly updating windows without actually writing a double buffer ...
http://wiki.wxwidgets.org/Flicker-Free_Drawing
Sunday, 3 July 2011
GPL issues and the end of the Chess Engine Controvesy
This is all over the internet over the last couple of days
Rybka Banned
And the forums are full of people discussing and commenting, here is the Rybka forum:-
http://rybkaforum.net/cgi-bin/rybkaforum/topic_show.pl?tid=22232
I think the main problem is that the Engine was entered into the World Computer Chess Championships when it was first released, for version 1 and 2, and at this stage it still contained code from 2 influential Open Source programs. The rules of the International Computer Games Association required that the contenders admitted when their programs were based on other sources, and this was not admitted by Rybka. After a release of a decompiled version it was found that Rybka was very similar to an engine named fruit, and also contained codes from Crafty. So eventually after more than 5 years Rybka has been disqualified based on accumulated evidence.
There is also the problem of the GPL (General Public Liscence), which requires that if GPL codes are used in a program that the source of the new program should also be released, and the authors given credit. This was not the case with Rybka however.
An interesting case is the fact that an Engine named IPPOLIT was released that claimed to be stronger than Rybka. The Author of Rybka, Vasich Rajlich claimed that the IPPOLIT sources were his code and that it was stolen from his computer or decompiled from a Rybka executable. It is interesting that since he claimed this on his forums he could arguably be in accordance with section 6.b of the GPL. A look at the site for IPPOLIT shows that the group responsible for the release call themselves the Decembrists (Russian revolutionary link) and claim to be waging a software war against the capitalists. This could in fact be a clear contempt for the GPL because after all GPL code is usually free.
Rybka Banned
And the forums are full of people discussing and commenting, here is the Rybka forum:-
http://rybkaforum.net/cgi-bin/rybkaforum/topic_show.pl?tid=22232
I think the main problem is that the Engine was entered into the World Computer Chess Championships when it was first released, for version 1 and 2, and at this stage it still contained code from 2 influential Open Source programs. The rules of the International Computer Games Association required that the contenders admitted when their programs were based on other sources, and this was not admitted by Rybka. After a release of a decompiled version it was found that Rybka was very similar to an engine named fruit, and also contained codes from Crafty. So eventually after more than 5 years Rybka has been disqualified based on accumulated evidence.
There is also the problem of the GPL (General Public Liscence), which requires that if GPL codes are used in a program that the source of the new program should also be released, and the authors given credit. This was not the case with Rybka however.
An interesting case is the fact that an Engine named IPPOLIT was released that claimed to be stronger than Rybka. The Author of Rybka, Vasich Rajlich claimed that the IPPOLIT sources were his code and that it was stolen from his computer or decompiled from a Rybka executable. It is interesting that since he claimed this on his forums he could arguably be in accordance with section 6.b of the GPL. A look at the site for IPPOLIT shows that the group responsible for the release call themselves the Decembrists (Russian revolutionary link) and claim to be waging a software war against the capitalists. This could in fact be a clear contempt for the GPL because after all GPL code is usually free.
Interesting Program On Alta Vista
I have to admit I haven't used Alta Vista much recently, however after googling for a youtube video downloader I found this ...
http://youtubedownload.altervista.org/
http://youtubedownload.altervista.org/
Wednesday, 29 June 2011
Favorite library in C++
This is a great GUI for software on most platforms (i.e. Windows, Linux, Max, Unix etc)
WxWidgets
This software will build on a very minimal workstation with only the basic libraries installed. It also looks great and has tons of examples to work from.
WxWidgets
This software will build on a very minimal workstation with only the basic libraries installed. It also looks great and has tons of examples to work from.
Example of the Classic problem with programming
The classic problem with compilers and programming is in my opinion the fact that compilers sometimes compile code that looks mathematically incorrect or illogical. This can cause the following problems, a) programmers start to believe that their math is incorrect and lose faith in mathematics, b) programs will not port to other systems.
Here is an example (the quick example ... the long example was a so-called generic parser that worked a couple of years ago and should never have compiled since certain variables were uninitialized at startup, the problem was that when the code actually worked I didn't bother to check for bugs).
finding substrings:-
if( text.find(".") > 0)
{
// process text that contains a "." character
}
This works fine in one part of the program, however later I have to use this :-
int full_stop = -1;
full_stop = text2.find(".");
if( full_stop > 0)
{
// process if string called vlocal contains a full stop
}
otherwise the program does not work. So I have to actually create an integer if I call the function within a loop, or is it breaking for some other reason? Only the guru's who write the compilers really know for sure.
Here is an example (the quick example ... the long example was a so-called generic parser that worked a couple of years ago and should never have compiled since certain variables were uninitialized at startup, the problem was that when the code actually worked I didn't bother to check for bugs).
finding substrings:-
if( text.find(".") > 0)
{
// process text that contains a "." character
}
This works fine in one part of the program, however later I have to use this :-
int full_stop = -1;
full_stop = text2.find(".");
if( full_stop > 0)
{
// process if string called vlocal contains a full stop
}
otherwise the program does not work. So I have to actually create an integer if I call the function within a loop, or is it breaking for some other reason? Only the guru's who write the compilers really know for sure.
Irritating thing about C++ development
Every couple of years, and sometimes every year microsoft releases an update to their Express development studio, MS VC++ Express. When this happens various functions become obsolete or unusable, for instance the old c-style file loading functions are now marked as deprecated because they are not thread safe. This makes keeping old software compatible with the current compilers quite laborious.
Subscribe to:
Posts (Atom)