Dec 24, 2012

jQuery "No Transport" error solution

If you get a "No Transport" error then making AJAX request using jQuery in Internet Explorer, then solution is as simple as adding:
$.support.cors = true;
before making your calls to
$.ajax(...)
For some other possible options take a look here.

Dec 21, 2012

Console isn't a box that run games

An interesting article called Why Xbox failed in Japan is worth reading despite it's pretty long.

Not only it describes Japan game market specifics, it's also pretty much shows that console market is very different from a PC, and a console is not just a computer which can run only games. Also it reveals much of "behind the scene" activity in console game development, some info on popular studios which are dedicated themselves to console game market - just as I said, it's worth reading for anyone interested in games and games market.

P.S. BTW, I think this article pretty much fails in answering it's main question, a lot of 'in American/Japanese way' references doesn't always mean a lot, really. But, still it's an excellent overview article.

Dec 18, 2012

Remaking Karateka

This is so awesome!

Why OUYA can be a failure

I was actually pretty excited then I first saw and read the concept of an OUYA. An open game console, isn't that great? But recently I've discovered some thing that missed somehow from me, but I think it's rather important:



This is a serious statement. All OUYA games will be a free-to-play. And most of free-to-play games are simple money-making machines, the legitimate rest are basically using "try before you buy" (shareware) or subscription model.

Serious gamers don't like free-to-play model at all. While it's still possible sell a game in more or less "standard" model in OUYA (as I guess), I think it's rather confusing that free-to-play model is enforced by a console which considered to be a most open game console ever? Absolute nonsense!

As a side effect this type of restriction is actually encourages and attract game developers who are specialized in free-to-play games, thus making a OUYA game marked flooded with "bad" games, which will prevent some "real" games in gaining popularity.

I think OUYA should remove this absurd limitation, if they want to name their console a truly open system. Not only this will attract more developers to console, it's also good for a future reputation of OUYA. I personally will not buy OUYA until this limitation is removed from a system.

Dec 17, 2012

A great article on Free-to-play games

An excellent article about Free-to-play games. Go read it now.

As for my personal opinion, I agree with Andrew in a way that every customer always wants a bargain. That's why, for example, I always buy every HumbleBundle that is out. If I even don't like any of the games (that is never happened, BTW) I wouldn't be angry at all, since I got it almost for free. OTOH, I will never buy a free-to-play game, since I'm guaranteed to make a not-a-bargain deal, and that's not the only thing. This kind of games are naturally corrupted, like an arcade, to make money out of you. It feels kind of weird, and I just ignore it, since there is a lot of other games available.

I feel sorry for a little kids (and their parents), which are particularly naive and vulnerable to this kind of abuse. They don't realize what this is and sometimes spend lots of money for some 'crystals' in a game with their favorite cartoon heroes. I guess that's inevitable evil of games becoming a less art and more money making industry.

I don't think that it poses any real threat to gamers, eventually all who exploit this approach to much will suffer the consequences. The only sad part here is that talent is wasted driven by greed.

Nov 28, 2012

One more exceptional blog

This guy articles are just awesome. I must read them all! As in introduction I personally recommend to read a this one.

On Windows 8 and it's Modern UI

