More servicesWindows Live
HomeHotmailSpacesOneCare
 
MSN
Sign in
 
 
Spaces home  DeisPhotosProfileFriendsMore Tools Explore the Spaces community

Deis

Flex, Flash, Silverlight, .Net, Games, Computers!

Xbox Live GamerCard

Deis Valya
Xbox Live GamerCard
Rep:
Reputation:Reputation:Reputation:Reputation:Reputation:
Score:
1030
Zone:
Underground
The DarknessRock BandMass EffectOblivionGuitar Hero III
Dread Rock
Teardrop
Slam
by 
Comfort Eagle
by 
by 
by 
by 
by 
More...
May 16

Pixel Bender - Spotlight Shader

Toyed around with it a bit today, I really love being able to run things on the GPU now. Here is a simple spotlight shader.

<languageVersion: 1.0;>
 
kernel lighting
<   namespace : "mg";
    vendor : "Matt Greene";
    version : 1;
    description : "Simple spotlight shader."; >
{
    input image4 src;
    output float4 dst;
    
    parameter float lightIntensity
    <
        minValue: float(1.0);
        maxValue: float(4.0);
        defaultValue: float(2.0);
    >;
    parameter float2 lightPosition
    <
        minValue: float2(0.0, 0.0);
        maxValue: float2(350.0, 550.0);
        defaultValue: float2(0.0, 0.0);
    >;
    parameter float lightRadius
    <
        minValue: float(0.1);
        maxValue: float(2000.0);
        defaultValue: float(200.0);
    >;
    parameter float lightSize
    <
        minValue: float(0.1);
        maxValue: float(100.0);
        defaultValue: float(5.0);
    >;
    parameter float4 lightColor
    <
        minValue: float4(0.1, 0.1, 0.1, 0.1);
        maxValue: float4(2.0, 2.0, 2.0, 2.0);
        defaultValue: float4(1.0, 1.0, 1.0, 1.0);
    >;
 
    void evaluatePixel()
    {
        float2 position = outCoord();
        float dist = length(position - lightPosition);
        float shadePercent;
        
        if (dist < lightSize)
        {
            shadePercent = lightIntensity;
        }
        else
        {
            shadePercent = lightIntensity - ((dist - lightSize) / lightRadius);
        }
        
        float4 shade = lightColor * shadePercent;
        shade.a = 1.0;
        
        dst = shade * sampleNearest(src, position);
    }
}
 

Adobe Pixel Bender (previously Hydra)

Hardware accelerated Flash is finally here! Adobe released the beta of Flash Player 10 recently, and with it came the Pixel Bender (formerly codename Hydra) toolkit. This application allows you to build shaders that run on your computer's GPU (with fallbacks to the CPU incase your card is not supported). The language used is quite similar to GLSL, and basically gives you full access to a pixel shader, sorry no Vertex/Geometry shaders... yet? But, that is not much of an issue, because having access to the pixel shader alleviates a massive amount of processing off of the CPU.

If you can't tell from my first paragraph, I am extremely excited about this. I plan to put out some samples of some fun shaders here soon, maybe this weekend!

April 09

Flash, Distribution, Wooohaaa!

Yesterday about 5:00 PM EST I decided to check out how the little flash game my team made was doing online. I was pleasantly surprised to see that it had finally hit the distribution channels. I saw 50 new plays and thought, awesome! Then I refreshed the page about a minute later and saw it went up by about 15, and thought "woah were on a hot streak"... then refreshed it again a few minutes later and it shot up another 20. My first thought was, "is this really happening?" And it was, our game finally was being distributed to partners. From 5 PM EST to midnight we raked in about 2400 unique plays. And today we already have another 600 from this morning alone. This is all quite encouraging to see that our work has gotten such visibility. We spent about a week in a rush job trying to make the game and enter it into a contest. Now, our next games will have more time and more insight into the process, the possibilities are limitless! World domination plans! *snicker*

Anyway, if you want to check out our game, head on over to http://www.devend.com/buggleBubbles/

April 07

Failure of Modern MMO's

Ok, here is the big secret ladies and gentlemen, this is how you interest and keep an active player base. REWARD YOUR PLAYERS CONSTANTLY!

There is a plethora of ways to reward your players, many of which really have no consequence or effect to the game whatsoever. A good example of a better rewards system is in Lord of the Rings Online. There is a constantly evolving Title rewards system in place. I love this aspect, it helps so much to alleviate the "grind" you experience in EVERY MMO that is out there.

Here is one of my favored moments in MMO gaming, I am invading a base of monsters, killing them left and right, simultaneous achieving a quest to slaughter X number of monsters, another quest to kill their leader, and also I am gaining points towards my title of "MonsterType" Slayer.

If I am playing a game, I want to feel like I am accomplishing multiple things by doing something. When I finish a quest and realize I inadvertently accomplished something else, I am ecstatic, I love the feeling!

Reward your players, in every way shape and form possible. You may think this will numb the players to the final rewards or the rewards that take more time to access... THEN MAKE THEM EVEN BIGGER REWARDS!

It is a trend that is finally starting to see some light. On XBox360 it is huge, in the form of achievements, which have no effect on the game itself but are rewarding to the player to unlock!

February 21

What has been up!

Aside from a big Flex project at work, that I will reveal once it goes live, I have been working on a new Game Library for ActionScript 3 and also playing a good bit of Titan Quest again.

