Archive for April, 2007

Tuesday, April 24th, 2007

If you are not familiar with the Gang of Four (GoF) patterns, there are many books and sites on the subject. These patterns are a set of logical designs that have been successful and provide a bit of arichtectural building blocks when considering the design of a framework or class library in .NET, Java, etc.  They are largely influenced by OO and Java especially. Although these patterns you can see in many frameworks of today.  These allow a communication of design so that understanding can be embedded into certain modules of a system.

Here is the list of (GoF site):

Creational Patterns
  Abstract Factory   Creates an instance of several families of classes
  Builder   Separates object construction from its representation
  Factory Method   Creates an instance of several derived classes
  Prototype   A fully initialized instance to be copied or cloned
  Singleton   A class of which only a single instance can exist
  Structural Patterns
  Adapter   Match interfaces of different classes
  Bridge   Separates an object’s interface from its implementation
  Composite   A tree structure of simple and composite objects
  Decorator   Add responsibilities to objects dynamically
  Facade   A single class that represents an entire subsystem
  Flyweight   A fine-grained instance used for efficient sharing
  Proxy   An object representing another object
  Behavioral Patterns
  Chain of Resp.   A way of passing a request between a chain of objects
  Command   Encapsulate a command request as an object
  Interpreter   A way to include language elements in a program
  Iterator   Sequentially access the elements of a collection
  Mediator   Defines simplified communication between classes
  Memento   Capture and restore an object’s internal state
  Observer   A way of notifying change to a number of classes
  State   Alter an object’s behavior when its state changes
  Strategy   Encapsulates an algorithm inside a class
  Template Method   Defer the exact steps of an algorithm to a subclass
  Visitor   Defines a new operation to a class without change

We will be writing samples of each pattern and real world usage.  In actuality patterns are great and will make you understand programming architecture.  However patters at times can be overkill and more deep than necessary and possibly cutting off junior level understanding.  The dofactory rates patterns and their frequency of usage or usability. I think that patterns are very important but also a low entry point into code libraries is very important.  Simple interfaces to the logical blocks like patterns is common in frameworks like the .NET framework or Java runtime.

Saturday, April 21st, 2007

{ draw logic } will be presenting HOWTOs every once in a while based on current projects or very simple, targeted actions in game development, programming, data design etc. 

Setup an Orthographic Camera in 3dsMax9

Axonometric Projection allows you to make flat Isometric game assets or views sometimes needed for maps layouts where false or flat 3D is used so you can see the items up close as well as you can see the items off in the distance. This view was common in the early sim citygames and many RPGs like Command and Conquer Red Alert (oh no not the blimps!). Photo Sharing and Video Hosting at Photobucket

Orthographic views are a camera setting that makes it so there is no vanishing point or correct perspective but instead parallel external lines. Sometimes this is key in scrolling 2d games or maps like I said but its also to help reuse assets over and over to create a better cache to pull from.  Orthographic viewscan also make flattening textures to be used in texturing in isometric games very simple.

To setup a camera in 3d Studio Max for orthographic renders follow these steps:

  1. Open up your file and get a perspective you want. Usually this is a diagonal 45 degree view or a 45 degree angle where 2/3 of one side shows and 1/3 of the other showsPhoto Sharing and Video Hosting at Photobucket
  2. Go to the perspective view and click in it. 
  3. Create a new camera by clicking CTRL+C. This will create a new ‘Camera01‘.
  4. Click C to jump into your new camera.
    Photo Sharing and Video Hosting at Photobucket
  5. As you can see this view has the perspective vanishing point and the lines on the outside of the model will eventually meet on the horizon.  For game assets this doesn’t always work when making an isometric or axonometric view.We want to make it an orthographic view so that there is a void of perspective and correct vanishing lines.
  6. To flatten this true perspective make sure the camera is still selected by clicking on the camera or by pressing ‘C’ (brings up all cameras as ‘P’ does the perspective view again) or selecting it from the object list.
  7.  Then under the modifiers tabs check the “Orthographic Projection” checkmark.Photo Sharing and Video Hosting at Photobucket 
  8. All done, now make a boatload more assets for your game/project!