I'm actually quite a fan of a Windows OS. I've used it starting from Windows 95 and missed only Vista (I also don't count Millenium edition since it was in parallel with Windows 2000 on that time). I thought Vista was a bad version, and indeed, it was. However it was bad in a sense of it made you grumble and mumble periodically 'ah, that's how you do it now'. It was still a good old Windows OS. Eventually a tuned up version of Vista is most successful and popular Microsoft OS of all the time I guess. I was pretty satisfied with Windows starting from Windows 2000.

However situation with Windows 8 is different. For the start you can read this article, which is quite reasonable analysis of the new UI. The so-called Modern UI is terrible. So are terrible each and every new website made using this approach, including, of course, new Microsoft web site.

As a conslusion to this article I can add, that somehow Microsoft now wants you to learn a whole new concept, just because they think it looks cool? My PC is a workhorse with a tons of complex software. I appreciate that Windows 8 is faster, supports new hardware and use CPU, GPU and RAM more efficiently. I like it a lot. I just can't understand why I even need to see this ugly piece of marketing bullshit then I just need my desktop? Well I mean, I can understand their reasoning behind all this. That's a money, a lot of money they want from a new Windows Store. I'm fine with that, but why I should suffer and even pay money for that then?

No way I install this on my computer, at least until they make it possible to switch to desktop right after boot. If they want me to learn new OS, then I'll more probably start to learn Linux, which is much more beneficial in terms of useful knowledge received for time spent on learning. In Windows I'll just will learn the new UI I don't need. With Linux I'll learn a whole new class of OSes. And they all are free at least, but for my money, I want my desktop back.

Nov 26, 2012

Kickstarter analysis

The one truly needed post about Kickstarter. A lot of references which are also worth visiting.

P.S. The one thing I really don't understand in modern web design, is a passion to make text not black. I mean like make text #707070. Is it just to make site harder to read, especially on a small phone screen? People, are you there? FTW!

Nov 19, 2012

Web-debugging HTTPS PHP cURL requests with Fiddler

Recently I was faced with a task of implementing OAuth 1.0 authentication. The authentication must be done with JavaScript, and I had a working example implemented in PHP (as a console app).

I've done major part of the task, but on the last step - while trying to actually use OAuth token to receive data - I've got 'signature invalid' error. I've studied PHP script carefully and 'echo'-ed values of interest to console, but still no luck to figuring out what was wrong.

It would be very convenient to see all PHP traffic in Fiddler, I thought, and what you need for it is described below.

Assume that Fiddler is running as usual on localhost (127.0.0.1) on port 8888. First of all you need to tell cURL to use proxy.

$proxy = "127.0.0.1:8888";
$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, $proxy);

for your convenience you can also tell cURL to print debug info:

curl_setopt($ch, CURLOPT_VERBOSE, 1);

This will run cURL thru Fiddler, but you will not see (by default) decoded HTTPS traffic, because Fiddler decode HTTPS only from browsers (again, by default), so you need to change it to '...from all processes' if you run from command line PHP script (or just cURL):



again, this will, most probably result in HTTPS certificate errors since cURL knows nothing about Fiddler certificate (and Windows certificates), so easiest way is to just tell cURL to ignore SSL certificate errors:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

That's all, now you should see PHP cURL traffic, both HTTP and HTTPS.

Sep 14, 2012

Great tools for browsers

Sometimes working with a browser becomes real frustration. Especially if this browser is Internet Explorer. Some simple operation like viewing and managing your cookies can become a real mess. They built in facilities are slow, and not comfortable at all to work with.

NirSoft web browser tools are invaluable in that aspect. It's fast, it's really good, and it's free! Particularly IECookiesViewer just saved me a ton of time and my brain.

Aug 28, 2012

WiX, worst toolset ever

So, I suppose sooner or later every developer out there will face the task of writing a installer for his product. I you are working under Windows, Windows Installer seems like a reasonable choice. I'm not so sure about it now.

Now, there is no some sort official tool from Microsoft for making Windows Installer packages. Huh? Seems like that. Presumably I didn't dig enough for that, so far I found just this nonsence.

But then, WiX! Which is infamous for being used to create Microsoft Office 2003 installer. And it's also internal Microsoft product as well. Certanly it's a big YES compared to nothing. It's even integrates into Visual Studio and adds custom projects for creating installers. And you actually start to think that will be a nice journey. But then you try to find some tutorials, examples and documentation. It is awful, all of these. If you add (but I suppose, it's the reason in the first place) that WiX markup is extremenly unintuitive, complicated and confusing then you will understand that frustration means. Contrary to what you might expect, WiX Toolset it's a pretty low-level tool, which must be backed with good documentation and comprehensive and complete examples.

The feedback is thru this mailing-list style forum with horrible desing. The leading toolset man Rob Mensching is rich for caustic comments like this. And, as you can guess from a thread, WiX Toolset is OK with bugs that lasts for more than 2 years.

The thing that finally really, really helped me out was WiX: A Developer's Guide to Windows Installer XML book. And I'm not sure how much more time I would spend in misery without it.

So for me it's official, WiX Toolset is teh worst tool I've ever encountered in all my developer experience so far. It doesn't mean however you shouldn't use it, but unless you are ought to use Windows Installer, you can consider some other tools out there.

P.S. Useful tips on MSI.

Aug 25, 2012

Fixing XBLIG (and Windows Phone) forum links

