Slide 1

Slide 1 text

Diego Muñoz “Kartones” DEVELOPING A PARTICLE SYSTEM WITH XNA Vicente Cartas

Slide 2

Slide 2 text

Agenda • Agenda • Evolution of videogames • A simple particle system • Content pipeline for our system • Demos • End 

Slide 3

Slide 3 text

Evolution of videogames Unicelular entity First videogame Primitive shapes Arcades Pigmentation Videoconsoles arrive 2,5 Dimensions First FPS Jump to 3D OpenGL/DirectX The invasion XNA: 3D for anyone

Slide 4

Slide 4 text

A simple particle system Basic Concepts 2D Sprite Two triangles Or just one more speed, less versatility • Particles are always oriented (looking at) the camera (like sprites in Doom 2 :) • PointSprites: Manage just the center of the sprite (a point), when drawn transforms to a 3D polygon

Slide 5

Slide 5 text

A simple particle system The particle engine • Particle Entity: Simple, contains information about position, mass, speed, acceleration, age… • Particle system: Contains a group of particles and rules of how they will behave. • Emitter: Way of creating the particles • Integrator: Particles “Update()” • Particle Engine: Group of N particle systems Particle Engine Particle System Particle System Particle Particle Particle Particle

Slide 6

Slide 6 text

Content pipeline Basic Concepts • Content is imported • ParticleSystemImporter • Content is processed • ParticleSystemProcessor • Content is written • ParticleSystemWriter • Content is readed • ParticleSystemReader

Slide 7

Slide 7 text

Content pipeline In detail • Importing [ContentImporter(".pfx", DisplayName = "Custom - Particle System Importer", DefaultProcessor = "ParticleSystemProcessor")] public class ParticleSystemImporter : ContentImporter { public override ParticleSystemImported Import(string filename, ContentImporterContext context) {} } • Processing [ContentProcessor(DisplayName = "Custom - Particle System Processor")] public class ParticleSystemProcessor : ContentProcessor { public override ParticleSystemProcessed Process(ParticleSystemImported input, ContentProcessorContext context) {} }

Slide 8

Slide 8 text

Content pipeline In detail • Writing [ContentTypeWriter] public class ParticleSystemWriter : ContentTypeWriter { protected override void Write(ContentWriter output, ParticleSystemProcessed value) {} public override string GetRuntimeType(Microsoft.Xna.Framework.TargetPlatform targetPlatform) {} public override string GetRuntimeReader(Microsoft.Xna.Framework.TargetPlatform targetPlatform) } • Reading public class ParticleSystemReader : ContentTypeReader { protected override ParticleSystem Read(ContentReader input, ParticleSystem existingInstance) {} }

Slide 9

Slide 9 text

Particle System

Slide 10

Slide 10 text

XNA Particle Engine Sample

Slide 11

Slide 11 text

XNA Racing Game

Slide 12

Slide 12 text

End… Slides & sources: http://Kartones.net/files/ More information: •http://creators.xna.com/ •http://gamasutra.com/ •http://www.gamedev.net/ •http://www.thezbuffer.com/ •Our blogs (at Kartones.Net)