• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Medo Mex

Sample Particle Engine

11 posts in this topic

It's pretty simple. Create a dynamic vertex buffer and a collection of textured quads. On every frame update the position of the quad and then render the collection. In the function you create to update (move) the quads you can also change their color, lifetime, size, etc... Just create a structure to hold this information and calculate their movement based on velocity vectors.

In my past experience I've learned to avoid point sprites for particles because there is no guarantee of how different cards handle point sprite as well I've run into some scaling issues. I also think point sprites are no longer supported on some newer hardware (dx 10/11). Go with quads / triangles.
0

Share this post


Link to post
Share on other sites
I have also tried to remove the black from the fire texture by using color key in D3DXCreateTextureFromFileInMemoryEx() but it doesn't work.

I have attached the fire texture that I am trying to use. Edited by Medo3337
0

Share this post


Link to post
Share on other sites
You remove the black by way of your D3D device's renderstates. Turn on Alpha Blending. Set the appropriate source and destination blend. Render your quads. Then turn off the alphablend so it doesn't affect the next object you draw.

Vertex buffers store the data that your video card will need to render objects to the screen. They are the fundamental building blocks for everything directx. Since you don't know what they are I suggest you start off with rendering a simple object and build your way up to particles.

Here is a link that describes vertex buffers and how to create them:
[url="http://www.toymaker.info/Games/html/buffers.html"]http://www.toymaker.info/Games/html/buffers.html[/url]

But you're also going to need an understanding of Index buffers, vertex formats, structures and the render options available to you like drawtrianglelist, drawindexprimitives, etc...

I'd also recommend you get a good book. There is a section on this site that is devoted to books on directx.

Cheers!
0

Share this post


Link to post
Share on other sites
I do understand vertex buffer, vertex formats, etc...

But I have been trying different render options but it doesn't work.

Can you post the appropriate rendering option to remove the black from the texture I posted?

BTW, I have created 4 vertices for each particle (rectangle shape).
0

Share this post


Link to post
Share on other sites
I am also not sure about how to update the particles position to create different things such as fire, explosion, snow, etc...

Of course, the way that the particles position will be updated in explosion will not going to be the same in fire, snow, rain...

Maybe you can show an example on moving the particles towards a direction (fire) or moving particles on all directions (explosion). Edited by Medo3337
0

Share this post


Link to post
Share on other sites
After trying, I attached what I have created so far.

As you can see, I still have a problem with removing the black from the fire texture.

Additionally, I am able to set direction for the particles but not sure about how to make the particles go on all directions (so I can create explosion).

One more problem I noticed is when I look at the particles from the SIDE, I see the side of the rectangle instead of particles, see the particle side attachment. Edited by Medo3337
0

Share this post


Link to post
Share on other sites
[quote name='Medo3337' timestamp='1339020785' post='4946882']
As you can see, I still have a problem with removing the black from the fire texture.

Additionally, I am able to set direction for the particles but not sure about how to make the particles go on all directions (so I can create explosion).

One more problem I noticed is when I look at the particles from the SIDE, I see the side of the rectangle instead of particles, see the particle side attachment.
[/quote]

What is your source and destination blend? For source blend try "source alpha" and for desitnation blend try "invert source alpha".

You also need to have the particle always face the camera. You can do this in the shader or when calculating your world matrix.

As for the movement, you just take the current position and add a velocity vector each frame. The velocity vector should be part of the particle's data structure so that each particle has a different velocity vector. A lifetime var is important too. With these basics you can create fire, smoke, rain, snow, etc... Edited by DJTN
0

Share this post


Link to post
Share on other sites
I created a particle engine using point sprites, not sure if it will compatible with most used cards out there or not.

Maybe if you know what kind of particles engine are used in well known games, you can give me an idea.
0

Share this post


Link to post
Share on other sites
There is no general standard when it comes to particle engines or games engines for that matter. Only the API on which it is written (DirectX, HLSL, OpenGL, etc…). In most cases the technology created to render effects like particles are usually driven by the game’s requirements and specs.

A good developer always thinks in advance in order to maintain OOP and flexibility. Since Point Sprites are no longer supported by directX (no support in DX 10, 11 and 12) you can be sure hardware support will be limited with new iterations. Even when they were supported through hardware and DirectX 9, there were issues with how the hardware handled Point Sprites, particularly scaling in my situation.

The only "real" advantages of Point Sprites are that the hardware automatically transformed them to always face the camera and a smaller CPU footprint, but looking forward you can accomplish the same thing with geometry shaders – giving you a lot more flexibility.

For me, the "to use or not to use Point Sprites" is a no brainer but I cannot speak for you as I do not know your target hardware, requirements, or expectations.


Regards.
0

Share this post


Link to post
Share on other sites
What they use in most games out there to create particles (point sprite or 4 vertices quad)?

Is it possible to make the particles always face the camera through code?

Can you post example?
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0