As usual, working with an elephant finesse, Microsoft, for some obvious reasons decided to split Windows Phone and XBLIG forums. This results in incredible amount of links on the web are being broken. Oh, this is so nice.. The good part however is that, you can replace old forums.create.msdn.com/forums with xboxforums.create.msdn.com/forums in address and make it to the desired topic.

As for unfortunate ones who were looking for some topics for Windows Phone, the things here are much simplier: all topics are lost somethere, or just gone, I don't actually know.

Back to XBLIG. If you are using Firefox, you can use Redirector add-on, as described here. Just in case, I'll duplicate the rules here. Goto add-on options and add two rules:

Rule 1
Example URL: http://forums.create.msdn.com/forums/p/0001/0001.aspx
Include Pattern: http://forums.create.msdn.com/forums/*/*/*
Redirect to: http://xboxforums.create.msdn.com/forums/$1/$2/$3
Pattern Type: Wildcard

Rule 2
Example URL: http://forums.create.msdn.com/forums/t/0001.aspx
Include Pattern: http://forums.create.msdn.com/forums/*/*
Redirect to: http://xboxforums.create.msdn.com/forums/$1/$2
Pattern Type: Wildcard

Aug 14, 2012

OUYA: first indie console

The phenomenon of indie games is out there for some years, and it's a great thing. However the only true indie platform was only PC. And PC is a great platform, but only for a personal amusement. But it's nothing compared to fun then you blay with you friend side by side, fighting to each other or against computer.

Since the great crash of 1983 the main game consoles were closed for indie developers. This wasn't major concern up until now, since indie devs are flourishing.

And OUYA perfectly hitted the spot. It's cheap and open to everyone. It's not that powerful, but indie games usually doesn't need that much power as AAA titles. OUYA is greatest thing that happened to console market for some last years. It will boost competition between console market players, which will be good for everyone. It will bring tons of new, beautiful games to people by creating an easy-to-enter market for indie developers.

It's success is inevitable, because it's just filling last missing piece in a complete puzzle.

Aug 7, 2012

Thoughts on Starbound and PCG

Well, it's been awhile, my vacation was pretty good, thank you :).

Meanwhile Starbound team posted some updates. Some thoughts on that. First pickaxes are confirmed. This leads to conclusion that Starbound is definetely a Terraria clone, in a good sense of that. I mean look at Terraria it's a clone itself (of Minecraft of cousrse).

However it's became more and more obvious what will be the feature of Starbound. It's procedurally generated content (PCG). This is not a new thing per se, but Tiy has a vision of moving it to a next level.

Usually PCG is limited to thing which I call 'playfield' (major) and item properties (minor). In Terraria it's, for example, a world (earth) structure. Item properties can be for example some modified items which can then start to glow (enchanted sword, etc). In Starbound, most items itself are created via PCG (more of a pseudo-PCG) which means that not only stats, but visuals of an items are somehow unredictable. This is very cool.

The key question however is how well randoness will be controlled and constrained. By that I mean, that PCG games lacks that soul part of a manually designed worlds. Imagine, for example, Fallout with PCG land. One the one hand each game would be somehow unique, that's a good part. On the other hand, you loose sense of the game world reality. The real worlds are static. So, it's really a challenge for a Starbound team how story mode (if any) will deal with randomness.

Tiy already mentioned some kind of global coordinates which players can exchange with each other and which will lead to exact same location for any player. I assume this coordinates are basically the RNG seed values which will allow to recreate world precisely on another user machine. This feature is already very good.

As a conclusion: so far Starboud is looking pretty awesome! Can't wait to play it.

Jun 9, 2012

Look on Windows 8 from the other side

Very interesting article on Windows 8. Despite the fact that I really dislike Windows 8 as of now, I must admit this article have it's point, which is very reasonable. Good read.

May 14, 2012

XDE "mfplat.dll is missing" solution

So if you have that problem then your Windows Phone Emulator won't start, and if you try to run it directly you have "mfplat.dll is missing" message, then there is solution that helped me.

Search your %windir%\winsxs directory for "mfplat.dll". It most certanly will find it in something like this, as on my Windows 2008 Standard R2 x64:

