logo

© Robert Marshall

ROBWARE » Blog » Going TrigoHappy (and neglecting actual work)

Post created on Sunday the 18th of December 2011

Screenshot of TrigoHappy

A screenshot of TrigoHappy

So the last few weeks I've been getting my game, TrigoHappy, market ready, making a few tweaks and adjustments here and there, and I think it's now finally all set to put on the Windows Phone Marketplace.

For those (somehow) unaware of my game; it consists of a ship that you move and shot with using on screen joysticks. There are various enemies of different types, and you have to survive as long as possible to accumulate the highest possible score. More information can be found on its project page.

Thanks to this game I've been neglecting my 3YP. But it'll be worth it. I'll be putting the game up on the market for 99p, but I'll only get about 40p of that thanks to the US and Microsoft taxes (as if MS don't make enough money as it is). I could rant about how ridiculous it is that a company who has a product that relies on the success of external developers' products, and requires them do keep producing, takes a 30% cut of what a developer could earn, but I'll refrain from that because I'm sure there's enough of that out there already.

 

Creating screenshots for this game was really quite the challenge. The traditional way of making screenshots is to use the emulator, but this isn't a game that you can play on the emulator. This required me to look at more interesting methods. I finally took to making XNA render to a file, and save that to the phone to be later retrieved with this program. This required some code to be wrapped around the draw functions. Take a look:


private
 static RenderTarget2D _render;
//...
#if DEBUG _render=new RenderTarget2D(GraphicsDevice,GraphicsDevice.Viewport.Width,GraphicsDevice.Viewport.Height,
false,SurfaceFormat.Color,DepthFormat.Depth24Stencil8); #endif
//...

protected override void Draw(GameTime gameTime) { #if DEBUG if (_renderToFile) GraphicsDevice.SetRenderTarget(_render); #endif GraphicsDevice.Clear(Color.Black); base.Draw(gameTime); #if DEBUG if (_renderToFile) { _renderToFile=false; GraphicsDevice.SetRenderTarget(null); IsolatedStorageFileStream fs=new IsolatedStorageFileStream("screenshot"+_screenshots+".png"
,FileMode.Create,FileAccess.Write,_storage); _render.SaveAsPng(fs,GraphicsDevice.Viewport.Width,GraphicsDevice.Viewport.Height); fs.Flush(); } #endif

}

What you can see there is the code required to give XNA somewhere to render to, and take that rendition and save it as a file. Not really all that complex.

This code enabled me to have a static function to take screenshots in game, which I later attached to a timer to allow for some screenshots of actual game play.


#if
 DEBUG public static void TakeScreenshot(){ _screenshots++; _renderToFile=true; }
#endif

You lot can all shut up about my coding style. I hate white space, you don't need it, and pressing the spacebar needlessly is a waste of time.

 

I didn't totally neglect my project, honest

I did some work on making a prototype for my project, but before I make any real headway on it I'm going to get a machine that I can leave to crunch some numbers; I don't want to leave my only machine unusable for hours on end.

With this prototype I can currently analyse a data set of a specified size, and calculate the average speed between different times of day. I also have a clickable map that can be dragged around. I currently only uses an image at this point, but I hope to make it something a bit more interactive. Anyway, here's a screenshot.

Screenshot of prototype

A screenshot of the prototype

As you can see it has a long way to go yet before it will be usable, but from here I'll be able to make most of the essence of the program. I'm also working on a graphing interface with WPF to make statistics easier to display.

Graph prototype screenshot

Wooo, graphs!



Make a comment

Your email address will not be published, and your comment will be seen once it's been moderated and approved. All HTML formatting is automatically removed.

Name:
Email Address:
Website (optional)
Comment:

Let's make sure you're human. Drag or click the correct shape on the left to move it to the grey "drop area" on the right.