Apr 19, 2012

If your hard drives are identified as removable

I've noticed that in my Windows 7 installation all my hard drives are shown as a removable drives. This is not only looks incorrect, but it also permanently occupies your system tray with Safely remove hardware icon.

After some investigation I've found that this indicates that not all required drivers are installed on an operation system. On my Intel chipset you were need to install Rapid Storage Technology driver. After that, and a two reboots (duh!) hard drives are identified correctly as not removable. You also got some RAID caps via Intel app, but I wasn't really interested in that for now.

Be aware however that this driver installation procedure can trigger activation for some protected software applications!

Apr 16, 2012

Street of Rage Remake v5

Holy sh*t! Have you seen this? Never believed this will ever will be possible, but it's true! The project page will say it all:

It has been 8 years of work, but the final version is here, this is complete and ready for download, Surprised? :-)

Eight years! That's a truly dedication to one of the best action games ever. I don't know why SEGA or someone else didn't already do the same thing, create a sequel using all power that is available now. Being an extreme fan of original SOR series I don't know how I missed such a huge thing, looks like it was around from about 2009 already. Yet it better to play that game then it's finished and polished.

The remake is absolutely wonderful! It doesn't seem like a amateur fun-project at all, on the contrary all assets looks like a professional quality, better than many commercial games. Music remastering is of wonderful quality. You should absolutely give it a try, it's free! The only sad thing it's not opensource in any way. But who knows, maybe in better future it will be?

Apr 15, 2012

Digger.NET in development, part 5

Well, I extremely satysfied right now, since I've done complete main screen of my XNA port of a Digger Remastered. The currently main page looks like:

I'm impressed how easy it's for a complete gamedev noob (like me) to do things in XNA. So, original internal framerate for Digger is something like 15 frames per second. Question: how much it takes to set it in XNA game? Answer: one line, just add this to your main Game class:
// original frame rate is 15 fps (67 ms per frame)
this.TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 67);
So-o-o nice! So nice I will count the XNA one of the best frameworks which comed from Microsoft (I'm hoping Microsoft will not slow down or stall the thing with it's new Metro-Shmetro and all the native stuff which it puhing quite intensively lately, IMHO).

This is especially evident if you look at the original C code, it's so complex. The graphics and drawing code is incredibly complex. I'm not going to blame the author, seems like he did much more complex job than I but this:
bool sprrdrwf[SPRITES+1];
bool sprrecf[SPRITES+1];
bool sprenf[SPRITES];
Sint4 sprch[SPRITES+1];
Uint3 *sprmov[SPRITES];
Sint4 sprx[SPRITES+1];
Sint4 spry[SPRITES+1];
Sint4 sprwid[SPRITES+1];
Sint4 sprhei[SPRITES+1];
Sint4 sprbwid[SPRITES];
Sint4 sprbhei[SPRITES];
Sint4 sprnch[SPRITES];
Sint4 sprnwid[SPRITES];
Sint4 sprnhei[SPRITES];
Sint4 sprnbwid[SPRITES];
Sint4 sprnbhei[SPRITES];
is just nonsence. At least you can pack each x, y, wid, hei etc. coordinate like data in a structure with two fields. And this is just a tip of an iceberg. Consider this young fella from sprite.c:
void drawspr(Sint4 n,Sint4 x,Sint4 y)
{
  Sint4 t1,t2,t3,t4;
  x&=-4;
  clearrdrwf();
  setrdrwflgs(n);
  t1=sprx[n];
  t2=spry[n];
  t3=sprwid[n];
  t4=sprhei[n];
  sprx[n]=x;
  spry[n]=y;
  sprwid[n]=sprnwid[n];
  sprhei[n]=sprnhei[n];
  clearrecf();
  setrdrwflgs(n);
  sprhei[n]=t4;
  sprwid[n]=t3;
  spry[n]=t2;
  sprx[n]=t1;
  sprrdrwf[n]=TRUE;
  putis();
  sprenf[n]=TRUE;
  sprx[n]=x;
  spry[n]=y;
  sprch[n]=sprnch[n];
  sprwid[n]=sprnwid[n];
  sprhei[n]=sprnhei[n];
  sprbwid[n]=sprnbwid[n];
  sprbhei[n]=sprnbhei[n];
  ggeti(sprx[n],spry[n],sprmov[n],sprwid[n],sprhei[n]);
  putims();
  bcollides(n);
}
no comment (pun here!). How many global variables you can count here? Maybe you want to know that ggeti is? Actually it's a function pointer, to another function (which is actually quite an elegant solution to switch CGA and VGA graphics mode):
void vgageti(Sint4 x,Sint4 y,Uint3 *p,Sint4 w,Sint4 h)
{
  Uint5 i;
  for (i=0;i<h*2;i++)
    if (i+y*2 < 400)
      farmemcpy( (char far*) (p + (Uint5) i*w*8l), back_bitmap_bits+ (Uint5) ((y*2l+i)*640l + x*2l) , w*8);
}
how many magic numbers you can count here? Developer suggests contacting him in case of any questions. But last modification date for source is year 2004. I feel it's little rude to notify person on his completely forgotten project. This is so sad he didn't leave enough comments then he could.

