First Trys with XNA

Oh, this post was forgotten ! I begun to write it at the beginning of the year 🙂

Ok, you might want to know what XNA is ? That’s the framework Microsoft released last week for indie game developper, to create game, easily, quickly, both on Xbox 360 and pc. You can get some more info here.

I’m just gonna give some feelings about XNA, then, in next posts, i’ll talk about what i’m working on (yep, the next next generation universal game, who will bring peace on earth).

Pros
– Integration into VC# Express, it’s really great, its as much integrated as the .net framework, xna guys made a great job on this part.
– The power of C#, both on PC and Xbox 360 (no more memory management !!)
– All the code you write is almost the same on both platform.
– Great Framework, taking care of all annoying things (windows management, content pipeline)

Cons
– No Real Integration with VS complete (miss the Content Pipeline on full editions)
– Almost only C# (not a problem for me anyway)
– Requires a subscription to Xbox Live Gold, and another one to Creators Club to run your stuff on Xbox
– No network on Xbox for the moment. (Xbox Compact Framework is still incomplete, and a few bugs remains)
– That’s all 🙂

eMule Vista Sidebar Gadget

Well, i was looking for a simple eMule gadget for the Windows Vista Sidebar, and found nothing. So, with the help of my good friend loulou ‘PaysPlat’, i made one 🙂

Here is how it looks : eMule Gadget in action eMule Gadget Offline eMule Gadget first contact

You can get it here. Click ‘Read More’ for configuration informations.

Continue reading ‘eMule Vista Sidebar Gadget’ »

Testing my new plugin :)

Well, i just installed this new plugin and i’m trying it right now.
It’s a simple formatting coloring plugin. The file is courtesy from Jamezila from his tutorial on post processing bloom/blur effects.

#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
#endregion

namespace XNAGame1
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        ContentManager content;

        Texture2D[] screenShot;
        Effect bloomatic;
        SpriteBatch sprite;

        RenderTarget2D rTarg;
        RenderTarget2D bloomTarg;

        int currentPic;
        double alphaFrame;
        GamePadState oldState;

        bool Additive;
        bool HiRange;


        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);
        }

        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
        }


        protected override void LoadGraphicsContent(bool loadAllContent)
        {
            if (loadAllContent)
            {
                // TODO: Load any ResourceManagementMode.Automatic content
            }

            sprite = new SpriteBatch(graphics.GraphicsDevice);

            rTarg = new RenderTarget2D(graphics.GraphicsDevice, 1024, 1024,
                0, SurfaceFormat.Color);
            bloomTarg = new RenderTarget2D(graphics.GraphicsDevice, 256, 256,
                0, SurfaceFormat.Color);

            screenShot = new Texture2D[8];
            for (int i = 0; i < screenShot.Length; i++)
            {
                screenShot[i] = content.Load(@"gfx/screen" +
                    (i + 1).ToString());
            }

            bloomatic = content.Load(@"fx/bloomatic");

            // TODO: Load any ResourceManagementMode.Manual content
        }


         protected override void UnloadGraphicsContent(bool unloadAllContent)
        {
            if (unloadAllContent == true)
            {
                content.Unload();
            }
        }

        protected override void Update(GameTime gameTime)
        {
            // Allows the default game to exit on Xbox 360 and Windows
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            if (GamePad.GetState(PlayerIndex.One).Buttons.A == ButtonState.Pressed
                && oldState.Buttons.A == ButtonState.Released)
                    currentPic = (currentPic + 1) % screenShot.Length;

            if (GamePad.GetState(PlayerIndex.One).Buttons.B == ButtonState.Pressed
                && oldState.Buttons.B == ButtonState.Released)
                    Additive = !Additive;
            if (GamePad.GetState(PlayerIndex.One).Buttons.Y == ButtonState.Pressed
                && oldState.Buttons.Y == ButtonState.Released)
                    HiRange = !HiRange;

            alphaFrame += (gameTime.ElapsedGameTime.TotalSeconds * 2.0);

            oldState = GamePad.GetState(PlayerIndex.One);
            // TODO: Add your update logic here

            base.Update(gameTime);
        }


        protected override void Draw(GameTime gameTime)
        {
            

            graphics.GraphicsDevice.SetRenderTarget(0, rTarg);
            graphics.GraphicsDevice.Clear(Color.Black);
            sprite.Begin();

            sprite.Draw(screenShot[currentPic], new Rectangle(0, 0, 800, 600),
                Color.White);

            sprite.End();
            graphics.GraphicsDevice.ResolveRenderTarget(0);

            graphics.GraphicsDevice.SetRenderTarget(0, bloomTarg);

            graphics.GraphicsDevice.Clear(Color.Black);

            bloomatic.Parameters["mag"].SetValue(0.008f);
            bloomatic.Parameters["alpha"].SetValue((float)(Math.Cos(alphaFrame) * 0.5 + 0.5));
            
            
            bloomatic.Parameters["hirange"].SetValue(HiRange);

            bloomatic.Begin();
            sprite.Begin(SpriteBlendMode.None, SpriteSortMode.Immediate,
                SaveStateMode.SaveState);

            EffectPass pass = bloomatic.CurrentTechnique.Passes[0];
            pass.Begin();

            sprite.Draw(rTarg.GetTexture(), new Rectangle(0, 0, 256, 256),
                new Rectangle(0, 0, 800, 600), Color.White);

            pass.End();
            sprite.End();
            bloomatic.End();

            graphics.GraphicsDevice.ResolveRenderTarget(0);

            graphics.GraphicsDevice.SetRenderTarget(0, null);

            sprite.Begin();
            sprite.Draw(rTarg.GetTexture(), new Rectangle(0, 0, 800, 600),
                new Rectangle(0, 0, 800, 600), Color.White);
            sprite.End();

            if (Additive)
            {
                sprite.Begin(SpriteBlendMode.Additive);
            }
            else
            {
                sprite.Begin(SpriteBlendMode.AlphaBlend);
            }
            sprite.Draw(bloomTarg.GetTexture(), new Rectangle(0, 0, 800, 600),
                Color.White);
            sprite.End();

            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
    }
}

