particles

Even more interesting stuff (for XNA & MonoGame)

As the first article in series got quite popular, we decided to go for the second part.

UI

 Circular Progress/Loading Bars

Progress bars are a common feature in game UI design when representing mechanics such as character interaction, weapon reloading, power meters, etc. A circular progress bar is simply one that fills/empties radially rather than linearly. They have become more popular recently as they are more appealing to the eye than the traditional straight progress bar.

Markup Text Rendering

The markup engine uses little strategies (I called them resolvers) to translate from an attribute string to whatever it needs to render the markup, e.g. the image resolver translates a string into a Texture2D. The source text is “compiled” into an representation that can be drawn repeatedly without generating garbage (at least this was my intention).

MarkupTextEngine

Mass-Effect Like Dialogue

The looks and behaviour of the dialogue system and dialogue wheel.

dialoguesystemsample2009040523304931

 

World of Goo like Cursor

The most important element of the sample is the Cursor class. This is a DrawableGameComponent the handles the updating and drawing of the cursor. To add a cursor to your game, you simply add a cursor instance to your Components list.

goocursor2009012600361492

2D Pie Drawing

After I’ve seen some people asking how to do this on the forums, I decided to make a small class that allows us to draw Pies in 2D in XNA.

pie2dsample-2008-01-19-02-50-16-17

Particles

 2D Particle Tutorial

Well now onto something I know even less about, 2D particles. As you may or may not have seen I have had a play with these in my GSM Library where I have put a star field in as an optional background, but I said I would post my current knowledge of particles both 3D and 2D so here is my tutorial on 2D particles.

Particle Systems

In this chapter, we will see how to implement a particle system with all the update and animation code running entirely on the GPU, inside some pixel shaders.

particles

Post-Processing

 Post-process Framework Sample - #2

Today I’m posting a post processing framework sample. For those that don’t know, post processing is any manipulation of the frame buffer after the scene has been rendered (but usually before the UI), hence the word “post” in the name. This process could be a simple blurring, or it could be a motion blur or depth of field technique. But what if you have many post processes? For instance, maybe we have bloom, motion blur, heat haze, depth of field, and other post processes that we need to apply after we render our scene. Connecting all these post processes together can get a little hairy, and that’s what this sample helps us do.

Post-process Effect: Pixelate

This one’s a quite easy one, and even with shaders the process would be similar. But when using shaders, this could just be one step towards more interesting effects, like Bloom.

radial_1

Post-process Effect: Random Noise

My original inspiration for this was the subtle ‘film grain’ effect seen in the first Mass Effect, though by no means do I think my version is anywhere near in quality and subtleness. Actually, I kinda pushed it to be more visible for the sake of this article.

noise_effect

Post-process Effect: Negative Image, Color Boost

The purpose here is to achieve the negative of an image. In HLSL this is easily achieved by subtracting the original color from (1,1,1).

inverted

Rim Lighting

This time, we have a smaller sample. This sample shows the implementation of a “rim lighting” shader, customizable by a series of parameters.

rimligh2

XNA Effects – ASCII Art in 3D

The theme in November was “Text Based” and its rule was that you were only allowed to use text in the visuals of your game. I saw some of the cool stuff other developers were working on, including one that looked like it had text characters that could walk and talk, like people. But my mind immediately went to a different solution: I wanted to make a game that was fully 3D (effectively breaking the rule of rendering text), but then post-process the render into ASCII art, so it would look like it was text.

clip_image014_2

11 useful HLSL post effects

The demo consists of the 11 useful HLSL post effects. The parameters of the each effect can be changed at runtime to adjust the final result.

 

Solution Files

Easy multi-platform managment with MonoGame

So MonoGame is a great technology that allows us write common C# code and deploy our games to Windows-Desktop,  Windows-Metro, Windows-Phone, MacOS, Linux, IOS, Android, Ouya and even more. Being able to write portable code is great for us indie developers, though still your code may need some platform specific parts.

With our latest game Frenzied (which can run on Windows, Windows-Metro, Windows Phone 7, Windows Phone 8, Android, MacOS and Linux atm), we introduced our in-house platform-managment concept which we decided to blog about, so that others can also utilize.

monogame-platform-frenzied

Here’s how we are managing multiple-platforms for Frenzied.

First of all we created per-platform solution files;

Solution Files

Each project defines it’s own conditional compilation symbols so we can distinguish them;

Conditional Symbols

Then we defined some enums, the first one is Platforms;

GraphicsAPI enum;

Frameworks enums;

Then we implemented our static PlatformManager class, that will be responsible for identifying current platform and running appropriate code.

To get PlatformManager working we have to make two basic calls, the PlatformManager.Startup() and PlatformManager.Initialize(). Startup() call should be made from Program.cs for platforms that have a Main() entrance point where you run the game.

And in Game.cs (or what-ever you call the Game class) within Initialize() function you have to call PlatformManager.Initialize().

So PlatformManager will be doing all the hard-work for us. Note that how we handle it specific PlatformHandler and PlatformHelpers instances for each platform.

PlatformHandler is the base class that we can extend to implement our platform specific initialization code and so;

Note the PlatformConfig field that allows us to use platform-specific configuration. So you can for example enable mouse for a platform and disable it for mobiles.

PlatformHelper is the base class that we can extend to implement common functionality that needs platform specific code. The best example that comes our mind probably is launching default web-browser.

