Tuesday, September 29, 2009

Game Developers are Developers too. . .




Being with Influxis for a while now, and speaking at various conferences I've noticed something kinda strange. There's an elephant in the room that the developers are talking about (and I'm not talking about how the hell a bum became a developer).

There's a weird lack of Game Development sessions at Flash/Flex conferences. Unless you are going to a "Gaming" Conference, mum's the word on Flash Game Development (i.e. the awesome Flash Gaming Summit I went to in San Fran). And I don't understand why this is.

Is it because the Flash Rockstars aren't making games? Well, I know Grden and Zupko are basically in the Unity3d camp. But Keith Peters has made some awesome flash and iPhone games.

I think there should be more talks about game development at the major conferences. It's a MAJOR part of the Flash Community. I think it would also help bring the level of development up across the board. Games are hard to make. They usually require lots of Maths, Physics, and Artificial Intelligence implementation. Not to mention a healthy helping of Design Pattern knowledge. I also think that if you put a lot of the harder programming/architecture concepts into game terminology, things become a little less scary, and easier to visualize.

Then maybe, just maybe. . . non-gamers will see the art behind game design. Also, maybe we could figure out a way to make some money off of Flash Game Development. That would be pretty cool I think.

Thursday, September 24, 2009

Part one in my AI for Flash Devs: How to make your own SkyNet in AS3!

I have an unhealthy obsession with Artificial Intelligence. I've always wanted to make a trainable system that learns on it's own. Sounds like fun right?

Don't be scared. It's actually not that difficult to do.

For part one of my intro to Artificial Intelligence for Flash Devs series I could have gone over Finite State Machines, Chasing and Evading, Pattern Movement, or Flocking. Yep, I really could have, but those have been done to death. Let's do something interesting. Let's make a Perceptron.

Think of a Perceptron as a smart Boolean. Due to the various stimulus it receives and it's training it will choose one of 2 choices. This is called a Linear Classifier because the problems it can solve have to be linearly separable (yes or no, red or blue, buy or don't buy).

So, here's an example with everything shown: Seantron's Perceptron.

Let me explain what's going on here.



This is your Network. Blue is input X and Red is input Y and those are connected directly to your output O (the white circle). So each connection has a weight value, and by adjusting the weights we are able to train the Network to do stuff on it's own.



This is the graphical representation of your Training Data. Huh? Well, let's say you have figured out a system for buying stocks. Your blue points could be stocks that meet the criteria that you want to follow to Buy The Crap Out of those Stocks! And guess what the red points would be? You guessed it, Those Stocks Suck Ass, Don't BUY!

So you training data sets the weights (which are those crazy numbers in the Network pic) which allows for the Network to buy or not to buy on it's own. Yes, in this example we are training the system by hand, but I will teach you how to use something called Back Propagation to set up a system to train your Network for you.

*As per makc3d's directions* end edit:

Here are some links to help you with what is going on with the science stuff:

http://en.wikipedia.org/wiki/Perceptron
http://www.youtube.com/watch?v=eDYOH9q2QdA

Gradient Descent is what is used to calibrate the Weights.

http://en.wikipedia.org/wiki/Gradient_descent



Here's the AS3 for the Perceptron example:

DOWNLOAD THE .AS HERE



*Updated the Code and posted it at the link above.  It's been awhile and it seems this blog got weird, sorry about that.*

Tuesday, September 22, 2009

Resistance Is Futile *edit*

Guess what? I don't come from a computer science background. Hell, up until 2 years ago, I thought I was going to be a Music/Motion Graphics dude. Yep, I was an artiste (an uber dork, but an artist none the less).

And one would have to be riding the short bus not to notice that most of the Flash Devs come from a similar background (notice I say Flash and not Flex, ahem). This blog post is directed at you guys, my fellow flash devs/UX dorks. You programming autodidacts (look it up mofo!) in the audience. So, if you come from a compSci background, go back to reading your white papers or writing your book on functional programming for AS3. You probably know all of this stuff.

Please understand the intention of this blog post: I'm just sharing things that weren't taught to me right off the bat. I was starting to feel a little behind the curve, and was wondering if I needed to go back to school or something. F that. Who needs school when you have blog posts and wiki/tutorials to read?

Check it yo. This is my list of things to learn by the end of the year, wanna follow me on the journey? It might be fun, nah, it'll probably suck, but you might be able to make some more money. Got your attention? Coolio. Let's get smert!

Intermediate level:

1. ANT. Learn it, love it, build it. (thanks FlashBum)
install ANT Flex Builder 3
do something with ANT

2. Command line blues. Afraid of the command line? Don't be! It's a powerful tool in the jedi's arsenal.

3. SVN, GitHub whatevs. Use one. Organizational skills are needed. If you are like me with everything on your desktop, learn organization. A clean mind is a razorsharp mind with teeth that can destroy major problems.

*3.14159 Learn Design Patterns. Here's a book to get you started: AS3. Like really really learn what MVC is. Because there is a difference between knowing MVC and KNOWING MVC. You'll know when you know it, because then a bright light from the heavens shines down upon you, and your eyes start to glow green. Seriously, look at my Twitter avatar.

4. Learn a real language. AS3 is rad, and it's my first language so I'll always have a special place for it in my cold dark heart, but it's very limited. If byteArrays throw you for a loop (ha, programmer joke! sigh, I know) learning C++ might help you with that. I don't know if I can recommend C++ to everyone, but try it, you might like it. There is a lot of power behind that language. Especially in this bad economy, multilingual == security.

*4.5 Learn Data Structures mofo! And algorithms if you dare.

Advanced level:

5. Study what's been open sourced by Adobe, like the Flex Compiler (java) and Tamarin (c++) the Actionscript Virtual Machine 2, or aka what makes AS3 run. By knowing what actually is going on under the hood will ultimately make you a much better programmer and/or bitter/insane. Then you'll start to understand what Joa Ebert has been talking about for the last year or so.

6. Embrace change, don't resist everything. I'm saying this as much for myself as for everyone else. Also try to think optimistically. Ha!

Jedi/Sith level:

7. Learn a Functional Programming language. I've been studying Erlang and F# a bit, which has allowed me to figure out the idea behind the XMPP protocol. I've also been told that Clojure is pretty awesometastic. This is the added bonus level though. Functional Programming is not easy at all, it's based on Lambda Calculus and it looks like it too. I've also heard that once you successfully complete a project in Erlang that not only do you get a free membership into Mensa, but you also learn the secret to space time and who shot JFK.

it's time to start the journey in 3, 2, 1. . .