FAIL (the browser should render some flash content, not this).

Search the site

FAIL (the browser should render some flash content, not this).

Main Menu

FAIL (the browser should render some flash content, not this).

Who's Online

We have 11 guests online
FAIL (the browser should render some flash content, not this).

Statistics

Content View Hits : 54226
FAIL (the browser should render some flash content, not this).

Polls

What should we write next
 
FAIL (the browser should render some flash content, not this).

Log in



Welcome to MStar Games!
Who dares awake me from my slumber?! PDF Print E-mail
General posting
Written by DrMistry   
Tuesday, 22 November 2011 19:33

Well...hello there!  Long time no see!  How you been?  How did that thing work out for you?  Ah that's great.  Me?  Yea I been pretty busy.  Got a minute?  I'll tell you all about it...

The astute among you will know that I was getting very disillusioned with the XBLIG scene, for many and complex reasons.  About 4 months ago I decided that to preserve my sanity and bank balance, I'd get a "proper" job somewhere - which I have.  I've been working for the excellent Red Ant for three months now, bashing websites together in c# and generally being reminded how to interact with other peeps on a professional level.  But just as the insects are known unto the Lord by their doings, I am bound by fate and temperament to return to the unfinished business of Space Pirates.  Shortly before my "settling in to my new job" hiatus, I posted a few images of my creps shader and some planet textures I'd been working on.  Well, over the weekend I picked up the code again and made the move to perlin noise generators, some more advanced and realistic plantery simulation, and tweaking the sun shader.  I've said before that this is absolutely my favorite bit of development - the ideas are flying out of my fingers, the code comes easy and the possibilities stretch out forever.  I'm looking to hook up with a few other devs and some designers on this project (this will be by invitiation only by the way), and I find this a pretty exciting prospect. 

Anyway, I don't really have any screenies today, but I will over the next week or so as I nail the colour pallettes for the planets, generate some background stars and begin thinking about features, other devs, design styles and so on.  I'll be sure to keep any interested parties up to date, along with my usual brand of shiffle and pim about the indie dev scene in general.  I also suspect that the site here will be reskinned very shortly...DrMistry still loves you all!

 
Here, have a free chunk of galaxy to play with... PDF Print E-mail
Space Pirates From Tomorrow Blogs
Written by DrMistry   
Friday, 19 August 2011 12:01

Ooh oui la la, hows about this then eh?  I spent a few hours last night working over the original xbox build of Space Pirates, just for old times sake you understand, and fixed a few things so that it runs nicely on Windows.  I've decided to make this available for folk to play, partly because I'm a nice guy but also because I want opinions from peeps.  The link will be at the bottom of the post but PLEASE read what I've written below before downloading and installing.

Firstly, in order to play the game, you MUST have a WIRED XBOX 360 CONTROLLER attached to your PC.  Secondly, your machine MUST support 1080i resolution (that's 1920 by 1080 if memory serves).  Thirdly, you MUST understand that this is a beta build and as such it may well crash.  Since it's managed code it shouldn't trash your machine, but I CAN NOT PROMISE YOUR MACHINE WILL NOT BE ALTERED FOR THE WORSE IF YOU CHOOSE TO INSTALL AND RUN THE GAME.  If you DO download and install the game, you are entirely responsible for anything that happens to you or your machine. 

The faster your machine, and the better your graphics card, the better the game will run.  So far I've run it on a Core i3 machine with 4gb or RAM and a $50 ATI PCI-E card with no problems but I haven't tested it on my laptop yet.  If you download the game and it a) won't install or b) doesn't run or c) runs poorly or crashes then PLEASE let me know either here or on twitter (@DrMistry) or use the link to our Facebook page (to the left there).  If there are any tweaks you think would make it a better game, let me know.  That's exactly the kind of thing I want to know about!

