Particle Engine written in C (source code available)

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Particle Engine written in C (source code available)

Postby MCU on Sat Jan 14, 2017 8:23 am

I remember watching Falco demonstrate DCParticles a really long time ago, and I always thought it was badass. :bow:

So I made my own in a similar style.
Its controls are position, gravity, velocity, angle, size, lifespan, and RGBA color.

I wrote this a while ago, rewrote it recently and I decided to share it cuz why not.




It's not locked into a constant framerate. On my laptop it runs at 1500fps, and my desktop PC it's nowhere near that.
If you want to compile and run it for some reason, and it's too slow, you can increase the tick rate to speed it up.

If you want to check the source code it's here
https://github.com/pxcland/GLParticles
MCU
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 3
Joined: Sat Jan 14, 2017 8:11 am

Re: Particle Engine written in C (source code available)

Postby dandymcgee on Sat Jan 14, 2017 11:38 pm

Very cool! The Proof of Concept tile engine is impressive as well. What do you plan on doing with the particle engine?

Also, I noticed you're using immediate mode rendering. If you want to learn modern OpenGL and speed it up even more, I suggest https://learnopengl.com/. Great website. In particular, the section on "instanced rendering" would help you make your particle system even faster than it already is.

Your code is very well organized and commented. Kudos on that.

Oh, and welcome to the forums Patrick!
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
 
Posts: 4906
Joined: Tue Apr 29, 2008 4:24 pm
Location: New Hampshire

Re: Particle Engine written in C (source code available)

Postby MCU on Sun Jan 15, 2017 1:13 am

dandymcgee wrote:Very cool! The Proof of Concept tile engine is impressive as well. What do you plan on doing with the particle engine?

Also, I noticed you're using immediate mode rendering. If you want to learn modern OpenGL and speed it up even more, I suggest https://learnopengl.com/. Great website. In particular, the section on "instanced rendering" would help you make your particle system even faster than it already is.

Your code is very well organized and commented. Kudos on that.

Oh, and welcome to the forums Patrick!


Thanks!

Haha, to be honest there really isn't much of a purpose for it. It was more of an educational thing, to get under my belt so I understand how to make one. It was pretty sloppy and slow the first time I wrote it since every particle stored way more state and took twice the memory. On the first version I was learning as I made it, this version I rewrote the code to remove all the superfluous stuff.

But now since I've made it, if I ever want to incorporate it into a project, I have a working model and won't have to write it from scratch 8-)

I'm aware that my OpenGL usage has been long deprecated :lol: When I learned basic OpenGL a while ago I went with the simplest route to get the visuals I wanted, but it's obviously not sustainable for the future.
I looked through that website and it's unbelievable how well it explains everything. I'll definitely go through it :bow:
MCU
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 3
Joined: Sat Jan 14, 2017 8:11 am

Re: Particle Engine written in C (source code available)

Postby dandymcgee on Sun Jan 15, 2017 1:33 pm

MCU wrote:I'm aware that my OpenGL usage has been long deprecated :lol: When I learned basic OpenGL a while ago I went with the simplest route to get the visuals I wanted, but it's obviously not sustainable for the future.
I looked through that website and it's unbelievable how well it explains everything. I'll definitely go through it :bow:

Cool. Ping me with @dandymcgee in Discord if you ever wanna chat.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
 
Posts: 4906
Joined: Tue Apr 29, 2008 4:24 pm
Location: New Hampshire

Re: Particle Engine written in C (source code available)

Postby K-Bal on Mon Jan 16, 2017 6:52 pm

Great stuff, well done!

Reminds me of my own experiments I did for my bachelor's thesis. You can speed this up a lot by updating the particles in a geometry shader.

User avatar
K-Bal
ES Beta Backer
ES Beta Backer
 
Posts: 719
Joined: Sun Mar 15, 2009 4:21 pm
Location: Germany, Aachen

Re: Particle Engine written in C (source code available)

Postby dandymcgee on Mon Jan 16, 2017 7:20 pm

K-Bal wrote:Great stuff, well done!

Reminds me of my own experiments I did for my bachelor's thesis. You can speed this up a lot by updating the particles in a geometry shader.

Vouch. This guy's legit ^
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
 
Posts: 4906
Joined: Tue Apr 29, 2008 4:24 pm
Location: New Hampshire


Return to Game Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron