Programming, Visualization and Game Development Theory

23Oct Flash 11 – UDK and Unity arrive

With the advent of HTML5/WEBGL gaining popularity, Adobe knew it had to move fast. Within a matter of two years, they designed and implemented one of the largest platform updates I’ve seen in the industry- Flash Player 11. It sports direct GPU integration allowing for console quality games to be possible through the browser. If this wasn’t big enough news, they have been working with Unity and UDK to enable an export format from those [now] game tooling platforms. Below is a video of the Unreal Engine 3 running within the browser:

I’ll be spending the next couple weeks writing my own engine for Flash 11 and will update here when I have something working. The new API is not as easy compared to the standard display list or even Papervision for that matter, however it allows you almost total control over the GPU shader pipeline. While ActionScript 3 (AS3) can get the job done, I wonder how long before the haXe community starts implementing the new version. I’m super excited to experience such a radical new set of tools for game development!

Related external articles: 
http://www.epicgames.com/news/unreal-engine-3-supports-adobe-flash/
http://blogs.unity3d.com/2011/02/27/unity-flash-3d-on-the-web/ 

 

06Apr JAD Update: Social Games

I’ve decided that I’ve neglected my blog long enough and decided it was time for an update. Here we go *long breath*…. Within just the past couple years, I’ve moved from Michigan to San Francisco and have been working primary in building mobile and Facebook social games that have given rise in the gaming industry. I did a number of projects at Crowdstar including Hello City and Mighty Pirates, and now I’m working on the largest project yet in my career at a newer startup called Metamoki (created by Dave Maestri, founder of Mafia Wars). The game development industry in Silicon Valley is rather interesting on a couple of facets. In some ways, it’s repeating the game design that originated back in the DOS and Commodore days. On the other hand, there are mechanics that are new and ‘alien’ in nature. Of course I am referring to the “social” aspect of Facebook games. In some FB games, the meaning of social is almost laughable as it doesn’t really exist. Even the best games in the industry still do not compare to the social aspect of co-op gaming that is rather prevent now in modern commercial games. Recently, big names in the traditional gaming industry are starting their own studios in hopes of breaking into the market. It will be very interesting to see what happens within the next two years.

Aside from the industry as a whole, I’ve been busy writing my own isometric engine, data structures, tooling, and learning other languages to support my day-to-day work. As soon as I think I’ve built the fastest possible system, I always find one more way to make the performance that much faster. I’ve also come to understand computer science more on a fundamental level beyond languages. It really helps to know what is happening behind the scenes when using language core libraries… just because a language provides a core function doesn’t mean you should use it! I have written a great deal of code that basically does what Flash already provides, but the level of performance can reach an average of 2-10x improvement (which helps significantly). I’ve also been following the methodologies of SOLID <http://en.wikipedia.org/wiki/Solid_(object-oriented_design)> and being mindful of these principles really improves the rate in which I can iterate game concepts and cuts down time to complete maintenance tasks.

I’ll finally wrap-up and show off the last two games I’ve developed at my previous work with Crowdstar:

 

Visit the games below:

Maestri

10Nov Flash component oriented programming

In this article, the author is a bit half-crazed… bantering that OOP is dead in light of entity/component systems. However, if you can get past that, it’s a good read on the benefits of composing game objects using only composition (instead of complex inheritance):
http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/

An example approach to implement an entity system might be as follows:

function example():void {
// find game entities by tags or what components it has.
var entity:Entity = Entity.getEntity(Tags.SPACE_SHIP, Tags.USER_OWNED);
entity.health().current--;
entity.health().reset(); //or entity.health().saveToServer();
entity.mc().x = 10;
entity.tooltip(); // setup a tooltip on this entity.
}
class Entity { //Contains getters to all game components (this class could be subclassed)
public function has(...args):Boolean { ... } //args are either Tags or component class references
public function tag(name:String):void { tags.push(name) }
public static function getEntity(...args):Entity { ... }  //args are either Tags or component class references
private var tags:Array=[];

