C# foreach VS for loop

When I started using C#, mainly because of XNA one of the things I got used to write is foreach loops instead of for, seemed easier and it’s a much cleaner code. Doing almost the same thing as a for loop I never really bother to see the differences, almost everyone in their XNA examples used it instead. Today I decided to see the differences between them: FOR int[] values = new int[1]; int total = 0; for(int i = 0; i < values....

December 12, 2009 · 2 min · 312 words · David Amador

munchies for Design

As most developers do I spend a lot of time programming. Most of us has made some sketches for prototyping games, yes, the ones no one else can understand except for ourselves. I always liked drawing and 3D modeling but I was never very good at it. I was just cleaning up some stuff on my pc and found a folder, god most of this stuff I made is UGLYYYY lol....

December 5, 2009 · 1 min · 71 words · David Amador

Basalt and Sapphire Updates

Lately all my free time has been spent adding new features to Basalt and developing Sapphire. Some months ago, I started building Sapphire, a 2D editor for helping me creating to create my maps. Unfortunately I made a bad choice and decided to integrate XNA with Windows Forms, although I managed to do it it was a real pain to add something simple and eventually I dropped it. Here’s a screenshot of the previous alpha version:...

December 2, 2009 · 2 min · 245 words · David Amador

How to do a XNA fps counter

Frame rate or FPS, how it is most commonly known is a way for you to know how many images per second is you game drawing. The more the better. Less then 30 and you start to see hiccups. So how can you measure your frame rate in XNA? Inside your game1 class declare these vars: SpriteFont _spr_font; int _total_frames = 0; float _elapsed_time = 0.0f; int _fps = 0; On function LoadContent() do...

November 23, 2009 · 2 min · 254 words · David Amador

How to do a Xna Log file

Although the title says XNA log file this is actually a C# log file, I’ve just thrown this title cause lot’s of people search for xna log instead of C# log file. Many have asked me why take time to do a log file when you can throw exceptions when something goes wrong. Well the answer is simple, to keep track of what’s happening, log steps, write to the file exactly what when wrong even if you are on Release mode, and more, if someone complains the game is crashing you simply ask for the log file and see what when wrong....

November 20, 2009 · 2 min · 350 words · David Amador

Using PerfHUD with XNA

I am definitely a fan of ATI cards. Had a few Geforces but didn’t liked them very much. I actually noticed image quality decrease when switching from an old Radeon 9800 to a Geforce 8k something. I’m very happy with my Radeon 4890, now for the downside, PerfHUD, a very handy tool for Game Developers is only available for NVIDIA chipsets and although ATI has it’s own GPUPerfStudio it’s not the same thing....

November 18, 2009 · 2 min · 293 words · David Amador

Unreal Engine 3 is now free

Epic decided to offer Unreal Engine 3 for free to non-commercial applications. Sounds kind of weird considering it’s one of the best and most licensed engine out there, but maybe the recent release of Unity 3d free for all uses made them consider this option. Named UDK (Unreal Development Kit) you can download it here and have access to all tools and features that the full commercial Engine contains, well, except for the source code of course....

November 5, 2009 · 1 min · 104 words · David Amador

Force a wmv to download instead of opening in browser

I recently needed to force a WMV to download using Apache. The default behaviour for most browsers is to try to open the movie inside the browser itself. This works fine if the person has the plugin otherwise we just gonna have a blank page. Also for huge WMV is easier to download the file for later viewing. So just place this on your .htaccess on the root of your website....

October 30, 2009 · 1 min · 95 words · David Amador

Prototype for xna7day competition

I decided to make a game for the xna7day competition, in which we have to make a game that only uses 2 keys, so absolutely no analog input and it has to be built on xna of course. This is a great opportunity to test my engine Basalt. I decided to make a puzzle game, basically the rules are the same of a 3 in line game. This is what I have so far....

October 29, 2009 · 1 min · 74 words · David Amador

How to make a clickable div

Making a clickable text or image is easy, just add the <a> tag surrounding it. But this doesn’t work with divs and sometimes we need a whole div to be clickable and not just text. The following code is for JQuery but switching it to your favorite JS framework should be very easy. First start by adding this to your div <div class="clickable"> </div> Now a little css to simulate the pointer on that div...

October 25, 2009 · 1 min · 108 words · David Amador

Accelero twin turbo

Because my Ati Radeon 4890 fan fried I had to buy another cooler. After a little research I discovered Artic Accelero Twin Turbo. Today I decided to finally try it. The assembly is rather easy, the package comes with several heatsinks for memories, and of course the fans themselves. There are three ways to connect the fans, either directly to the VGA card itself, directly to the PSU with 7V or 12V....

October 24, 2009 · 1 min · 144 words · David Amador

PHP Optimization Tips

As most languages PHP allows many ways to solve a problem. Some are faster then others. Here are a few ways to improve your PHP code. Loop At some point your program will require a loop. And loop is considered as efficiency killer if you have many nested loop (means loop in a loop) as one loop will required to run ‘n’ times and if you have 1 nested loop, this means your program will have to run n2 times....

October 22, 2009 · 3 min · 506 words · David Amador