c:\Windows\winsxs\amd64_microsoft-windows-mfplat_31bf3856ad364e35_6.1.7600.16385_none_529f8a546d2657c9\mfplat.dll
c:\Windows\winsxs\x86_microsoft-windows-mfplat_31bf3856ad364e35_6.1.7600.16385_none_f680eed0b4c8e693\mfplat.dll

then take 32-bit version of it, and copy it into "%windir%\SysWOW64" ("%windir%\System32" for 32-bit OS).

The other way is probably to install "Desktop experience" feature (on Windows Server OS).

May 10, 2012

Chasseur, part 1

Since the development of my previous project ended, I'm moving forward to my next project. As I mentioned in my previous post, I was thinking about a Super Spy Hunter (SSH) game clone. Now it's final, I'll be making SSH clone.

You can view full game completion here:


So now I'm at game architecture design stage. The very first thing I bumped into was: how to store such large levels? First of all I thought about somewhat natural solution to this: tile maps. But this maps would be quite large, and, more major thing, they make impossible (at least as I understand it) some features that original game demonstrates. The most natural way to do similar thing is to follow original game design, and the original game was a 256Kb ROM (amazing isn't it?). This is certanly not enough to store all maps as a tiles. I was also thinking about programmic generation of levels and user ashes999 make me certain, that reference game indeed uses some kind of procedural generated content. It can be like this:
while next road section exist:
    get road section data;
    set road generation options (borders type, road type, etc);
    set road section lenght;
    while not end of a section:
        generate road;
        apply pseudorandom eye candy stuff;
This way levels can be described in a pretty compact way.

May 8, 2012

Digger.NET in development, part 8

So the latest additions to the game looks somewhat good. Digger is drawing tunnels, eats crystals, and level advancement on eating all crystals.


However, I'm increasingly frustrated with original source decoding, since this process is actually takes more time, than actual coding of it in XNA. I'm not very excited in spending large amounts of time on this, since I want advance further into XNA. So I've decided to halt this project indefinetely. This was a good learning project, however I must admit it was a mistake to attempt to make a exact copy. I lost significant amounts of time studying unmaintainable code instead of something more useful. Yet now I feel much more stronger then I was at a start of a project, so now I'm thinking about next steps.

Most probably I will spend some time learning XNA using books, articles and tutorials. While doing this I will thing what kind of game I will try to make. I'm thinking about something like Super Spy Hunter, I actually really like this game:



But this is certanly not decided yet.

May 5, 2012

Starbound biomes update

Tiy has updates Starboud site with Biomes post. He demontrates procedural generation of a somewhat random Biomes. Random here means that a set of sprites are combined to form new structures. And of course additional color can be applied to sprites. While still this is an incredible work, I'm a little unimpressed, becausue the biomes indeed look a little.. artifical, I would say. But this is still an early stage, and not everyone can show such thing even hand made, and this is a semi-procedural generated! So this is still very cool.

Also for now it's still not 100% confirmed that you will be able to dig earth, as in Terraria. I mean it wasn't in any video or screenshot, and nobody from a team confirmed that this would be possible. However from what it looks like, I would say you can.

XNA game testing

In this post I will try to accumulate different info on game (preferrably automated) testing. I will add generic articles on a subject, and specifically on testing in XNA, but not for other freameworks/languages.

Automated game testing is particularly difficult to implement, yet games are usually very hard to test fully. So even partial core testing is helpful.

First will be two topics on Game Development StackExchange. Unit Testing a C#/XNA Game Project and How common is automated testing in game development?. They also contain a handful number of link to some more articles on this subject.

As always you are welcome to add your finding on a subject in comments, so I can extend and improve the list.

Terraria, second encounter

Redigit, after some 3 months, appeared again on Terraria Online today with extemely intriguing private profile post, which says just "Planning something big..":

redigit planning something big..












Despite all my respect for his courage, plain and somehow awkward honesty, I had a strange feeling about all that situation. And now that little post is a relief! Looks like Redigit just took a really big vacation with his family after that incredible pace from the moment terraria was released to Terraria v1.1.2. That's was just 8 months. Eight months!

