Archive for the 'C#' Category

A Framework for Generating Particle System

The following was created as part of my final year computing project at the University of the West of England.

What are particle systems?

Particle Systems is a computer graphics technique used to model objects that cannot usually modelled through conventional methods, examples of such usages are to stimulate are but limited to fire, smoke, explosions, snow, sparks, and rain.

 

The aim of this project was to create a framework that will provide non-technical designers the tools and means to create particle systems for use within a game environment. The proposed framework will consist of two major components; an editor for designing particle systems, and a library for managing and rendering the particle systems.

The project was developed with the following minimum requirements in mind:

• Implement a particle editor that will allow developers to easily create particle systems for use within a game or any other application. The editor should provide a live view of how the particle system looks with the current settings.

• To implement a human readable storage format such as XML to store the particle settings. To use this storage format to transfer the particle settings between editor and game.

• To create a simple game that will demonstrate the particle systems created using this framework implemented in C# with Microsoft XNA Game Studio.

Created using: C#, XNA 3.1, WinForm, and XML.
Tools used: Visual Studios 2008, Notepad++ and Adobe Photoshop.
Time taken: 6 months including research, implementation and documentation.

Screenshots
(Click on images to enlarge.)


Here is a screen shot of the editor with some fire particles loaded. The live view area will display how the particles behave with the current settings. The propertyGrid below the live view contains a list of properties which are editable and the description box explains how the selected property affects the particle system.


In this screenshot we can see the editor showing a snow particle system. There are several presets that are included with the editor to help the user get started and they are: fire, snow, rain, smoke, and debug (a simple particle system used for debugging purposes).


This is a screenshot of the editor in wireframe mode. By using the wireframe mode you can easily see how the individual particles are orientated within the environment. Other debug features that are included are:  a movable camera, debug info (such as the number of current particles and the fps), and pause & reset particle system.


This is a screenshot showing the contents of particle system’s .xml file.

When saving the particle system all of the variables are converted to strings for storage. They are then converted back to their respective data types when the .xml file is loaded.

Notes

  • Booleans are stored as 0s (false) and 1s (true).
  • Data types with more than one component such as Vector3 (3 floats) are separated using a , (comma).
  • Data types with a min and max value are split using a | (pipe).
Project Usage
This project was used in the creation of a game that our group created for another module.
Here is a link for a demo: http://www.youtube.com/watch?v=-3p2TEvYKYQ
Please look in the description box for time shortcuts to see examples of the particle systems that were created using this framework.