The Game Library is currently nicknamed NoxLib and is coming along very nicely. I am steadily building in new features every few days or so and I am very happy with the results so far. I am taking a much more C# Game Engine style approach to it instead of your typical Flash/ActionScript kind of groove. I find it to more efficient and organized. One of my favorite tools in the lib so far is the ContentLoader, which manages all the loading of any data you need to include in your project, such as images, audio, and XML files. It is a queue based loader that is very simple to use and alleviates a lot of the pain of working with external assets. A lot of the components of the lib are tied in with the ContentLoader for a much easier experience of loading and utilization. I am sure I will post more about the library soon when I have more eye candy.

I originally played Titan Quest back when it released and was initially enthralled by it. I was really needing a good hack'n'slash RPG Diablo style and it filled the need quite nicely. That is until I got deeper into the game and realized how broken and overpowered the classes and abilities were. The game became little to no fun and really had no challenge to it at all. Well recently I have really been into using Steam and keeping my eye out for deals, and low and behold there was Titan Quest + Immortal Throne (the expansion) for only 20 bucks as the gold pack. I heard that the expansion and all the patches in between had fixed a lot of the issues and balanced out the classes so they are not so godly. So, I decided to give it another go. And thanks to Steam's tracking I realized I have spent over 15 hours so far in Titan Quest since I bought it, and I am still having a lot of fun. Which seems like a pretty dam good deal to me if you compare it to watching a movie at a theatre or even renting. I spent 20 bucks and got at minimum 15+ hours of enjoyment out of it, and I am still going. I love the historical areas that Titan Quest visits in the game, you go from Greece to China and all the lands in between and beyond. It is now a much more polished game if you ask me.

February 20

ActionScript 3 Game Programming Tips

1. Use "Number" type when doing math calculations, other types are slower.

2. Use "int" type when you are working with array indexes. A "uint" has problems with indexOf(). And a "Number" is much slower for iteration than an "int"

3. When storing a list of objects, instead of an "Array", use a "Dictionary" for strict equality and faster comparisons. (Note: Use wisely, in some circumstances an Array can outperform such as simple iteration, but a Dictionary gains in speed when accessing data stored inside of it.)

4. Use events programming (use weak references whenever possible), interfaces, and locators with error logging. Bubbling events can save you a ton of time, make use of it.

5. Keep in mind these three words... Modularity, Reusability, Robustness.

6. When using for() loops in Actionscript and iterating through to the length of the array, declare the length first outside of the loop and use it instead to set the max. Your iteration will perform nearly twice as fast.

var len:int = someArray.length;
for (var i:int = 0; i < len; i++)
{
    ...
}

7. Do not do lookups inside loops if you can avoid it, even for simple things like constants. Declare it as a local variable before your loop and use it. Lookups really slow down loops!

8. If you have to declare similar variable types inside of loops, declare them with a single "var" statement, it will save tons of execution time inside of loops.

// BAD
for (var i:int = 0; i < 100; i++)
{
    var v1:Number = 10;
    var v2:Number = 10;
    var v2:Number = 10;
}
 
// GOOD
for (var i:int = 0; i < 100; i++)
{
    var v1:Number = 10, v2:Number = 10, v2:Number = 10;
}

 

These are just a few things that I have ran across while traveling the web and working with my own code. This biggest thing is the loops, because most games use loops quite frequently this is very important. Following these guidelines, you can see a massive performance boost.

February 13

The AdvancedHBox Flex Component

This is something I created recently, thought I would share it since it has really become quite useful all around. I kept running into the issue that a simple HorizontalList just was not cutting it, there were limitations all around. So I came up with the AdvancedHBox instead. This components provides some better styling options and management of the component, along with allowing variable widths of items in the dataProvider. There are some other uses too that are quite nice. To explain it simply, it is an HBox with a dataProvider and an itemRenderer attached!

package
{
    import flash.display.DisplayObject;
    import mx.collections.ICollectionView;
    import mx.containers.HBox;
    import mx.controls.Label;
    import mx.core.ClassFactory;
    import mx.core.IFactory;
    import mx.events.CollectionEvent;
    
    public class AdvancedHBox extends HBox
    {
        private var _dataProvider:Object;
        public var itemRenderer:IFactory;
        
        public function AdvancedHBox()
        {
            if (itemRenderer == null) itemRenderer = new ClassFactory(Label);
        }
        
        [Bindable("collectionChange")]
        public function get dataProvider():Object
        {
            return _dataProvider;
        }
        
        public function set dataProvider(value:Object):void
        {
            if (!(value is Array || value is XMLList || value is ICollectionView))
            {
                _dataProvider = null;
                
                return;
            }        
            
            if (_dataProvider && _dataProvider is ICollectionView)
            {
                ICollectionView(_dataProvider).removeEventListener(CollectionEvent.COLLECTION_CHANGE, dataProviderChangeHandler);
            }
            
            _dataProvider = value;
 
            if (_dataProvider is ICollectionView)
            {
                ICollectionView(_dataProvider).addEventListener(CollectionEvent.COLLECTION_CHANGE, dataProviderChangeHandler, false, 0, true);
            }
            
            redrawChildren();
        } 
    
 
        // PRIVATE METHODS
        /**
         * Redraws children.
         */
        private function redrawChildren():void
        {
            removeAllChildren();
                
            if (dataProvider != null)
            {
                var child:Object;
                    
                for (var i:int = 0; i < dataProvider.length; i++)
                {
                    child = itemRenderer.newInstance();
                    child.data = dataProvider[i];
                    
                    if (child is Label) 
                    {
                        child.text = child.data.label;
                    }
    
                addChild(child as DisplayObject);
            }
                
                trace("[AdvancedHBox] dataProvider Update - Length: " + dataProvider.length);
            }
        }
        
        // EVENT HANDLERS
        /**
         * Redraws children on dataProvider change.