Particle System–Basic Implementation

I’ve just finished my first crack at a particle system for the GameDev-UK game library.

It uses G3D to abstract from direct OpenGL just a little bit, but in very useful ways, by a series of G3D wrapper classes. At the moment is uses a very simple shader implementation, with nearly all the work being done on the CPU.

My implementation passes an array of textured quads to the card, one for each particle, during the emitter component’s Draw call. This is done using G3D::VertexBuffer and G3D::AttributeArray. First the vertex buffer is created at the right size to accommodate the vertices required for all the quads, then G3D::Arrays of positions and tex-coords are used to create G3D::AttributeArrays on the GPU in the vertex buffer.

Next a G3D::Args class is used to define the binding names for the attribute arrays, the texture and a tint colour within the shader. Finally, everything is brought together using G3D::RenderDevice::Apply, which actually binds the shader to the data provided and completes the render.

In the future I would like to modify the emitter class to use true instancing with textures used to pass the position and tex-coord list and then have a single quad transformed and rendered for each particle in the shader. But for now this version seems to be working and if it ain’t broke…

Buccaneer work-in-progress

I’ve finally got to the stage with the GameDev-UK lib where I can put together the rudimentary elements of a game. This example is a C++ port of a game a was working on last year.

It is currently using the procedural galaxy generation algorithm from the original 8-bit Elite game. which I was able to re-create in C++ using Ian Bell’s ‘reference’ code from his website – it seems to generate the galaxy exactly as I remember it at least! . The actual galaxy generation stuff is all decoupled from the main game though, so easily can be substituted for something more sophisticated as I go along. At the moment it is nice to see the familiar old Elite galaxy and is great for testing the main trading elements of the game!

The models are all by Griff, who created them initially for the Oolite project but was kind enough to give me permission to use them in my project and even provided them in non-oolite formats for me. Thanks Griff.

The main rendering code is OpenGL, but mediated through the G3D framework, which is wrapped up in the GameDevUK lib and abstracts a lot of nause away from state and shader management.

I have linked Bullet physics into the library and initialised some physics components but as yet the ships and objects do not implement any of this.

*Lots* to do, but at least it is a start…

G3D Beta 4 Milestone Released!

Things have been pretty quiet here over the last few weeks, but a lot has been going on behind the scenes. The G3D graphics library, on which the GameDevUK C++ and OpenGL tutorials will be based, has reached a major milestone and the Beta 4 release this month is *huge* leap forward.

Obviously this was slightly tricky timing for me because it meant a lot of breaking changes precisely at the time that I was trying to get these blog tutorials up and running. However this is the biggest update in years and has brought the library bang up to date with a baseline of OpenGL 3 functionality and some features utilising the very latest OpenGL improvements. Hopefully the dust will quickly settle now and I can crack on with publishing articles and vids over the coming months – including an updated Visual Studio 2010 installer and Game Wizard.

 

Subcategories

  • Getting Started

    This section deals with the basics of setting up a simple game framework, rendering 2D/3D objects and reacting to player input.

  • Projects & Demos

    This section includes articles about ongoing projects and demos using OpenGL, C++ and the GameDevUk library.

You are here: Home C++ OpenGL