I think he needed this time to evaluate current situation. I don't think he wanted to halt development in such a way. I think something went not so good within a team. Particularly Tiy (main spriter) left to potentially rival project Starbound. BTW Starbound site is updated today with new info (good coincidence for starting conspiracy theory). Also I have a feeling that Terraria main codebase was of a rather low quality (negative fact of rapid development), so it's harder and harder to add new features and fix bugs. Major refactoring would require significant amount of time, which is probably not worth it. Stopping project this way is also hurting his reputation seriously, I'm pretty sure he understsnd it even better than me, so there surely was some serious s**t which forced him to such decision.

Anyway, that happened and so be it. I'm just happy that Andrew didn't took a three year vacation, but just three months.

As for what he is planning.. I have no idea. For now I have just some guesses (in decreasing probability order):
  1. "Teh final" big Terraria bugfix patch for 1.1.2 version, signed as final version;
  2. Terraria 2 (or put any other name here) announcement;
  3. Announcing new team and continue of Terraria development.
Items 1 and 2 can be announced together.

May 4, 2012

Digger.NET in development, part 7

It's hard to monitor debug information in games using standard approach, using Visual Studio debugger breakpoints, watches, etc. for example. This breaks game cycle, hides visual output and useful only for catching special conditions. Also some data, like enemy AI calculated path is hard to analizy in it's internal form. I formulate this problem in this post at gamedev.stackexchange.com. This incredible lecture by Bret Victor shows why instant feedback (in our case it's just instant debug) is important, you definetely shoul watch it. This lecture impressed me, and that's probably how I begin to think about visualizing debug information.

Using techniques described in post I can visualize objects information like this:


The cell coordinate for digger object is displayed above him, and moves with him.

May 1, 2012

Complete XNA games sources for beginners

If you are beginner in game development it's invaluable to study someone else's game code. There are countless reasons to do that, both technical and let's name it "psychological" aspect. From technical point you learn: how code is organized, architecture, some useful tricks, how much code is required for some features. From "psychological" point you learn one, but very important thing: nobody's code is perfect, after that you will stop think about "real" games as some perfect creations, some of them are sooooo far from it, yet they still successful. If you are lucky enough you will find some developer notes on development process, or project organisation.

Sources value however, at least for me, differs greatly. Firts of all, big games sources are almost useless for you. You won't be able to understand them in some reasonable amount of time (if you will be able to compile them, ahem). Small games, on the other hand are useless too, they just don't big enough to introduce some basic architecture required to fight complexity. Preferrable size is somethere much below medium size. It actually depends on your current knowledge (I mean if you learn XNA for half a year you still a beginner usually, but you know much more then someone who learn it for a two weeks).

That said, the highest value (and least available) have complete commercially successful games. If you want to make your game at least interesting, and at best be able to sell it, this games provides such examples. However if game is free or open source, but still popular it's probably isn't much worse. The least valuable (and most available), but still useful are open source game project which tend to be "in-development" state permanently. This are only interested on final stages, then game is at least 50% complete.

In this post I will store (and update) a collection of links to some such sources. It's only XNA projects, sorry:

1. Sources to Molly the Were-Zompire RPG game can be found here. Zeboyd games is actually a cool retro-style game company check them out. This one is actually interesting one. First of all it's a XBOX targeted game. Second it's just that case then you absolutely should learn how you should not design your game. And third it's a text only (almost) adventure game! Again, this game is a commercial game, and it is successful. This is a lesson every gamedev should learn.

2. Space Defender. This is a much smaller game, this one, however, in contrast to previous, very well designed (for it's size). Everything is neatly organized. But again, in contrast, to previous this one will not interest any gamer.

3. Asteroid Outpost. A live repository at bitbucket. Good project organization, a lot to learn from.

4. A collection of projects at CodeProject. Most of them are not the games (however there are some complete games there), but also still useful to learn some specific area.

5. Pixel Man 2 by Nick Gravelyn. Cool, almost complete game with excellent sources (Nick worked in Microsoft in XNA team).

P.S. I would gladly accept and include any other valuable XNA game sources, just mention one in comments. Thanks!

Digger.NET in development, part 6

It was a little slowdown lately, however some key aspects of the game was implemented.

First of all tunnels drawing was implemented using RenderTarget2D technique. This also required some work on Digger.Convert project, since I didn't converted all required sprites. Now I'm tossing objects around trying to decouple logic and drawing parts of the game. Architecture never was my strong side unfotunatelly. Still I'm not letting it just go, if I feel something is wrong I stop and try to think how to manage it. I'm at the very early part of development, so decisions I make here is very important. As for visual progress, it can be seen as this:


It's a main game screen being initialized. It draws initial tunnels and gold bags.

Here is also some thoughts about project goals. I abandoned idea to fully understand and then, improve original code. This task not only seems now as extremely hard, it's also boring, and doesn't give me valuable experience I want. So now I concentrate on XNA port, and study source only to understand game logic. It also seems that I will not port many features of a Digger Remastered, because it's not looking interesting for me. I will port single player gameplay and then move further into modding of the game, or will start some new project (maybe both). Copying is hard, it's a good experience, but it's not much fun, then you create something new.

Apr 28, 2012

Working with Subversion from Mercurial

My favourite VCS is Mercurial. Before that I used SVN, and I have no regrets about it. But it's still popular, and from time to time I have to use SVN. Here is solution how you can work with SVN from Mercurial. I didn't tried it myself yet, but will certanly try it then time comes.

Updated 02.05.2012. So, the need has come early, and I tested it. It works! I'm almost sure it's buggy to work flawlessly with advanced reps, but if you need to just grab some repo it's definetely enough.

Apr 25, 2012

Game development podcasts, videos, etc.

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.

Apr 24, 2012

Minecraft: The Story of Mojang

Nice video about Minecraft creator Marcus Persson and his new Mojang company. Fairly recent which is good. I'm impressed how 'Notch' is open about success of Minecraft. "It's almost impossible to repeat such success" he says, "it was sort of luck and right time" so modest. I'm just bumped first time to this site BTW, but it sertanly deserves some digging around, looks like an interesting place.

Apr 21, 2012

XNA articles beginner 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 tools 2D game developer should not miss

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

Why you should reinvent the wheel

Below, I will talk about game development specifically, but I think this can be applied to any type of development.

The main theme I want to concentrate on is: if you personally experienced problems which some "wheel" solves, then you will use it better and with more satisfaction.

Consider arrays for example. Do you remember very first time you really understand concept of arrays? Usually this is very close to the beginning of language study. But despite that, usefulness of arrays is immediately obvious. You dont need tens of variables to store multiple values, and of course cycle processing of this values is much easier, to say the least.

Now remember user defined functions. They also come early, but not so early as arrays. Functions benefits is not so obvious until your programs go beyond some 100 lines.

And then, pointers. Double linked-lists. Queue. Stack. All of that strange useless magic. Then classes arrived and OOP with that strange inheritance thing. Why do you need to block access to a structure field? Some of us were forced to all this stuff at university or college. But as time goes you begin to understand why all this exist.

There is, however, a different side of this. Many starting game developers, as I can see, for example, at gamedev.stackexchange.com tend to use heavily some rather complex frameworks for games. The problem is that unless you will create game without usage of some frameworks, unless you didn't try to solve problems which arise with you own hands, you can't quite understand even basic logic that stands behind framework, and can't use it effectively.

You don't use classes from the start. You don't use pointers and complex data structures from the start. Not even functions. You use variables and arrays. Then your code grows, you understand concept of a function. And so on, you use more advanced features, then you face problem and understand how that feature helps to solve it. Before that time, your usage of it would be wrong and unefficient. Similarly enough you don't start game development by creating WoW clone, you are making Tetris clone.

Of course there are exceptions. You don't write XNA youself. You don't write standard C library. But this are well built, long time tested, basic functionality tools from a major brand. They can be considered a part of a language. You don't write image manipulation library, it's not the core kwnoledge that drives your game. But you write your game editor, your game core and physics engine. Even if you fail, your experience will be invaluable.

Apr 5, 2012

A set of XNA tutorinals beginner shouldn't 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 tools 2D game developer should not miss
- XNA articles beginner should not miss

Apr 2, 2012

Conjurer: Reloaded

The Conjurer project which was my little playground for something related to game development, but which ultimately become a failure, will now hold something quite more useful. It will be my personal XNA Framework utilities library. For now it contains a KeyboardManager class which helps to manage keyboard input handling.

As you can expect, main user of this project will be (and is) Digger.NET project.

Brian Fargo interviews

Brian Fargo interviews concerning mostly Wasteland 2 funding, development and much more. Very interesting read for any game developer and gamer.

Mar 30, 2012

Errors on GAC operations

If on any GAC operation you receive gacutil.exe errors similar to this:

Failure adding assembly to the cache: Access denied. You might not have administrative credentials to perform this task. Contact your system administrator for assistance.

but, on contrary to the message, you have administrator rights then problem is, almost certanly in enabled UAC. Either use "Run as Administrator" or just disable damn UAC.

Digger.NET in development, part 3

Well, project progress is good (considering how little free time I spend on it). I must admit that XNA is very convenient framework to work with, so some glory goes there. By now I've converted all graphics, and project Digger.Convert can be treated as accomplished.

Now I've switched to actual DiggerGame project. As I previously mentioned first part would be implementing ultra-simple text editor using game's bitmap font. As of now, I partially succeeded in that, it was somethat simplier then I thought. Oddly enough such simple procedure as reading text input in XNA can become very complicated. Nonetheless, here it comes, first screen of a my very first, big expectations XNA app:














The screen size is original 320x200 resolution. I've decided to work initially with it, and add scaling later (yet not decided how to do it right). It types all pressed keys in one row. That's all. It doesn't correctly process keys other then letters. But I'm excited like I've written some good game. That's what I like about programmig. Game programming excites even more, because you basically see the result of your work.

Mar 27, 2012

A way to fix freezing WMI

Problem symptoms (as on my Windows Server 2008 R2 Standard x64), after reboot you have following problems:
  1. WMI functions are unacessible. For example, if you try to start "SQL Server Configuration Manager" (which uses WMI internally) it will fail to lauch with error. Other programs just won't start or freeze indefinetely;
  2. svchost.exe process which hosts "Windows Management Instrumentation" service (Winmgmt) will use 100% of single CPU core time;
  3. HDD led will glow constantly;
  4. If you wait for some time (some hours) all previous symptoms disapper and everything functions normally until next reboot.
My solution was to:
  1. Load into "Safe mode";
  2. Kill svchost.exe in question via Task Manager, and then quickly;
  3. Delete "%systemroot%\System32\wbem\Repository" folder;
  4. Reboot.
Again you need to perform steps 2 and 3 quickly, since Windows will restart "Winmgmt" service shortly after it was killed, and running "Winmgmt" blocks deletion of this folder.

After this procedure Windows will recreate this folder and symptoms described above will stop. I think this folder is some kind of cache, which becomes either corrupted (more likely) or very large and WMI service enters some kind of almost infinite loop on booting then processing this folder data. As an interesting fact "Repository" folder which I deleted on my system was 559Mb, while recreted folder is 22Mb which is 25 times difference.

Mar 25, 2012

View a contents of the GAC in .NET 4.0

Did you knew that the only correct way to view the content of GAC (as of .NET Framework 4.0) is by using gacutil –l command? Discovered that just now. My first reaction was "ORLY?". Microsoft must be joking but, no. Old good assembly folder indeed doesn't show all .NET 4.0 assemblies. ILSpy's (ILSpy 1.0.0.1000) "Open from GAC" also showed wrong results then searching assembly by name.

As I've discovered there are two GACs now, and this is the root of the problem. To complicate things more, there is two gacutil.exe (four if you count x86 and x64 versions) versions, one for CLR 2.0, and one for CLR 4.0.

Can't say for everyone, but searching some hundreds assemblies thru a console output of seems like a not very convenient work. That's an odd, strange behaviour for such developer oriented company as Microsoft. So currently I'm in search for good universal utility which will provide convenient interface to manage this GAC mess. I'll update this post if there will be any progress in this quest.

Update. Here is my discussion about gacutil.exe on StackOverflow.

Mar 21, 2012

Digger.NET in development, part 2

As mentioned in previous post I've started by convertion graphics data to real graphics file format. The easiest part was symbols data, i.e. game font. The result is as follows:













This is a 192x192 image (16x16 symbol grid), there symbol is located based on it's ASCII code value.

The symbol data was a simple single bit per pixel, there each pixel was half of the byte. For examle symbol A was represented as follows:

A
0x00 0xff 0xff 0xff 0x00 0x00
0x0f 0xff 0xff 0xff 0xf0 0x00
0x0f 0xf0 0x00 0x0f 0xf0 0x00
0x0f 0xf0 0x00 0x0f 0xf0 0x00
0x0f 0xf0 0x00 0x0f 0xf0 0x00
0x0f 0xff 0xff 0xff 0xf0 0x00
0xff 0xff 0xff 0xff 0xff 0x00
0xff 0xf0 0x00 0x00 0xff 0x00
0xff 0xf0 0x00 0x00 0xff 0x00
0xff 0xf0 0x00 0x00 0xff 0x00
0xff 0xf0 0x00 0x00 0xff 0x00
0xff 0xf0 0x00 0x00 0xff 0x00


Initial A is a header the rest is the symbol data. Full symbol data file can be viewed here.

Mar 11, 2012

Digger.NET in development, part 1

As you probably may not know, I'm very interested in game development, but, unfortunatelly, after some attemps some years ago, still have not done anything interesting. Some time ago I've learned about XNA, and again was ready for another attempt in learning this part of software development world.

As a big first task I've decided to port a Windows version of Digger Remastered project to .NET. The original source is a DirectX Windows C application. The project I've started have two main goals: 1) maintain and improve original C source; 2) create XNA port of the game.