And here is the shader he used. (Just for trying language marquers on a shader, and it looks like csharp marquer is the most appropriate)

// bloomatic.fx
sampler samplerState;

//Width to sample from
float mag;

//Alpha value
float alpha;

//Operate on a high range (0.5 - 1.0) or the full range (0.0 - 1.0)
bool hirange;

const float2 offsets[12] = {
-0.326212, -0.405805,
-0.840144, -0.073580,
-0.695914,  0.457137,
-0.203345,  0.620716,
0.962340, -0.194983,
0.473434, -0.480026,
0.519456,  0.767022,
0.185461, -0.893124,
0.507431,  0.064425,
0.896420,  0.412458,
-0.321940, -0.932615,
-0.791559, -0.597705,
};

struct PS_INPUT
{
float2 TexCoord : TEXCOORD0;
};

float4 bloomEffect(PS_INPUT Input) : COLOR0 {
float4 sum = tex2D(samplerState, Input.TexCoord);
float4 tex;

//accumulate the color values from 12 neighboring pixels
for(int i = 0; i < 12; i++){
tex = tex2D(samplerState, Input.TexCoord + mag * offsets[i]);

sum += tex;
}
//average the sum
sum /= 13;

//fix alpha
sum.a = alpha;

//expand the higher range if applicable
if (hirange) {
sum.r = (sum.r - 0.5) * 2.0;
sum.g = (sum.g - 0.5) * 2.0;
sum.b = (sum.b - 0.5) * 2.0;
}

return sum;
}

technique Bloom {
pass P0{
PixelShader = compile ps_2_0 bloomEffect();
}

}

Dobacaracol

Yep, in english this time 🙂

I’m pretty sure you know this feeling, when you know you’ve missed something. Something great. I heard this morning, going to work, a song i already heard a few time. Still unknown to my musical culture, i remembered lyrics, to check on google. I now got the artist’s name, song’s name, that was Etrange by Dobacaracol (I know, their website is just awful).

So as i knew it was an canadian band, i tought, maybe they’ll come in France. I wouldn’t think that again, they were 2 weeks ago like 100km from home. Twice….

Right now, juste the videoclip of the song i heard.

Few months ago, i missed the concert of Les Cowboys Fringants, just because i tought it wasn’t so good, just because it was 300km away. I thought I wouldn’t miss no more little concert. Missed again. (And a video again)

Les Tit’Nassels

Yops, a post in french 😉

J’ai recement été au concert des Tit’Nassels, un groupe roannais, qui merite vraiment le coup d’oreille. Je n’arrive pas a definir exactement dans quel style de musique on pourrait classifier ce qu’ils font. C’est a la fois melodieux, triste et drole fonction de la chanson, mais aussi extrement rêveur. Bref, c’est bon, mangez en. Je vous mets une petite video amateur, trouvée sur youtube.

No way, i said in english, i can do it in english. So, i was rencently at the concert of Les Tit’Nassels, a french band, which i think, need to be known. I can’t exactly define what kind of music it is, sounds like a mix of melodious french music, sounds sad and happy, depends what song you’re listening, but, mainly, it’s dreamy. It’s the kind of music which make me feels far far far away. Bref (how to say it in english ?), that’s good, listen. A tiny shakycam youtube video under.