So finally the, after all that, here is the Windows version of the game that took 2 years to write.  It takes a little getting used to, but I got lost for 2 hours flying around and fighting and trading and in fact, it's a better game than I remember.  It seems to run better on Windows than on xbox (go figure...) and I hope there are more PC types who like it than there were XBLIG fans!  Have a lovely time with it, and I hope it whets your appetite for the all-new game which I'm starting to work pretty seriously on.  DrMistry Loves You All!

 
Crepuscular rays in XNA (God Rays) PDF Print E-mail
General posting
Written by DrMistry   
Tuesday, 16 August 2011 15:28

Right now then, I don't normally share code, but it's my wedding anniversary today and I'm feeling happy and generous and I've just finished prototyping the shader which achives this oft-hunted effect.  Crepuscular rays are those lovely plays of light you see busting through tree-lined lanes on a sunny day, with great "volumes" being illuminated.  Lots of folk have asked for help with this effect all over the web, but once you get to thinking like a pixel shader it's not too hard to get it going on.  The rough basis of the code is from GPU Gems 3 and I'd advise anyone serious about getting in to shaders to get familiar with all of the GPU Gems series.  Chances are the effect your after has been worked on at some point!  I wanted a chader for this effect so I could have sun rays in interesting, non-static, evolving patterns.  Here's where I'm at right now:

starshader

See the way that the rays emerge from the bright spots, particularly in the lower-right area of the sun.  That's exactly what I'm talking about.  The whole process takes 4 passes, which I'll now describe quickly.  There are plenty of other applications for the shader which don't need the first 3 parts of the process - indeed you can apply the shader to any Texture2D you like.  Try to hold back from over-using the technique though, there's no gain in guilding the lilly :)

Firstly, when the program creates  a star it also makes 2 textures, both based on a 3D perlin noise routine.  Using spherical co-ordinates we take a "globe" of perlin noise - one for the normal surface texture of the sun.  This looks kind of like a lavafield, and is pretty much just white-yellow-red noise.  Since it's been sampled using spherical coords we don't even have to worry about wrapping because that's inherant in the geometry used to generate the texture.  Nice!  The second texture is a "turbulance map", again a perlin sphere which is used to create a rolling and boiling effect over the surface of the star.  The idea for this comes from here if you're interested in a more in-depth explaination of the what and why.  Suffice to say, once we have our 2 textures we can start messing around with them.  I use the turbulance map pretty much as suggested in the link, rotating 2 spheres slightly differently and combining the resulatant image, only drawing bright pixels to the screen, thus:

nonrayedstar
Now first impressions may be "wow, that's way too dark to be a star!" but hold on to your pants because this is going to get lightblasted by the creps shader.  The main surface map is as it was generated by the perlin routine, and the turbulance layer is the result of rendering 2 same-sized spheres with the same texture, rotated by different amounts, and then passed through a "compressing" pixel shader which only draws pixels which are pretty bright.  OK, so far so dull.  But now we have this image in a rendertarget (and thus a texture2d) we can run this through the creps shader, specifying the screen-space co-ordinates of the center of the star.  This is important for the shader, and the co-ordinates MUST be within the range of 0..1 and is achieved thusly:

screenPos = new Vector2(graphics.GraphicsDevice.Viewport.Project(Vector3.Zero, Projection, View, albedoWorld).X, graphics.GraphicsDevice.Viewport.Project(Vector3.Zero, Projection, View, albedoWorld).Y);
screenPos.X /= (graphics.GraphicsDevice.PresentationParameters.BackBufferWidth);
screenPos.Y /= (graphics.GraphicsDevice.PresentationParameters.BackBufferHeight);
crepsEffect.Parameters["ScreenLightPos"].SetValue(screenPos);

The star is always positioned at Vector3.Zero in my universe, but it works for any Vector3 you care to use, provided it's on the screen when projected in to screen space.