For a relatively long period of time I slowly cleaning up, commenting, and refactoring original source code. First big improvement was that I moved hardcoded graphics description data to a separate files. After that I was generally really bored with a project, since with such little comments in the original code it was really slow and frustrating task to decipher it. So, with a help of Learning XNA book I've decided to move on.

The first part is to convert original graphics data to real graphics format. For that porpose I've created Digger.Convert project. It's sole purpose would be a set of graphics files, which will be a sprites for a game.

Game uses custom graphical font to display text. I think it's a good idea, as a first step, make an XNA app which will print text with this custom font from a keyboard in realtime (kind of text editor). This will be my first milestone in XNA project.

Mar 7, 2012

Be careful with magical code

Just a link to a wonderful article, a must read for any developer who have that strange uncomfortable feeling working with another "silver bullet" framework.

Feb 23, 2012

How should development of a game ends

This one is a good example (there is also part 2). Terraria is incredibly good game. Actually it's the best game I played in a last year, and I mean all games, not just indies. But. You should be honest to your players and youself, you should not be a pusher. There were, clearly, big possibilities to continue further development of Terraria. But it would be a fake. If developer is making only money on it. I think modern game development suffers pretty much from make money goal. So such an action may seem absolute madness to them. If it was, say, Blizzard, then we would see Terraria 2, 3, World of Terraria etc. But with such pusher behaviour, your game idea, your game world, is on steroids and will always results in unnatural and very predictable games. Starcraft II is an example. It's a very good game, but it doesn't have a soul, it's a pure marketing product. I think large game studios became hostages of themselves, they just can't work another way now, or they will go bankrupt. This is the part there indie studios have major advantage over them. This explains why indie games are so popular lately: they have soul. Like an old games, then there wasn't unstopabble sequels, addons, prequels. There is exception though. Valve managed to fight temptation to make money, and continued to make good games. But that's a personal opinion. 