See the difference in renders here:

True Perspective View:
Photo Sharing and Video Hosting at Photobucket

Orthographic View:
Photo Sharing and Video Hosting at Photobucket 

You can see that if the homes were to be stacked in rows where their walls are parallel (like the command and conquer screenshot above) the orthographic view is more suited for games or maps where you need to see all items the same size or scale. Click here to see a flash version of this that stretched full screen fluid flash.

Photo Sharing and Video Hosting at Photobucket

Here’s the MAX file source of the house. I used 3dsmax9 and built on a model I found online making it more cartoonish and simplistic/vector-like. For this tutorial some of the settings may be changed in your version but all 3d programs have this setting somewhere even if you are not using 3dsmax. 

Thursday, April 19th, 2007

Photo Sharing and Video Hosting at PhotobucketWell it is ”pageturn” week here at { drawlogic } but this is worthy.  Its the first papervision pageturn zero point nine is now famous.

source code

I have a feeling papervision3D is responsible for a surge in new blogs.  It is an exciting technology but our processors are probably not too happy about all the extra work. 

Thursday, April 19th, 2007

Excellent isometric flash game test

Photo Sharing and Video Hosting at Photobucket

Wednesday, April 18th, 2007

Photo Sharing and Video Hosting at Photobucket

Here is a very cool MoCap (Motion Capture) rendering in flash with AS3. 

ByteArray has more info on this and more demos.

Wednesday, April 18th, 2007

Hardware 3D rendering…

One thing that might be interesting in the heating up battle of Flash vs Silverlight is rendering.  Will Silverlight down the road provide hardware rendering support for 3d in Silverlight?  If so Microsoft will have a compelling offering.  Would Microsoft really want this with strong 3d capabilities built into a browser (goes against their console offerings, or maybe not in the end).

Photo Sharing and Video Hosting at PhotobucketWith 3d in the browser on two competing platforms that use hardware rendering we can make Raycasted donuts (yummy) oh and there could be a massive surge in the online 3d gaming market (especially the indie market).

It is up for grabs 

But the problem is that Silverlight will also need to support OpenGL for other platforms (that do not run DirectX).  If Adobe wants to win this maybe OpenGL 3d integration into flash will make it more cross platform.  I know the developers on the papervision3d lists are all looking forward to better than software rendering in flash.

Who’s Directing Director? 

But then this leads to another question, where does Director fit in all this, is it even part of the plan? Will Director and Flash merge to support this? Then what happens to the saturation of Flash in the market when it has more third party issues like Director? (and possibly less adoption director usually gets up to 50% to 60% saturation) 

What exactly happened to Director in the plans?

Director is still the de facto standard in 3d web games, more on this soon.  Director has been noticeably absent from all versions of Creative Suite (they are up to CS3 now without it).  Buzz about it was happening in 2004-2005 but last anyone heard is it is still planned for released. The one problem with the Director development environment and community is that the IDE is clunky, the libraries and script (Lingo) is not as advanced as AS3 (the addition of Javascript to the capabilities was great but much of the community was Lingo) and the community is a ghost town (loads of broken links and pay xtras, its stuck in 2003-4).  It was a great market before that, I think Adobe is letting it slip further and further away.  If they wait too long Microsoft might add hardware rendering to Silverlight and then game over in owning 3d gaming on the web. 

“Halleys Comet”

Here is a posting to macromedia.director.3d from Ritesh Banglani, Product Manager for Director and Shockwave. It was in response to a joke about him coming and going from the forum like Halley’s Comet…

Still here, guys. I cannot give an exact release date for the next version, but it will likely be towards the end of the year rather than the middle. The Shockwave Vista release (with DirectX 7) will be out sooner – in 6 weeks or so.