Apr 14, 2012

Digger.NET in development, part 4

This post could also be named: "Why is it a good habit to search for and read the docs" or "Why is it a good habit to comment your code".

The base source code of a Digger Remastered is a C Windows application which uses DirectX for graphics output. Due to the source evolution nature of this game (at least I think so), which was a DOS application before, variables naming is somewhat... short. No camel case also. And almost no comments in source code. I've downloaded latest source code for Windows as my starting point. I thought it will not be very hard to understand the code of this, rather simple, game. I've deciphered some part of a high level game code, but then I've approached a graphics code. This is the place there I have stuck a big time. Can you guess what this code does?

void putis(void)
{
  int i;
  for (i=0;i<SPRITES;i++)
    if (sprrdrwf[i])
      gputi(sprx[i],spry[i],sprmov[i],sprwid[i],sprhei[i]);
}

As you can see, all variables here, except for i are global. Also complicates things, you know. This was also frustrating because I didn't actually need most of the graphics code, which uses pixel-by-pixel drawing since I use real bitmap sprites for drawing. But because this code also tightly coupled (related) with other game logiс (collision detection for example) I need to understand it too.

Not so long ago, I've decided to look for another sources on the site, Java in particular, in hope it will help to understand the graphics code. However, the Java sources were useless, but I've also downloaded (for some unknown reason) old windows sources and voila, I've found some text files inside the zip! The description I found inside was invaluable:

void putis(void)
 Redraw background images


quite unexpected from a name though, hmm. Considering there are tens of different obscure functions and global variables, and deciphering one of them can take hours, this file gonna save me big time (pun here!).

Strange thing though is, why not add this single line as a comment in source code file, just there it belongs, not in a big separate text file. Why? Why?! Why?!!

Apr 12, 2012

Big PHP rant

Oh my, this one deserves to be remembered.

I must admin, I use PHP in my little personal business site, but in a manner of advanced SSI, with little amount of logic. I've always wondered, why even so, I'm uncomfortable with PHP. Why even very simple scripts usually ended up me being in documentation, with finally "oh, that's how it is done". But I never imagined things are so bad there.

PHP language requres major cleanup. Remove all duplicate syntax. Remove php.ini with all to defaults, most of options should not be configurable at all! Create a stable platform that is consistent to every system and installation. Go with unicode as default. This will break all I know. So be it. Call it PHP 6, it will be new, but still known to many language.

But instead PHP group is doing almost exact opposite.

Installing Windows Phone SDK on Windows Server 2008 R2

If you try to install a Windows Phone 7.1 SDK on Windows Server, 2008 R2 x64 in my particular example, I will be surprised that it's officially supported in Windows Vista and Windows 7, as for now.

There is an existing solution for web installer. But what if you internet connection is slow, you need to install SDK on 10 computers, and you have a nice ISO lying on your file server HDD? Actually you only need a good hex editor. HxD is a good one, and absolutely free. What we need, is to modify same lines, but directly in iso file. Open image in editor and search for a unicode string [gencomp7788]. After you found it's location, look down for the same unicode InstallOnLHS=1 and InstallOnWin7Server=1 strings (you can copy baseline.dat from image beforehand and open in notepad for reference, it's located in root directory of the image). Select value 31 after '=' which is '1' and replace it (Edit -> Fill selection...) with 30 which is '0', you will see changes immediately in editor. Now, save the image. You're done. Open the image and verify that changes in baseline.dat are the same as you expected, and you are ready to go!

P. S. I suppose (didn't actually tried that) you can copy files from image into some directory and modify baseline.dat there, but it's not that fun!

XNA tools 2D game developer should not miss

This article data (and much more) can now be found here. I find that blogger platform was not suited well for managing of this kind of list.


You may also find useful:
- XNA tutorinals beginner shouldn't miss
- XNA articles beginner should not miss