Anyway, there is some very interesting game in develppment now from some other creators of Terraria. It could be a hit, it could be a failure, but I'm most certanly will try it!

Update. An interview with Andrew "Redigit" Spinks the creator of Terraria. I'm glad to find this particular answer which just says that I meant to say, but in some fewer words:

What is your take on the future of indie games vs. the big-name developers?
It’s not my intention to bad mouth the big-name developers, but from my perspective the recent rise of indie gaming is due to big-name developers losing touch with what gamers want. Gaming shouldn’t be treated like a business. If you genuinely enjoy your product, then there is no risk involved because others will as well.

Jan 18, 2012

Configuring BizTalk 2006 R2 on cluster

Then you try to configure BizTalk 2006 R2 in cluster environment, you can get error similar to:

The SQL Server 'SERVERNAME' cannot be used with the SSO Administrator account 'SSO Administrators'. Local accounts cannot be used with clustered SQL Servers. (SSO)

To fix this (which worked for me) add you domain to user groups like "DOMAIN\SSO Administrators" and "DOMAIN\SSO Affiliate Administrators". Of course you also must use domain user which belongs to both this groups. And here comes nasty trick, you need to deselect and select again "Enable Enterprise Single Sign-On on this computer" checkbox, only then error goes away.

Jan 11, 2012

Holographic code

Wow, this is great article. I've worked with such code, but always wasn't sure how to call it.