My website that this blog is attached to (codersplayground.net) is getting an update. If you want to see what I am doing with it you can go to the dev section. Be aware that not all the content will be present.
Optimizing For Loops
I am pretty obsessed with getting every little bit of performance I can out of my code, especially when developing for mobile platforms. For loops, believe it or not, can be optimized using some very simple tricks.
Finding Initial Velocity Given Angle and Distance
Projectile physics can be a little complicated, especially if you already know where you want the projectile to go, and just need to figure out the required velocity. This post derives an equation which takes in a destination and launch angle and gives you the velocity you need.
The Thing About Raycasts
Raycasts are expensive, or so we are told, but just how expensive are they? This post, at a basic level, covers what exactly they do, and how are they used regularly.
Unity Android Key Mappings
Android devices have a number of physical or partially physical buttons. These and other inputs actually map to keyboard and mouse events for convenience. Here is a list of the mappings.
Finite State Machines
To expand on my earlier post about enumerations I'm going to look at Finite State Machines in a relatively general sense. Let's start with breaking down what exactly a Finite State Machine is. We can look at the descriptive words to see that it is a machine, or system, that consists of a finite number of states. Great, but what does that mean? In a sense it is a way to package your code so only the desired pieces run at the desired time, this makes them very useful for succinct organization. In the rest of the article we'll look at different ways to implement the system, as well as the pros and cons of each.
Unity Docs Design Updated
I would just like to make note that the Unity Scripting Docs have been updated. You may be wondering what exactly was updated, it seems to function the same as before. Force a refresh (Ctrl + F5 or Shift + F5) and look at the navigation bar at the top. See the new colors and layout? This is actually a significant improvement. The navigation buttons are now all on the left side above the other navigation bar, not only this but the bar below the main navigation bar is a different color which matches the currently active tab. The text color has also changed. The consistency, layout, and contrast provided by this update actually make the docs more usable. Doubt it? Well, for starters, I didn't even realize that on the sub-bar there was a link to switch from the script documentation of a class to its component documentation until after this change. Did you know that link existed?
Unity Docs Design Updated
I would just like to make note that the Unity Scripting Docs have been updated. You may be wondering what exactly was updated, it seems to function the same as before. Force a refresh (Ctrl + F5 or Shift + F5) and look at the navigation bar at the top. See the new colors and layout? This is actually a significant improvement. The navigation buttons are now all on the left side above the other navigation bar, not only this but the bar below the main navigation bar is a different color which matches the currently active tab. The text color has also changed. The consistency, layout, and contrast provided by this update actually make the docs more usable. Doubt it? Well, for starters, I didn't even realize that on the sub-bar there was a link to switch from the script documentation of a class to its component documentation until after this change. Did you know that link existed?
Enumerate! Enumerate!
Fans of Doctor Who will probably shun me for that titling. What are enumerators, or, more specifically, enums? To put it succinctly, enums are words that are actually numbers. What does this mean? It means that when you write your code you can check for words, but when it gets compiled the compiler takes those words and replaces them with numbers. You may wonder why to bother with such a thing. It's pretty simple really. Enums allow you to have readable code while keeping a small overhead. They are better than character strings because they are smaller, and they are better than just plain integers because they can be rearranged, and are much more readable. Below is an example enum use:
The Case for C# in Unity
I would like to take this post to explain why using C# in Unity is a better idea than Javascript. If you end up not needing multiple returns for functions, non-type-specific logic, or are okay with the wonky auto-completion for Javascript, then that is okay. On the other hand, if you want to take advantage of those features, and more read on.
Important Notes on Touch Input in Unity
There are a few things that you will want to keep in mind when working with touch in Unity. Mobile devices pass click events with their touch events, platform dependent compilation, rotations are a special type all their own, sometimes Unity hands back one thing when you need another, collisions are odd, and much more. This is the first of many posts on the quirks of Unity.
Ram Dass Quotes
"As long as you have certain desires about how it ought to be, you can't see how it is."
"All spiritual practices are illusions created by illusionists to escape illusion."
Moving Things
Just a quick note, I will be moving all my posts over from http://codersplayground.tumblr.com/ to here and eventually removing that blog just to keep things nice and clean.
print('Hello World!');
Alrighty, here we are starting things off. I have been meaning to integrate my blog into my site for a while, and here it finally is. Right now I am working on a pretty interesting game project that has brought about a large number of problems already for which I will be providing solutions for. Check back to see what all you can learn regarding general coding practices, memory management, vector mathematics, Artificial Intelligence, system simulation, and more!
Windows + DirectX + Minecraft Server Automation = Wat
A little while back I made mention of some Minecraft Server Automation programs that I would be working on. They were nearly finished when I had some data loss on my development machine. Sadly my backups were not very current. Fortunately this gives me the opportunity to rework the programs in a more interesting manner.