Let’s start implementing our handlers and helpers for each platforms;

Windows-Desktop

Windows-Metro

 Windows Phone 7

 Windows Phone 8

Android

 IOS

 Linux

 MacOS

That’s all! Now we can;

  • Manage our target platforms all together and have seperate platform specific code.
  • Have platform specific configuration (ie, hiding the mouse for specific platforms).
  • Have platform specific code to run behind scenes to implement common functionality (like opening a given URI in default web-browser).

I hope you enjoyed the article, if so please spread/tweet the word :) If you have any questions please don’t hesitate to send a comment!

Note: I did not implement PlatformHelpers for IOS, Android, MacOS, Linux yet but should be pretty easy to do so!

monogame-visualization

MonoGame Git Visualization

We have decided to use the awesome gource to visualize the history of MonoGame‘s github repository and the output is fascinating!

So here is how we did;

Step 1 – fetching avatars

To download available avatars for commiters, we used the gravatar script provided in gource’s related wiki page.

 Step 2 – run the gource over git repository

Step 3 – render the video with ffmpeg

Bingo!

 

c_sharp

Sharp Watch #4

Welcome to Sharp Watch #4!

Community Watch

Debate of the week – XNA is dead, long live MonoGame!

MonoGame watch

This video shows off the work the MonoGame team are doing to bring the content pipeline to Mac and Linux. The Content Pipeline will allow developers to optimize their game assets for a particular platform. In this example the .png file is converted to an optimized .xnb file, which is then loaded by MonoGame at runtime.

Listen to Lee Stott (Microsoft UK Evangelist) talk about what options you have when developing for Windows 8 and Windows Phone 8. MonoGame is mentioned quite a few times. This presentation took place at part of the recent Cambridge Game developers meetup.

Metaballs-Final

Cool Effects (for XNA & MonoGame)

Here is a list of cool effects we have found over web that can be used with XNA / MonoGame;

Misc Effects;

Particle Text

The basic technique is the same in both XNA and JavaScript.  We draw some text to a render target or canvas and read back its pixels.  Then, create one particle for each pixel that makes up the text on our canvas. Finally, place all the particles randomly and have them fly towards their proper position in the text.

2D Metaballs

Metaballs are organic-looking balls that deform as they merge or split, as shown in the picture below.  It’s a neat little effect, often used to render liquids or gels.  This is a tutorial on how to produce 2D metaballs in XNA.  As a bonus, the code requires no custom shaders, and therefore works equally well on Windows Phone, Xbox, and PC.

2D Crepuscular (God) Rays

If you refer back to my post on this for 3D you will see all the same shaders, the difference in this 2D sample is the way the light mask is built. Effectively you need to render your light source, over that render the elements in your scene that are obscuring that source over the top in black to create the light mask, then apply the Crepuscular post processing effect. Then render the scene as you would normaly and then using an additive blend apply the god ray’s over the top.

MonoGame gets Shocked!

We left off just porting Michael Hoffman’s excellent article showing us how to generate lightning effects almost effortlessly using XNA over to MonoGame in minutes, however (as I usually do) I felt it didn’t just go far enough, sure Windows desktop is fine but MonoGame V3 now gives us entry to Windows 8 / RT and Windows Phone for FREE with paid options for other platforms.

Particle Systems;

Particle Sample

This sample introduces the concept of a particle system, and shows how to draw particle effects by using SpriteBatch. Two particle effects are demonstrated: an explosion and a rising plume of smoke.

XML particles

This tutorial teaches you how to extend the Particle 3D sample so the particle systems are defined by XML files loaded with the XNA Content Pipeline.

XNA 2D Particle Engine

XNA 2D Particle Engine is a flexible, extensible particle engine written in XNA Game Studio 4.0. The engine can emit texture-based particles in almost anyway you like and can easily be integrated as a (drawable) Game component in your XNA Game Studio 4.0 projects.

Simple Particle Emitter in XNA 4.0

The particle emitter that I made produces approximately the number of particles specified per second. In most cases, such as producing 100 particles or more a second, it is pretty accurate. It is mainly when the number of particles per second is below the frame rate is when the system is not as accurate, but still it is close enough for a particle emitter, in my opinion.

XNA Particle Systems (Xen)

Xen is a framework for rapidly developing high performance 3D Games for Xbox 360 and PC

Stateful Particle Engine

Deferred Rendering in XNA4.0

Catalin has an excellent tutorial on deferred rendering, unfortunately some of the code no longer works, because it was written for XNA2.0. Fortunately (for you) I’ve converted the entire code base to XNA4.0 as a learning exercise.

Non-Realistic Rendering

This sample shows how to implement stylized, non-photorealistic rendering techniques, such as cartoon shading, edge detection, and a pencil sketch effect.

As you may know the popular gaming stream service own3d.tv decided to cease it’s operations.

So we have just released v0.51 update for eggrr which removes the own3d.tv support completely. It was also a good opportunity to push the favorites feature that was waiting in source repository.

As you can see in the screenshot below, you can now mark games & streams as featured.

eggrr 0.51

Here’s the full change-log of the update;

0.51.0

  • Added support for favorites feature – you can favorite games & streams!
  • Favorites feature will use roaming profile so your favorites will be available on your all computers.
  • Improved visual styles & look.
  • Removed own3d.tv support as the service is closed. RIP own3d.tv!
  • Improved app-bar button’s styles.

Go grab eggrr from Windows 8 app-store.