Monthly Archives: May 2011
All your Skype client does is producing windows errors?
This is what helped me. Maybe it is a solution for your problem.
- Make sure you display hidden files and folders in the windows explorer.
- Navigate to Users/AppData/Roaming/Skype.
- Delete the shared.xml (or rename to be on the safe side).
- Make sure no skype is running. Use the task manager for this.
- Start skype.
We will display some 2D stuff and move it around.
Possible reasons and fixes for the error message:
The type ‘Microsoft.Xna.Framework.Matrix’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘Microsoft.Xna.Framework, Version=126.96.36.199, Culture=neutral…
- You have references to different Versions of Microsoft.Xna.Framework in your projects. happens easily if you are like me and just import a library project and do not check the XNA version it was built against.
- Classic, you use some cool third party dll and they managed to build it against everything but your XNA version. … but tell you they did on the website. Thanks for that again.
- Content Pipeline Projects are alway, yes really, executed on the PC. Never set Visual Studio to build them for target platform Xbox360 or any CPU. You need x86. Sometimes this is changed automatically… aka you did something stupid and didn’t realise it.
- A C# class library doesn’t do so well as Xbox360 game library. Check your project types and settings.
- As a last resort. Throw all references out and set them new to one specific dll version and rebuild everything. Check where the error occurs and go from there on.
Hope this saves you some sleepless hours.
First thing you need to do is add a SpriteFont object to your code.
Done like this: SpriteFont myFont (or whatever name you want to give it).
Next you need an actual font you can load. For that you go to your solution explorer and right click your content project. Select add -> new item -> SpriteFont.
Maybe you should select a better name, that the default one. But it doesn’t really matter much.
You can edit how your font looks like in the .spritefont file. It is a XML like format. Most stuff you find in there should be pretty much self-explanatory. At the bottom you find tags specifying a character region. Please note, that not all fonts can display all characters. If you happen onto a bug resulting from some character display problem or exception, have a look here, if your font can display all your characters. The rest describes size, text decoration and stuff.
For this post, I leave everything like it is and go on to actually displaying something on the phone.
First we need to load our SpriteFont1 in the ContentLoad()-method of our game class.
All we have to do is display some text now.
We go to the Draw-method and beginn the spriteBatch draw with SpriteBatch.Begin(). The spriteBatch-Class offers us a DrawString-mehtod we use to display text. It first parameter is our SpriteFont. The secont the String you wish to display. This could of course come out of some Sting variable. The third is the position of the text on the screen and the last one, the color in the text is drawn in. We complete this with a spriteBatch.End() in the next line.
And see the result here: I made the Font bigger and red for this example. The size is controlled in the .spritefont file, the color can be selected in the DrawString-method.
falselogic blogged about going back to the same old games all the time, that made think about game design years ago and now.
If i think 10 to 20 years back i remember some really awesome games. Think about Monkey Island, part one and two. Or Kings Quest and UFO – Enemy unknown or Mad TV. Not to forget Diablo and Starcraft. These titles have something in common. The had a new interesting design at the time. The graphic was bad, compared to todays games, the sound let your ears bleed, but the gameplay was awesome and something new. Not alway completely new, but all these games brought you some new experience. That is what made them great and let me remember them.
All of these were easy enough to learn. A famous game design quote says that a good game is ‘easy to learn but hard to master’. Todays games try to be as realistic as possible. Years ago a simple city building game had some living areas, some business areas, a power plant, a water plant and some streets you could place on a map. You had to generate taxes to expand your city. See everything explained in two sentences. Today you need a book, google the game, use tutorials and stuff. There are few games who kept it simple enough for beginners to have fun and complex enough to be long time addiction to hardcore gamer. World of warcraft makes this mostly right, Starcraft II is a great example or the Halo series. This is by no means a complete list. Please feel free to add every game, you feel is missing, to the comments. I think if you design a game you should first look at other games. Not to steal the idea, but to get a feeling for the things done right and wrong. Take for example Chess, Go and Poker. They follow the principle of ‘easy to learn, hard to master’. They are fun games that are around forever. Of course you don’t need to design a timeless classic, but if you think your game is missing something, take a look at these, play them, maybe you find, what you are looking for. Don’t try to make your game realistic, make it fun.
Enough of my ramblings for now. Have fun designing games, coding games, playing games or reading about games.
Playstation PR head Patrick Seybold announced on the Playstation blog that the Playstation Network is slowly coming back online. The network was down for about three weeks after a hacker attack. The restoration begins in the US with asia and europe following.
Seems like a firmware update is needed to get your playstation on the network again.
- Microsoft plans to bring Skype on new plattforms like the Xbox360 with Kincect support.
- On windows skype gets an integration into outlook.
- Support for WP7 devices.
- The clients for Mac OS X, Linux, Android, iOS, Blackberry amd Symbian will still be supported in the future.
- It is possible that Skype will replaces the ‘Windows Live Messenger’.
- Does that mean there could be XNA support somewhere in the future? Hopefully.
I spend the last days hunting down cpu benchmarks and conducting my own tests for a customer. The aim was to build a computer with the maximum power for compiling C# source code with only minimal costs.
As XNA Games are written in C# (at least in the most cases) i thought this would be something i would like to share with you.
Basics about building a XNA Game Solution in Visual Studio 2008
First a few things you need to know when building a XNA Game Solution in Visual Studio 2008. I know Visual Studio 2010 is out there buu the XNA support is still missing. Only XNA 4.0 and the windows phone development tools run in Visual Studio 2010 Express. I did not yet upgrade my project from XNA 3.1 to 4.0 so it was clear that i needed to use Visual Studio 2008. Back to the point. Things you need to consider when building XNA Game Solutions in Visual Studio 2008.
- The build process runs only on one core. Usually you have dependencies between the projects in a solution and they have to wait on each other to finish building before the next one can be build.
- The build process runs through different stages and different stages challenge different parts of your system.
- The build process might run for a long time and you might wish to work on something else why building.
- You are probably not buying a dedicated build system.
1. Builds run only on one core:
This lets me believe that clock speed is more important than many cores. I let the build of my project run on a i7 920 and the CPU load stayed constantly at 11 to 14% for the devenv.exe process. A quick calculation reveals that the i7 with 4 real cores and 4 virtual cores thanks to hyperthreading has a total of 8 cores. So a 100% cpu load means that every core is running under full steam. But if the process can only use one core, the overall cpu load should be around one eighth. 100% divided on 8 cores gives you 12.5%. I think the short peaks of 13+ can be attributed to some Visual Studio background processes and measuring inaccuracy.
So clock speed is really all that matters? Yes of course … wait … sadly no, it isn’t. While clock speed is a big factor in this, it is not the only one. You have to consider the processor architecture. While a Pentium 4 with 3.6 GHz is not a bad choice for building a i7 will still be faster. But not by much.
I let my project build on:
Intel® Core™ i7–920 Processor (8M Cache, 2.66 GHz, 4.80 GT/s Intel® QPI) with 8 GB memory (DDR2) => 6 to 7 minutes (with a MySQL instance running but idle)
Intel® Pentium® 4 Processor supporting HT Technology 3.40 GHz, 512K Cache, 800 MHz FSB with 1.5 GB memory (DDR2) => 11 to 12 minutes
Intel® Core™ Duo Processor T2300 (2M Cache, 1.66 GHz, 667 MHz FSB) with 3 GB memory (DDR2 Notebook) => 10 to 12 minutes
Intel® Pentium® D Processor 820 (2M Cache, 2.80 GHz, 800 MHz FSB) with 2 GB memory (DDR2) => 11 to 13 minutes
The order is more or less what i expected. I think with a memory upgrade to 2 GB the Pentium 4 could beat the Pentium D and the Core Duo T2300 by a minute or two. And this is what really suprised me. The Pentium 4 is as good, sometimes even faster, than it much newer brothers. Actually only the Pentium 4 used all the available memory at some point. Please consider that the test is not completely scientific. These are some computers i have access to. They do not run clean installtions. On some of them other services are running. I tried to get them as idle as possible but it isn’t a completly objective test. They do not even run the same Windows versions. The T2300 and the Pentium D are running Windows XP Professional, the rest Windows 7 Professional or Enterprise.
So this test is useless? If you are looking for scientific data, than yes, it is useless for you. But i still think it shows something quite suprising. The difference between a $40 computer (i bought the Pentium 4 used from a business next door that gave up for that sum) and a $1500 computer (the i7, new) is not factor 1000 like the price suggests.
Just out of curiosity i visited some webshops selling used computers. You can get a used workstation with a 64-bit Intel® Xeon® Processor 3.60 GHz, 2M Cache, 800 MHz FSB with 2 to 3GB ECC memory and a 160GB hdd for just $190 plus shipping. Sometimes even with 2 cpus or 4 to 8GB ECC memory for just a little bit extra power. These things are build to run forever so you have your perfect build server. Just put some the code changes via a repository on it and let it build one solution after the other.
2. Builds challenge different parts of your system:
To simplify this i will break the building process down in three parts:
- Getting data from drive.
- Compiling source code.
- Writing output to drive.
The ressource manager of Windows 7 shows the following for each step:
Getting data from drive:
- CPU – mostly idle
- Memory – working some
- Harddisk – 100% load
Compiling source code:
- CPU – 100% load. At least the one core used.
- Memory – a nearly constant amound is used. In my case about 200MB. Not as much as i expected.
- Harddisk – idle.
Writing output to drive:
- CPU – mostly idle
- Memory – working some
- Harddisk – 100% load
So switching from a conversional harddisk drive to a ssd should give you a huge boost? Not really. I tried this with a SSD, a hybrid disk and a traditional hdd. Made next to no difference. The reason for this i quickly explained. Compared to the compile time the time spend reading and writing the data to the disk is so negligible that even a large performace boost in this area is not really noticeable.
So why do i read the advice to use a ssd for compiling so often? I don’t really know. I have a few theories about this. As we established above, the build process uses only one core, so when building in the background you should be bothered by it much… except for the few seconds large amounds of data are pushed from memory to disk. So what is the first thing you do? Look what ressources are taxed to the maximum by building you cool new awesome project. And suprise, you see the harddrive is the bottleneck. So of course you advice everybody to buy a ssd. Every reliable source told me the same. Visual Studio starts faster. The overall experience is faster, better, greater. But the build was running at the same speed as before. My own tests confirm this. A ssd ist great, but doesn’t help with build time. The hybrid disk is a cheap alternative and brings a slight boost but i in no way compareable to a ssd.
Please note that i am writing here about building a single XNA Game Solution in Visual Studio. There are of course cases where a fast harddisk is a huge speed boost.
3 + 4. You usually build in the background and do something else in the meantime if you have no dedicated build server / system.
What i want to tell you here ist, that it makes probably no sense to invest in a system you cannot use while building. For a dedicated build server it would be best to have one core (even hyperthreading is not really needed) with maximum speed, fast memory and a quick harddisk (or small ssd).
So our system should have at least decend power for stuff outside of coding games.
So what do i buy?
If you are one of those people who have their reserved parking lot at the local computer store, you can stop reading here. From here on i will focus on getting the best hardware for your money while staying under $500.
Let us start with the most important part, the CPU.
A quick glance at some benchmarks show us what a good cpu is for our problem. If you search for benchmarks on the internet be careful. Most benchmarks out there are for multithreaded applications. You need to look for ‘benchmark cpu single thread’. A good one is the ‘SPEC-Benchmark CPU2006‘ or the ‘Cinebench 11.5 (Single–threaded)‘.
At the time i am writing this the winner in the category under $300 is the Intel® Core™ i5-2500K Processor (6M Cache, 3.30 GHz) already on the new socket 1155. It costs today $255. If you have a few dollars more to spend on this get the Intel® Core™ i7-2600K Processor (8M Cache, 3.40 GHz) for $365.
Of course you need mainboard. This is where the flamewar usually starts. A good, reliable, expensive one with a long list of features and great driver support for the next decade ist the way to go here …. wait what? … No! Get a cheap one. You might need a new one in a few years because it broke down or doesn’t support something or whatever. Who cares? You are building a $500 computer not a $15000 server here. Let me tell you a secret. If you spend the whole $500 on a fancy mainboard, even that won’t do much without a cpu, power supply and memory. So we are simply getting a nice $85 entry level mainboard. If you can get SATA\600 support for a little bit more, do it.
That brings us to memory. Memory is important. Really important. Really, really important. Okay, so you got that? Good. I think 4GB is a good compromise. There is a recogniseable difference between cheap and expensive memory. But we are on a tight budget, so get some cheap one from a manufactor that gives you at least a one year warranty. Should cost you about $45 (2 x 2GB DDR3 – 1333). If you have the money you can go for 4 x 2GB or 2 x 4GB whatever your mainboard supports. Should be about $85.
That leaves us with $115 for the case, power supply, a DVD drive and the harddisk. Wait! And the graphics card if you have none on your board. The graphics card is a problem. You are developing games on the computer. Games require good graphics cards. The point is moot. You cannot get a good gaming graphics card in $500 computer. A acceptable solution would be a nVidia GeForce GT 240 or GT 430. But they cost you an addition $100. If you want to use the computer for the newest blockbuster games in full hd and maximum details you need to spend $300+ on a GeForce GTX 560.
A case and powersupply are available for $60. Don’t get the cheapest stuff out there. Get the dealer to show you some quite ones with a good efficiency factor.
A DVD drive is $25.
The last decision would now be what hdd to buy. We have $35 left. I have seen the ‘500GB Western Digital 7200rpm 16MB Cache Serial ATA/600’ for $48.
Plus keyboard and mice ($8.50 each). Get something good. Logitech, Microsoft, Cherry. They have good sturdy devices. Just forego the multimedia keys and stuff.
Now the moment of truth. To be honest i di not add all the stuff up beforehand.
It’s $535. So you just have to get a 7% discount and we are under the promised $500. Agreed, it’s without a graphics card.
If you are not already on your way to the computer parts dealer of your trust, subscribe to my blog and have a nice weekend.
If your usual backup software takes ages to make a decent backup of your computer and you need a quick (and dirty) way to backup you project directory you could use robocopy.
The syntax is easy enough:
robocopy SOURCE DESTINATION /parameters
For example, you need to backup your local development webserver:
robocopy “c:\xampp\htdocs” “e:\dev-server\” /E /COPYALL
This would copy everything newer or changed from your local htdocs directory to the ‘dev-server’ directory on drive e:
/E – includes subdirectories
/COPYALL – includes file information
For a detailed list type in robocopy /?
I made myself a backup.bat on c:\ and put all robocopy commands i need executed in it. So i can type ‘backup’ on the command line and every backup i need is made.
Backup your XNA game projects on a USB drive.
[YOUR USERNAME] = Windows account you use to develop (executing user must have reading rights on files, can be done as admin)
X: = Letter your USB drive gets assigned in explorer. You can change it there, but there’s usually no need for that.
robocopy “c:\Users\[YOUR USERNAME]\Documents\Visual Studio 2010\Projects” X:\MyProjects\VS2010 /E /COPYALL
robocopy “c:\Users\[YOUR USERNAME]\Documents\Visual Studio 2008\Projects” X:\MyProjects\VS2008 /E /COPYALL
Put these two lines in a filename.bat to backup XNA3.1 and XNA4.0 at the same time.