But what exactly does the creps shader do?  It's pretty simple.  For each pixel, we take a series of samples along a ray cast from the current pixel to the screen position of the light source.  We then smear those samples outward along the ray, including a decay coefficient so that we're not just blinded by infinite-length shafts of simulated sunlight.  It's really that simple.  Here's the code for the shader:

float4x4 MatrixTransform : register(vs, c0);
float2 ScreenLightPos;
int numSamples;
float Density;
float Weight;
float Decay;
sampler DryImage : register(s0)
{
    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;  
    AddressU  = Wrap;
    AddressV  = Wrap;
};

void SpriteVertexShader(inout float4 color    : COLOR0, 
inout float2 texCoord : TEXCOORD0, 
inout float4 position : SV_Position) 

    position = mul(position, MatrixTransform); 
}

float4 PixelShaderFunction(float2 texCoord : TEXCOORD0) : COLOR0
{
    float2 deltaTexCoord = (texCoord - ScreenLightPos.xy);
    deltaTexCoord *= 1.0f / numSamples * Density;
    float4 color = tex2D(DryImage, texCoord);
    float illuminationDecay = 1.0f
    for (int i = 0; i < numSamples; i++)
   {
       texCoord -= deltaTexCoord;
       float4 sample = tex2D(DryImage, texCoord);
       sample *= illuminationDecay * Weight;
       color += sample;
       illuminationDecay *= Decay;
   }
return color;
}

technique Technique1
{
    pass Pass1
    {
 
      VertexShader = compile vs_3_0 SpriteVertexShader();
       PixelShader = compile ps_3_0 PixelShaderFunction();
    }
}

Right now I'm drawing with SpriteBatch, so my draw line provides the "dry" (unprocessed) texture with no need to set parameters.  The numSamples, Weight, Decay and Density variables are set at create-time, when the 2 texture maps are created.  Sometimes these parameters need some experimentation to get the exact desired result, and you can achieve a broad range of effects - from sun rays to a kind of visual feedback which has hundreds of uses.  You know that bit at the end of Raiders Of The Lost Arc where the nazis melt and start spewing light?  Kind of like that.  Nicey. Anything that involves melting nazis is something I'm going to be in favor of ;0)

So, after the creps shader has chewed over the boring, dim, dark star we get something very much like this:

rayedstar

The artifacts in the rays are the result of a low sample frequency (50 per ray).  Tweaking all the parameters leads to a wide range of effects.

The MatrixTransform parameter is just used to handle the requirement to have a vertex shader which is forced in shader model 3 under XNA4.  Google it if you need more info.  So there we are - very very few lines of code to generate an effect which is attractive, computationally cheap and very flexible.  I expect I'll also be using it for things like photon torpedos, large explosions, hyperspace transits and all manner of lovely things.  I think this is a great example of how "thinking like a shader" pays dividends - it's not massively complex once you realise that you need a function which works on a pixel-by-pixel basis.  The only pain in the butt is that it provides a Texture2D which obviously is devoid of depth data, but we all know there are ways around that.  Right now I'm depth-testing planets and moons against the star position and drawing things in depth order (furthest away first) and this is a cheap and simple way to do it for the purposes of prototyping.  So there we are, my first shared shader.  Hope you like it, and if you have any questions, just get in tough on Twitter, Facebook or here.  Chin chin, and happy aniversary to me and MrsMistry :0)

 
A peek in to whatever it will have becoming PDF Print E-mail
Space Pirates From Tomorrow Blogs
Written by DrMistry   
Thursday, 04 August 2011 11:14

A frantic week of code-smashing, and I couldn't resist working up some initial planet code for Space Pirates PC.  There are three elements I've been working on - the terrain generation routine for rocky planets, a Rayleigh/Mie scattering shader for atmospheres and a cloud system.  None of the three are quite perfect just yet but I thought I'd just do a sneaky beaky peaky of how it's looking so far:

The circles you can see on the planet surfaces are acually proceduarally generated impact craters, but the colour mapping needs some tweaks.  The white dots are cloud "cells" from the cellular automata engine (which has significant conceptual problems right now) and you should also be able to see the effect of the atmos shader.  I'm kind of about to run off and help a pal set up some lighting for a poker tourney this weekend but I'll flesh out the details for anyone interested over the weekend or early next week.  I'm happy with most of this as test code, but it's a long way short of production quality!  I'll be doing some more work on YoYoYo next week too.  Just thought I'd check in and let you good folk know I'm still alive and still pounding the keyboard!  Chin chin!

Last Updated on Thursday, 04 August 2011 11:15
 
So, farewell then... PDF Print E-mail
XBLIG channel thoughts
Written by DrMistry   
Wednesday, 20 July 2011 13:38

With my usual overblown sense of self-importance, I have a small annoucement to make.  I've been away for a bit again (partly holidays, partly illness, and partly a weird kind of inertia and dispair) and I've come to one important decision. I'm absolutely NOT stopping writing games, but I am now leaving the XBLIG arena.  Previous visitors will know my longer-term opinion of how XBLIG has been managed but I now feel that the channel is irredeemably compromised, particularly in the light of the sales levels seen by Breath of Death and Cthulhu Saves the World in their PC incarnations - and my hearty congratulations to Zeboyd for the thoroughly deserved win.  This isn't just a case of following the money (although that has certainly helped inform my decision), but rather after almost 2 months of thought, research, keeping a loose eye on the forums and sales figures and seeing the same old problems going round and round and round I can no longer see any artistic, commercial or reputational advantage to selling games on XBLIG.

Again I'm not going to bang on about Microsoft's management, the quality or quantity of titles or the attitudes of other members of the XBLIG community.  I've had a couple of famous falling-outs with some other indie devs but the matters on which we disagree is not part of my decision. 

So, where does that leave the 2 titles I've been sitting on for the last few months?  Well, YoYoYo has NO Xbox-specific code so I'm going to restart work on it for Windows.  I had also been working on an Avatar-based "simple simon" type game but that project is now dead, since Avatars are only available on the Xbox platform and I have no interest in creating a PC version since it was mainly designed to try and capitalise on the teen demographic of the channel.  But none of this is really what I wanted to tell everyone today.  Deep breath time!

I'll keep this brief:  When YoYoYo is finished, I will be starting full-time work on Space Pirates from Tomorrow for Windows.  This will be a COMPLETELY new project with NO old code being reused.  I've already started on the orbital mechanics functions and creating screen mockups but this was really to see how advanced some of the game concepts are in my imagination.  Right now we're looking at about 87,000 stars taken from real star catalogs, some settled and some not, and a whole load of new gameplay avenues to explore including buying, building or operating your own space stations and industrial operations, totally online play, and some military stuff too.  I'll be fleshing this out as development starts, and I'll be taking regular breaks to work on smaller, bite-size games (including PC versions of all our other old titles) as well as doing other non-game work.

My time as a member of the XBLIG community has been amazing.  It's rare to be exposed to such a range of talents, abilities, ideas and dreams and I've learned more about the sharp end of programming in the last 3 years than in the whole of my career previously.  Not only that, but some of the folk I've met along the way have been fantastically supportive, friendly, helpful, funny and generous.  I can't neglect to mention the team of MVPs who've tried so hard to support us and put our views to Microsoft as well as offering hours and hours and hours of free advice and support over the years.  When the first Space Pirates came out on XBLIG and bombed, they were not just a help but they kept me focussed, helped me learn from my mistakes and to move on.  I'm not going to pretend I was ever a prefect member of the community but the MVPs always inspired me to try and do unto others as I would be done, helping out where I thought I could, offering contributions to the many lively debates on the forums, and trying to put across my own perspective on indie game development.  I'd like to say a huge thank you to everyone I came across during my time working on XBLIGs - even those with whom I fell out - and wish you all the success you deserve in the future.