11Nov Rise of the languages
This month has been a very interesting/exciting for programmers of all backgrounds and may be the cornerstone of an industry wide conceptual change.
Unity3D, a primarily web based 3D accelerated language, has announced their “indie” version of their engine as a free no-strings-attached package. This was a wise choice for the company as Google’s free O3D alternative has been gaining support and Adobe’s Flash is rumored to get 3D acceleration soon.
In just a week later, Epic Games released the Unreal Development Kit (UDK), a desktop commercial gaming engine, free of change for non-profit usage. UDK, however, does not compete with Unity3D. UDK has an incredible desktop graphics engine that Unity3D would not be able to compare to. However, Unity3D can run over the browser, has a super small file size for compiled games, and is much easier to learn than UDK. It is also worth mentioning that Unity3D is not a direct competitor to Flash either as its tools for 2D development are poor at best and Flash is installed on almost 97% of all computers (while Unity3D is around 6% I think). There has been little news on the haXe side of things in the past month which is a little disappointing considering the potential of the language.
Finally, Google unveiled Go programming language which is tailored towards system and server development and takes advantage of concepts like multi-threading and server clustering of tasks. While this is not terribly exciting for some, this language may reduce much of the massive complexity employed for enterprise systems and servers today.
One of the underlying themes we are seeing here today is that the user community around a platform is king. A developed language may be perfect and boast all kinds of features, but without users, it inevitably fails. As a developer, this is a fantastic change in the industry as it means cheaper or free entry into powerful languages and more help and support being offered to the community from the creators.
18Aug Round 2: haXe vs Unity3D vs O3D vs SFML
The bell rings, and it’s another showdown between modern drawing APIs. Over the past couple weeks, I have weeded out many of my choices of libraries to now these four. What happened to some of the others? XNA, I determined, was way too XBOX360 centric with its multitasking, shaders, and DRM all tailored to the platform. Again, my primary aim was to develop on a Windows platform with possibly Mac compatibility. In addition, XNA requires end PC users to install the XNA framework package which only causes additional hassle for the user to install the game. Blade3D is also removed from the list as they recently went under last week, leaving many of their subscribers scratching their heads. Below is my up-to-date list for viable platforms to use for developing my prototypes and AI research:

- PROs
- Faster than AS3 10% to 200% depending on use
- Single language to also write the server platform
- Flash Player 10 has a huge penetration rate (87% roughly)
- CONs
- Still rather slow

- PROs
- Faster than Flash by at least 400% in math and drawing APIs
- Growing community (10,000+ users)
- CONs
- Costly
- Focused around primarily 3D development
- Small penetration rate for its player (maybe 5% or less)
O3D by Google Labs
- PROs
- Comparable to Unity3D
- Bleeding edge technology
- Google’s supported platform
- CONs
- Buggy and very new
- Lacks industrial strength demos
- Extremely small player install base (< 1%)
Super Fast Media Library
- PROs
- Super fast 2D library (several times faster than the above APIs)
- Uses C++ and would allow higher customization and flexibility
- CONs
- Desktop installation / is not loaded by the browser (user barrier)
- Only meant for 2D
02Apr HaXe vs Unity3D vs XNA vs others
For the past couple months, I have been trying to determine the best platform to become my primary language for game AI unit development, shaders, and working on theories of improving the Fridge-A* algorithm. However, choosing the right language has become an arduous task. Hardcore programmers will scream “C++ is the only way to go!” while the elites say “C is so much better than C++” and of course there is that one guy who comments “Why would you use anything other than Assembly language?” The problem lies in the fact that I am doing this work on my own and do not have XX hours to write an elaborate garbage collector, manage raw threads, or constantly keep track of hundreds of pointers. On the other hand, I must have enough speed and processing power to do the research and development I want.
Some suggest Java as a game platform as the language is respectable. However, graphics rendering speed and the Java gaming community is poor at best in my humble opinion. I did enjoy using BlitzMax back in the day, but the engine is simply not powerful enough to create something near commercial quality. Also, the popularity of the language is low, and I would have little professional use for learning more of the language. Flash AS3 is my primary profession; however, its performance leaves much to be desired at times. On the other side, Silverlight 3 is looking rather nifty, but the API still looks funky and doesn’t seem like the engine is really mature enough to do any major development in. Perhaps, if Silverlight 4 has near XNA speeds, better shaders and bitmap drawing, and the XAML to C# connection has less oddities in the API… it would be a contender for my list. Aside from the web platform, I could also go for a super high-end engine like Unreal Engine 3 or Source, but I couldn’t ever hope to produce something commercial with it because of the insanely expensive licensing (hundreds of thousands we are talking about!). Of course this is also Torque, but I have not been impressed with any of the games made on the platform, and there is a moderate cost to get started with it.
So I eventually evaluated my choices to XNA, haXe, and Unity3D:

