Naturally, a lot of my search engine traffic comes here from searching for terms like “system root in <insert language here>” or “%systemroot%”. So, to live up to my domain, and you Googler’s expectations, I’ve decided to write a post about how to get the path to the system root in a few languages. If you know more, drop a comment and I’ll add it here.Read the rest of this entry »
While working on Fondusi’s I came up with a great way to store the map data (or any binary data, really) in such a way that previous files could be loaded using new versions of the software. It has some great capabilities and, after answering a question about it on gamedev.StackExchange, I thought it might be helpful to write a post about it here.Read the rest of this entry »
I was recently working on an ASP.Net project and was receiving this error on attempting to
.Open() my SQL Server database connection:
System.Data.SqlClient.SqlException: Cannot generate SSPI context.
As you may have noticed, the connection uses SSPI (i.e. Windows login authentication) to connect to SQL Server. I thought this was a bit strange and tried restarting the project (it was running in debug mode). That didn’t help.
Fortunately, I remembered that my Windows password was set to expire today. It had expired while I was logged in, and so, was preventing me from being able to authenticate my login with SQL Server.
So, if you’re receiving this error, try updating your password if it may have expired.
This week we spent some time doing little things – fixing bugs, changing how things look, etc. We also started work on the networking code which is what I talk about in this post. I discuss the beginnings of the TCP multi-client server application with actual code examples and descriptions.Read the rest of this entry »
The second week of development was spent reorganizing the map editor and fleshing out more-or-less how we wanted it to look and function. We added a basic pixel shader effect file and changed how players move across tiles, which I discuss in more detail in the full post.Read the rest of this entry »
I was recently working on an XNA project and needed to convert from an angle to a Vector2. There are a lot of resources showing how to go one way (angle->Vector2) or the other (Vector2->angle) but not many showing both. So, I figured it might be helpful to put it up here, even if I only use it for reference.
Angle -> Vector2
float myAngleInRadians = Math.PI; Vector2 angleVector = new Vector2( (float)Math.Cos(myAngleInRadians), -(float)Math.Sin(myAngleInRadians));
Now, the reason I make the Y value negative is because that’s how the screen coordinate system works. If you didn’t do this, the angle in radians would go clock-wise instead of counter-clockwise.
Vector2 -> Angle
Read the rest of this entry »
One of the annoying things with XNA, happens when handling mouse clicks. If you’ve ever worked on an XNA windows game (note: this only really applies to a windows game) in windowed mode and tried switching applications, you may have noticed that XNA still captures the clicks even when the window is not active! It also reports the mouse position when it’s outside of the window which can cause more issues in and of itself. Unfortunately, the fix for the first problem doesn’t work if you’re using multiple forms in the same application.
So, we have three issues:
- XNA captures clicks while the game is not active (i.e. from other applications)
- and it reports the mouse position when it’s outside of the viewable area
- and the fix for the first item above doesn’t work when you have multiple forms in your application.
Fortunately, there’s an easy way to resolve these! “Great!”, you say, “now how do I do it?”. Click on, my friend.