We will NOT upgrade the 3D feature set in the forthcoming Director release. Requirements like new platform support, performance and text engine enhancements are very urgent, and we don’t want to delay this release beyond 2007. However, we are committed to maintaining Shockwave as the leading 3D format on the web, and you WILL see 3D enhancements in a subsequent release. The move to DirectX 9 is a signal of our long term commitment to Shockwave 3D.

I know this is not the answer many of you are looking for. I appreciate your patience, and hope to keep the channels of communications open!

Currently this is the status of hardware supported 3d in WPF/E Silverlight. 

WPF fully supports hardware rendering but Silverlight (cross browser) does not.

What features are missing from Silverlight presentation markup that will be supported in WPF?

Some high-end, Windows-specific features of WPF, such as real 3D, hardware-based video acceleration, and full document support, will not be supported in Silverlight. This is done on purpose in order to serve the Silverlight cross-browser, cross-platform reach requirements that demand a light-weight plug-in. However, Silverlight will offer a uniform runtime that can render identical experiences across browsers on both Macintosh computers and on Windows-based computers.

Wednesday, April 18th, 2007

Photo Sharing and Video Hosting at PhotobucketHere’s the first pageturn in silverlight.  It runs pretty smooth. 

Wednesday, April 18th, 2007

Photo Sharing and Video Hosting at PhotobucketBubblemark has posted a 3d version of the bubble test in WPF/E which will just be called Silverlight now, that compares the new vector render engines Flash9/Flex, Silverlight and DHTML/Javascript.    

Note: I think my processor just melted after this test. 

Bubblemark has been kind to share the source.

Download source code


Personally the names WPF and WPF/E and now Silverlight really didn’t make sense but  Alexey Gavrilov puts a spin on it.  Personally, the Blend, Expression, Slilverlight, WinFX, WPF, WPF/E, Live marketing is a total blitz but I just don’t know that its working much. Here is Tim Sneath’s take on the naming (he works on the project).

I like the technology though but sticking with only Windows Video (which does conform to a standard VC-1 that allows video to be played on mobile, directx and xbox but in a windows only world yes but) after FLV has really taken over it might be tough.  

One thing is for sure the competition between Adobe and Microsoft on these vector tools and development environments will benefit the solution providers and developers who can learn both.  DEVELOPERS! DEVELOPERS!

Wednesday, April 18th, 2007

Photo Sharing and Video Hosting at PhotobucketBumpMapping in Flash has been a possibility since Flash 8/AS2 but libraries are showing up in AS3 now.

Here is a collection of the best samples and authors of that code.  ByteArray AS3 BumpMapping and Ralph Hauwert 3D BumpMap + sources.

BumpMapping shows off the power of per pixel operations and how beneficial the addition of per pixel work is when it was added to Flash 8 with the graphics libraries and filters.

BumpMapping is great for simulating 3d depth in textures and can only be used minimally right now in flash due to the per pixel nature of the operation.   It seems more work in this area is maxing out at 256×256 textures/maps.

Photo Sharing and Video Hosting at PhotobucketFor a quick benchmark you can see that ByteArray’s AS2 BumpMap sample is much much slower than the AS3 version.  Its a small glimpse into the optimizations and reasons for graphics that AS3 is simply the best choice now. UnitZero’s BumpMap for AS2 is much faster but the comparison of ByteArray’s experiment is a better comparison since its using the same algorithm ported to AS3.

Wednesday, April 18th, 2007

Photo Sharing and Video Hosting at PhotobucketByteArray has been developing the Raster class which has an impressive demo of a raster engine to draw rather than the Adobe Graphics library included with Flash and it is much faster albeit pixelated (the nature of raster).

Here’s his latest listing of what it supports:

V1.3 API :

This class use
rastering : Bresenham algorithm
anti-alias rendering : Xiaolin Wu algorithm

Authors (contribution) :
Didier Brun (original class)
Drew Cummins (bezier curves)

Photo Sharing and Video Hosting at PhotobucketAlso check out a demo on the generalrelativity blog with some added beziers.