Pros:
- Very fast (Fastest of the choices)
- Great shader support
- C# is a nice language with advanced OOP support
- Xbox and Windows deployment
- Free for indie users
Cons:
- Meant really for just the xbox… there is little support for Windows only deployment and DRM concerns. Also, no luck for Macs.
- Unlike the other two, XNA cannot steam which means a smaller audience because of the hassle of downloading
- Super new so the community is not that large in general

Pros:
- Compiles out to Flash which 98% of users have already installed
- Real-world benchmarks show 2x the speed of Flash 9 using code performance optimizations unique to haXe
- From working with haXe, I will use that same knowledge to build javascript and neko scripts in the future if I wanted
- I can use my existing knowledge of Flash to accelerate my development
- Totally free
Cons:
- No Flash IDE
- Also super new with a small community and little to speak of tutorials
- Still slower than unity3D and XNA
- Currently does not support importing Flash libraries which reduces the amount of existing libraries I can bring over versus just using Flash AS3.

Pros:
- Fastest of the web 3D engine… also nice looking
- Supports developed on Macs and now Windows
- Uses Python for scripting
- Supports large number of users for networking and shaders
Cons:
- No free version to try things out (only 30 day trial)
- Costly software (the indie license has a terrible roster of features making the Pro version the ideal choice)
- Little resources and support for making 2D games… everything is geared for 3D development. This can be a negative thing for me as I like to develop quick 2D testing scenarios for AI scripts. From what I can see, there are few tools for doing advanced bitmap drawing.
Final thoughts:
In truth, I have not made up my mind yet. The pros and cons of all the solutions seem to make every choice the same weight in how it appeals to me. I could forsake all the above options and just go with C++ with Allegro or SDL, but they too have their ups and downs. Allergro is really slow without full DirectX/OpenGL support and SDL seems to have an aged API with little in the future for it. Also, neither of those libraries natively support shaders. XNA would give me all the speed I would need for what I am trying to accomplish, but using a language that streams over the internet would give me a much wider audience.
Well, what do you say readers? Are there other languages I should be looking at? For my next post on the subject, I will try to make some benchmarks in all of the three languages to test their true strengths.
27Mar Further Reading on Design Patterns
As a followup on my Wednesday lecture on design patterns, I wanted to post some informative resources for learning more about design patterns outside the next lecture on the topic. Also, I wanted to say thanks for everyone who showed up to hear me rant about code structure (not the most exciting topic in the world mind you)!
Design Pattern Definition
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved.
- read more at WikiPedia
MVC Definition (the most common principle of Design Patterns)