 private var _tooltip:Tooltip;
public function tooltip():Tooltip { if(_tooltip) return _tooltip; else return _tooltip = new Tooltip(this); } // could be getters
....
}
Class Tooltip { // multi purpose tooltip class
public function Tooltip(entity:Entity):void {
if(entity.has(Tags.SPACE_SHIP))  shipTip();
if(entity.has(Tags.CHARACTER))  pirateTip();
if(entity.has(MovieClip)) entity.mc().addChild( tooltip_mc );

private function shipTip():void { ... } // position and setup gfx
private function pirateTip():void { ... } // position and setup gfx
}
class Tags {
public static const SPACE_SHIP:String="ship";
public static const USER_OWNED:String = "userShip";
public static const CHARACTER:String = "character";
}

What are your thoughts? Can a pure entity system be implemented in AS3? Are entity systems worth pursuing in AS3 game development?

04Jan Now=new Year(2010)

As the new decade begins, millions of people reflect on their situation and ponder how to proceed into the future. In many ways, 2009 was a game changer for the multimedia industry. We have seen Unity and the Unreal engine open to their doors to free indie developer licensing. This illustrates that corporations are realizing that even a great multimedia software infrastructure can be shoved aside for lesser alternatives that however have the strong community around its platform.
We have seen also a greater focus on one language compiling to multiple platforms. Adobe is pushing for Flash to compile natively to the iPhone and pushing the Flash player to all other mobile devices. Unity also aims for compiling to PC, Mac, and iPhone with little changes needed to the source. Microsoft continues to push XNA that has the boon of both PC and XBOX360 support. Of course, haXe continues to gain in popularity as it is a single language that translates into other platforms (Flash,  PHP, Neko, and C++ SDL).

Over at Bill Sander’s blog AS3 Design Patterns, he talks about his journey into design patterns and that his New Year resolution is “Improve nailing down relationships between classes in design patterns.” This year I have expanded my knowledge of design patterns in areas that I do not normally require in my everyday work, but just learning their existence has given me the enlightenment of not just how the design pattern works but ‘why’ it exists and what would happen to a system built without it.

My personal development New Year’s resolution is: “Learning to prototype quickly while keeping modular using loose coupling.” Being able to produce a skeleton of a system quickly helps to a keep the momentum of a project going and to isolate design flaws. However, rapid development can cause a system to be become stagnate and locked into a certain implementation. However, wise programming decisions like using the acquaintance relationship between classes and employing design patterns like strategy or template will make my prototypes open enough to evolve into the final product without infrastructure rewrites.

Update: While technically the new decade starts in 2011, I find the debate mute as people will refer to this era as the “2010′s“.

(more…)

15Oct Adobe MAX09 Aftermath

max09_640x360_vasava

Overall, what we learned at Adobe Max this year was really nothing different than what we already knew months ago almost. Granted, finding out that Flash CS5 can export iPhone apps (perhaps they bundle the player and the flash file together?) was pretty neat- it was not really unexpected. Every cell phone will be getting Flash player soon (including the iPhone with the special export) which will really help increase the hold that Flash Player has on the market. However, there really wasn’t anything other than this announced that was worth getting excited over in my humble opinion. AIR 2.0 is coming out soon, but it’s roster of new features is rather lackluster for a new revision number- it should have been a patch number I believe.

On the flip side, the speakers and show setup were truly aweful. Speakers droned on as if they never bothered writing an outline for themselves, and I felt many ‘novelties’ of the show were tacky (like the canned video of the iPhone app doing the wheel-of-fortune company picker). Even the jokes the speakers used to lighten the content fell so flat that it was as if they were in lue of another joke. Don’t get me wrong, I am definately an Adobe fan boy- I just felt that they put almost no effort into their presentation. Anyone else feel the same way?

27Jul haXe 2.04 – Surprises and Yawns

haxe_logoOver the weekend, we finally had a new release of haXe made available, bringing the current version up to 2.04. The new version mostly is for resolving a slew of obscure bugs; however it also introduces early C++ translation support which is definitely something to keep an eye on. Now we just have to wait till Flash Develop supports the C++ language additions. For the people who have not looked into this language, it worth your time to at least check out as it’s one of the few mature mutliplatform languages available today.

Haxe information and download

Update: Nicolas Cannasse has a simple example of a C++ compile on his blog.

Changes 2009-07-26: 2.04

  • flash9 : fixed get_full_path error with -D fdb
  • js : fixed Array.remove on IE
  • flash8 : removed extra empty AS3 tag (causing some issue with F8 loadMovie)
  • improved speed of Bytes unserializing (no need for BytesBuffer)
  • flash9 : bugfix, Null<Typedef> was generating dynamic code
  • flash9 : added error message in flash.Vector if used without flash 10
  • flash9 : fixed some “never” property access issues
  • all : added “never” property access support for all platforms
  • js : small syntax fix with value-blocks
  • js : fixed Type.enumEq with null values
  • js/flash8 : use &0xFF in haxe.io.Bytes.set
  • flash9 : fixed switch on Null<Int> verify error
  • flash9 : fixes related to UInt type + error when using Int/UInt comparison
  • as3 : improved Vector support, inline flash.Lib.as
  • as3 : bugfix with skip_constructor
  • as3 : added Enum.__constructs__ (allow Type.getEnumConstructs)
  • as3 : make all constructor parameters optional (allow Type.createEmptyInstance)
  • as3 : bugfix with property access inside setter (stack overflow)
  • all : Enum is now Enum<T>
  • all : added Type.createEnumIndex
  • all : forbid same name for static+instance field (not supported on several platforms)
  • all : renamed haxe.Http.request to “requestUrl”
  • all : renamed neko.zip.Compress/Uncompress.run to “execute”
  • spod : fix very rare issue with relations and transactions
  • compiler : added TClosure – optimize closure creation and ease code generation
  • cpp : added CPP platform
  • all : added ‘using’ syntax
  • neko : added ‘domains’ optional param to ThreadRemotingServer to answer policy-file-request
  • php : fixed php.db.Mysql so that getResult is consistent with Neko behavior
  • php : fixed __toString for anonymouse objects
  • php : fixed bug in overridden dynamic functions
  • php : fixed round to be consistent with other platforms
  • php : fixed bug concatenating two dynamic variables
  • php : php.Lib.rethrow now works as expected
  • flash9 : fixed bug with SWC output and recursive types
  • flash8 : fixed inversed arguments in __new__
  • neko : added neko.net.Socket.setFastSend
  • php: fixed String.charCodeAt
  • php: minor optimization (removed foreach from std code)
  • php: implemented haxe.Stack
  • php: changed exception handler to use haXe call stack
  • php: changed special vars to use the » prefix instead of __
  • php: fixed use of reserved keywords for var names
  • php: List iterator is now class based (faster)
  • php: fixed behavior of class variables having assigned functions
  • php: fixed php.db.Manager (was uncorrectly removing superclass fields)
  • php: added support for native Iterator and IteratorAggregate interfaces
  • all : added –display classes and –display keywords
  • all : fixed issue with optional parameters in inline functions
  • all : allow implementing interfaces with inline methods
  • all : enable inlining for getter/setter/iterator/resolve/using

15Jun FlashMVC 2.0 Released!


I am very pleased to announce a major update to FlashMVC to version 2.0 with its OWN website at www.flashmvc.com! This version is a complete rewrite of the original version with better attention to scalability and framework usage. Since this is a dramatic upgrade, I have changed the package name to com.jadbox.flashmvc2. This version scales much higher allowing actions to relay complex messages to the view and built-in code hinting system for the view to execute an action. This is done by a new class called SuperAction. Let me start with the basics:

  • action classes – these are normal classes (do not need to extent any classes) that perform an action
  • SuperEvent – this class acts like a model for a specific action class, as a constructor proxy for the action class. and as an event for once the action completes.
  • SuperModel – This class holds references to SuperActions which, in turn, hold references to SuperEvents and your action classes.
  • SuperAction – This class is a controller proxy between your view and the action that it needs to perform. It allows the user to dispatch a SuperEvent that gets used as a model/constructor for your action class.

Benefits from version 1.0:

  • The action has its own model/view (SuperEvent) to inform the view
    • The SuperModel has fewer global variables as actions have their own dedicated models
  • The model (SuperEvent) also mocks the constructor of the action class for code hinting
  • Using the framework with Flash is the same exact flow you would use with Flex (or Flash Builder)
  • Much more readable code for applications made with the framework.
  • ActionHelper removed in place of SuperEvent
  • If an action doesn’t require a unique SuperModel, you can use the base class SuperEvent or make a SuperEvent that covers multiple action classes (less recommended).

Example running an action:

SuperWebsite.instance.loginAction.dispatchEvent(new LoginEvent("test@test.com));

Example reading an action:

SuperWebsite.instance.loginAction.addEventListener(SuperEvent.COMPLETE, onComplete);
function onComplete(event:SuperLogin) { if(event.isInvalidEmail) trace("email was invalid") };

Head over to www.flashmvc.com and check it out!

05May What’s New, Doc?

design-patterns-book-coverwacom-bamboo-fun-medium-tablet-cte650k-300

I have had some people asking me what I have been scheming lately which in honest hasn’t been much. The weather here in Michigan has been finally nice for a change so I have been spending most of my free time cycling. However, I did go out last weekend and finally bought the fabulous Gang of Four book Design Patterns to add to my library. I know enough C++, JAVA, and Smalltalk to decipher the examples and apply it to whatever language I might be using these days (which has been lots of AS3, haXe, C#, and Unity3D). I also decided to join the tablet bandwagon and added a Wacom Bamboo to my collection in hopes that it will inspire me to work on my art portfolio that I have been neglecting. The surface really feels (and sounds) like you are drawing on paper!

In the next coming weeks I will be working on FlashMVC to do some cleanup and perhaps add more examples to the repository.
Lastly, I have been experimenting on AI development with local unit world data deresolution and querying. Such a system I am building will allow NPCs to explore large environments while meta tagging locations of interests for latter lookups. Usually this isn’t as complicated as the process I am developing, but I have to design something that is agile and performs well in the Flash player environment. I will blog more about this soon most likely.

O, and thank you to the people who came to my lecture on design patterns last week! I hope everyone was able to walk away with some practical knowledge to apply to their own projects. There is a good chance that I might continue this lecture in the future to dive deeper into a variety of AS3-applicable development pattens. The video camera we had in the room had some issues (we lost the second half of the lecture), but I hope to get the recording compressed and posted here soon.

27Apr Detroit Design Patterns Lecture pt. 2

This Thursday, April 30th, I will be continuing my lecture on Actionscript design patterns and principles at the Detroit Adobe User’s Group meetup. See the first lecture post here for directions and time information. This week I will be covering different mainstream design patterns in detail and if we have time give a brief overview of popular MVC frameworks that help accelerate application development. However, I do believe that teaching patterns and frameworks without knowing good object oriented principles is fruitless so I will also continue this topic discussion into the next portion of the lecture.

The conference is free to attend, and anyone from beginners to experts are welcome to join!