02Jun Cing from Java – C++ quirks
Lately I have been toying around with Visual C++ to rebuild some of my pathfinding algorithms done originally in AS3 and CSharp. While working on porting the code over, I can’t help to feel that OOP was just slapped into C++ from C. I might be getting this feeling as I use mostly Java inspired languages (yes, CSharp is also very Java inspired) that had a lot of forethought on how OOP should work and how developers implement it in their code. For example, it seems counter-intuitive to me to declare methods that float somewhere outside the class definition brackets. Also, it seems confusing to me that you declare the default values for method parameters in the method prototype and not in its definition. Additionally, why isn’t the compiler smart enough to look ahead for a function/method declaration instead of requiring the user to manually create extra code prototyping their existence. Perhaps Java-like languages has spoiled me, or I don’t see the “big picture” yet on why the language acts the way it does. Anyone from a similar background wonder the same thing about traditional C++?
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!
07Jan A New Kind of Science, Indeed
After reading Stephen Wolfram’s A New Kind of Science, I was impressed by the conjecture of the book (it has since been awarded several scientific awards), and I thought I would share here some musings I had after finishing it. The core ideology of the book is Reductionism which describes using simple programs to explain and reproduce complex systems that occur both in the virtual and physical world. As listed in the book, the definition of a “simple problem” is as follows:
- Its operation can be completely explained by a simple graphical illustration.
- It can be completely explained in a few sentences of human language.
- It can be implemented in a computer language using just a few lines of code.
- The number of its possible variations is small enough so that all of them can be computed.
23Dec CardSpace Fail?
I remember once Microsoft CardSpace was announced and shown to a group of MSDN members that I was apart of here in Detroit. The idea seemed fantastic- finally a way to secure user’s online identity and allow the user to relay the needed information to online applications without having to fill out forms anymore! However, there was some technical obsticles I foresaw. The biggest one being the solution was “magic”. The technology used a specialized IE plugin for integration (something that Chrome and until recently Firefox wouldn’t have), and uses technology paradigms that are not used commonly in the programming community. This not only locks down the platform, but the technology is incompatible to systems that do not have a Microsoft built extension. In addition the platform requires low level access to the operating system for security precausions meaning the OS needs to have been made with a special sandbox environment specifically for the application. Novell has been working on their implementation of CardSpace, but I have doubts about the user adoption rate.
What I am trying to say is CardSpace was an amazing concept, but it has failed to appeal to both the larger developer community and end users. I see single Firefox plugins that fill in forms having much more popularity and community buzz. They require nothing of the developer of the site, easy startup for the end user, doesn’t require the OS to support certain features, requires no installation (other than the browser plugin), and the concept is very logical to follow.
The only other idea that could have a higher adoption than these generic browser plugins would be a global informtion site that your personal form information could be tethered from. However, this would require a big name behind the project as people would not trust a service with all their personal information that they didn’t already have some form of trust with beforehand. Who could it be? Google perhaps?
On a side note, an excellent Firefox plugin for filling out forms is Sxipper
.
18Dec Why Google Native Client is not a Flash competitor
There has been a lot of buzz around the internet about Google’s new development project called Native Client. This very ambitious project attempts to being desktop applications to the web browser. This project has a very long road ahead of them as it becomes extremely difficult to regulate an application that is able to access hardware or low level software hooks at will. However, even when this project is able to find its feet, it is NOT a competitor to online interactive mediums like Flash or Silverlight. This is because desktop applications are tailored to the desktop platform. Sure, Native Client can run the game Quake through the browser, but why wait downloading 100+ megabytes to play the game inside a small browser window when you could download it in its original form and play it on the desktop? The platform is simply not web-friendly at its core. Having said that, perhaps one day once the internet speed is as fast as desktop HDs and Native Client is able to execute code without any dependency on the operating system, that would be golden. This would allow browsers (like Chrome) to literally be the operating system for the computer. However, while Native Client may be backwards compatible, Flash, Silverlight and JavaFX are working hard to bring OpenGL acceleration and near-desktop math processing support. These platforms are much more web-friendly as they are optimized to be compact and able to stream load their code during runtime (which is highly valuable when you are considering enterprise-class applications).
I’m still very annoyed by the fact that Flash, Silverlight, and JavaFX are all roughly 10 times slower in basic math operations than pure C# or any other desktop platform.
04Dec Programming News Week
Here are some random tidbits of news headlines and links I found of interest this week:
- PHP 5.3 will support Lambda functions/closures
- Python 3.0 released – backwards incompatible but contains much more logical syntax.
- Adobe Alchemy is it actionscript heresy? – good article stating that Alchemy could be little to no faster than AS3 once the compiler is optimized.
18Nov Flash Player 10 confirmed for Android (with video)
Well, I predicted that Adobe would be eager to develop for the Android, and here it is: a working demo of Flash Player 10 running on the G1 being displayed today at a conference:
This is VERY exciting news! While Flash games may be slow because of the device, video streaming and Flash/Flex applications will be amazing to utilize for development. For myself, this means I can create simple Android apps to interact with the device features (like camera) and use Flash for the UI and logic since I know that language much more than Java currently.
11Nov T-mobile G1 impression and Flash

Well, I finally took the plunge and got my first smart phone! I’ve looked at several choices over the past year like the Blackberry Bold, Storm, Apple’s acclaimed iPhone, Diamond Touch, Envy, and the LG Dare. However, after measuring the pros and cons, I decided on Tmobile’s G1. Why, you might ask? For one, I do like the full slide-out keyboard, touch screen, and trackball features. However, the G1′s biggest asset is of course Google’s open source Android operating system that it runs on. Android will allow even intermediate Java developers to make applications easily and publish to the market for other users to use. Examples of current applications are: barcode scanner and local prise comparison, parking spot locater on a radar display, social networking integration including direct camera posting, use mp3s as a ring tone (iPhone requires a painful hack for this to even work), remember-the-milk task reminder, weather display, and much much more. Heck, if I can find enough time, I will start writing applications for it.
Also, the cost of the phone is cheaper (its $170) and the monthly contract is about $25 cheaper than the iPhone (which the savings alone is as much as my internet home service). Overall, I have had the phone for over a week and can say nothing but good things about it. I did have some issues with the T-mobile service line… but to be honest, most of the tech support reps have not even seen the device since the G1 is sold out across the US right now.
My two wishes for the phone are longer battery life (with RC30 bios and 3G disabled, I have 80% battery by noon with lite use) and for Adobe to bring Flash Player (preferably 10) to the Android Market! I assume if Flash Player 10 where to ever to hit a cellphone device- that it would be the G1 since Adobe has been a well known Java centric company internally, but FP is written in C, if I remember right, so it will need to be transported to Java OR run as a Linux app directly on the G1 outside Android.
Note: RC30 update now has a viewer for most of the Microsoft Office formats.
Update #1:
At the Adobe MAX 2008 conference, Turner indicates that an “Android port” [of Flash Player 10] is coming!
Update #2:
Flash Player 10 confirmed for Android (with video)!