“Model–View–Controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. In MVC, the model represents the information (the data) of the application; the view corresponds to elements of the user interface such as text, checkbox items, and so forth; and the controller manages the communication of data and the business rules used to manipulate the data to and from the model.”
- read more at WikiPedia
Books:
- Gang of Four’s original Design Patterns
- Advanced ActionScript 3 with Design Patterns (highly recommended)
- ActionScript 3.0 Design Patterns: Object Oriented Programming Techniques
AS3 Design Pattern Informational Websites:
- www.as3dp.com – ActionScript 3 Design Pattern Blog (Principles Category)
- ntt.cc posts on of porting GoF design patterns to AS3
Flash Design Pattern Frameworks:
(for now, it’s best to avoid these until you understand the fundamentals of MVC)
Good Design Priniciples:
- ALWAYS type your variables (not really design principle but I too often see people doing this still)
- An object/MovieClip should contain the actions that it performs (as oppose to objects outside the class forcing it to perform actions)
- A class should never be able to “break” if the user sets a property or calls a function on it when they are not suppose to. Keep preventive logic in the class that’s doing the work.
- A good chosen design pattern for a problem will not take any longer to implement than not using it with spaghetti code.
Feel free to leave comments or email me about any further questions you have about Design Patterns or where to find additional materials on it. Have a great weekend everyone!
07Mar State of the Developers
The past week has been extremely busy for me as both work and my personal research projects consume most of my waking moments. However, I believe that it is important more than ever to continue my blogging as it helps me remember the little bits of wisdom I stumble upon and to keep a working achieve of notes to reflect on. Otherwise these things become forgotten in the hussle of the present. Well without further ado, here are some collected tidbits of information from across the internet:
Quelsolaar Blog (http://news.quelsolaar.com/)
This is a fantastic blog of Eskil Steenberg who is both an amazing C developer but also humanitarian. He has a fantastic knowledge of shaders, networking, color theory, real-time modeling, and abstract game theory. His blog covers some of these items as well as some great topics on humanitarian subjects.
Scarygirl being developed by Touchmypixel is a very impressive Flash game. However, I couldn’t find any information on when it will be released.
Shred Nebula, a small game studio in California, released its documents (http://www.shrednebula.com/design.html) that details their XBLA game used for pitching to Microsoft. With over 35 pages of amazing conceptual illustrations and information, they where accepted, and their game sold fairly well. Below is a picture of their home brew studio. I love the comfy armchairs for the projector demo setup and the arcade machine in the corner.
Last but not least, I found an interesting video on FORA that talks about the concept of metacognition:
Have any links about the development world that you found interesting? Please do post them below!
26Jan FlashVars for EVERYONE!
When building utilities that can be used with both Flash and Flex, there are two common hurdles that developers run into. The first one is that Flex does not pull FlashVars the same way that Flash does. This means for ActionScript utilities that rely on html inserted variables will need to be separated into two separate files or need to have flashvars passed into the utility from the outside. Another hurdle is that Flash does not have a global reference to Stage- instead it can only be accessed through display children of stage. This is problematic for utilities that work with Stage as they can only get there reference of stage when it’s manually passed into the utility as a parameter which can result in an ugly web of stage references being passed around.
However, I finally got the time to develop a workaround that solves both problems with classes FlashVars and StageReference. The tricky part of this implementation was building a utility that could use the class Application but not reference it when it was being built from Flash since it would cause the compiler to fail from the invalid class reference. I worked around this issue by grabbing Application by getDefinitionByName so that the Flash compiler wouldn’t fail since it was a weak reference.
With Flash, use StageReference.stage = stage in Frame 1 or in your document class’s constructor. This will give you the global reference to stage and also allow the new class FlashVars to pull flashvars automatically when compiled in a Flash project.
The custom class FlashVars is used in this fashion:
or
This usage is exactly the same from Flash and Flex! No more having to switch from loaderInfo.parameters to Application.application.parameters when porting utilities between Flash and Flex.
Download (includes StageReference): flashvars.zip
08Aug Theory: AI Directives
I have been musing about the best practical way for giving NPCs (non player characters) a clear set of directives for living in its environment using simple AI logic. Based on the notion that any character’s environment is dynamic, en-queuing a character’s broad set of daily actions seems impractical. Instead, it would seem more logical that a NPC is assigned a range of actions they are able or willing to perform and given a rule on when they are ‘prone’ to each action based on different weights. For example, instead of having a NPC eat exactly three times a day, the NPC would have a hunger counter and when the value reached so high- they would seek out food. This would allow a higher dynamic range of actions for the character as they could eat more or less during the day based on things like how much physical activity they where doing or if they ate something that reduced their hunger for the next meal.
05Aug Flash Links of the Day
Science&Code: Actionscript optimization
Posting on FinalFinal.com on the makings of the Red Invaders Flash Game.
Casual Game Development Blog – Techniques and Algorithms (most theories can be applied to Actionscript)
05Aug Meta4orce Flash Game
This is a very well developed game that while not original in the game type- the implementation was well executed. The objective of the game is to build defending structures to keep the red bits from passing through the level…
http://www.bbc.co.uk/switch/meta4orce/launch.shtml?id=shocktothesystem
