mspraggs / potentia

Southampton Game Jam 2015
0 stars 0 forks source link

Particle System #24

Closed DivFord closed 9 years ago

DivFord commented 9 years ago

Ideally, I would like to replace the crate smash animation with a particle effect. I'd also like to replace fire, and it would be nice to have particles for block changes (dig and freeze).

In theory, this should be completely encapsulated. It would draw over the top of everything else, and wouldn't interact with the physics. We'd want the following parameters:

Fyll commented 9 years ago

...You want a particle engine. I'd love to help, but I'm busy trying to re-write 36 hours of increasingly bizzare logic.

More seriously, while that would be nice, it should probably wait until after things have been cleaned up.

DivFord commented 9 years ago

Yes, of course it should wait. I just wanted to note it before I forgot. I wouldn't want you guys to run out of stuff to do :P

Fyll commented 9 years ago

What with me being bored (Uni work? What's that?), I've had a first crack at this. Namely, trying to get fire in.

Do you want me to push what I've got, to let people have a look?

DivFord commented 9 years ago

Yes please!

I suppose I'll need to start on some particle sprites.

Fyll commented 9 years ago

Pushed.

Admittedly, the only thing that's on fire is a spot just above your head on the intro screen, but I wanted to keep it separate from everything else for now.

DivFord commented 9 years ago

I like it so far. Keeping it separate seems wise.

Since I'm likely to do most of the setup of individual effects, can I request that you comment the constructor function for the particle system class. Just for ease of reference.

Also, before I start on sprites, how easy would animated particle sprites be to implement?

Fyll commented 9 years ago

Animated particle sprites? As in, a sprite that changes as time passes, as well as moving and rotating?

DivFord commented 9 years ago

Yup. Flames look better if they flicker. The ideal would be two frames of flame, cycling, turning into two frames of smoke, at a certain point in the lifetime. Just the first part would be fine though.

Fyll commented 9 years ago

Hmm. That should be possible now (I've pushed a few tweaks). I'll try mocking up a quick thing to check that it works.

Fyll commented 9 years ago

Okay. My quick mock-up works, but not as you requested. You can have a single line of frames, which it steps through as it wends it's merry way, such that it is on the last frame when it dies. Making it lase between two frames, the step over to a third at a given point is something I can't really see how to elegantly (<.< ...) do...

I'll see what I can do though.

EDIT: Okay, a question, is fire the only thing that'll have all of these wierd flickering effects and animation? If so, I could just do the fudgey solution and put a bool isFire_ in. Crude, but very functional.

DivFord commented 9 years ago

As I said, I can live without the step over. I would prefer if the animation time wasn't tied to the particle lifetime though. As in, the animation loops over one line, rather than playing it once then dying.

Fyll commented 9 years ago

Looping repeatedly over a line would be straightforward. Do you want any sort of delay between frames, or just to run through them as fast as you can?

DivFord commented 9 years ago

Delay please.

Fyll commented 9 years ago

Okay. All done and pushed.

DivFord commented 9 years ago

I'm not seeing the animation… May just be the fade-out masking it.

Also, is it just me, or is the cannon stuck on the firing animation?

EDIT: What are the extra rows for?

Fyll commented 9 years ago

Oops! I'd left the frame delay on quite high. Fixed version pushed. In case you want to play around with the numbers, it's the 11th parameter in the initialiser on line 73 of Game.cpp (the second one after the Vectors).

I think it's just you again. :P Having run through the game a couple of times now, I couldn't see it happening.

The extra rows in the fire png are from when it used to just pick up bits of the sprite and draw it in the same position as where it found it. It also allows there to be 4 different types of fire particle, but that doesn't really matter. Feel free to get rid of them if you want.

DivFord commented 9 years ago

Yay!

While I'm requesting features, can we have a constructor parameter to have the particle system either play all 4 (I'm assuming a 4x1 texture) frames in an animation loop, or to pick a random frame for each particle and not animate it. So the first option is for things like fire, and the second is for things like smashing crates.

Huh. That's weird. My cannon has the anims permanently reversed.

Fyll commented 9 years ago

The code should be (sort of) ready for it. I'll put a smashing crate next to the fire, so you can see what it's currently got. EDIT: This may take a bit longer than expected. I'll get it working and push tomorrow. Sorry.

Hmm. Is it like that from the start, or is it to do with changing weapons again?

DivFord commented 9 years ago

From the start this time. I thought it might be a side effect of you fixing the other one.

Fyll commented 9 years ago

Okay, I've fixed your gun problem (I forgot to intialise something).

Also, I've pushed the exploding crate. It only explodes while a key is pressed, as it was otherwise a bit hard to see what was going on. Also, it explodes upwards.

The idea with the crate was to replace the normal crate sprite with one that's built out of these particles, then just draw that as it explodes instead.

DivFord commented 9 years ago

I'm not sure I follow. Do you mean that the crate sprite disappears and that particle effect appears?

Fyll commented 9 years ago

Yeah. So when you smash the crate, the normal sprite stops getting drawn, and instead, the particle effects get drawn.

EDIT: I've pushed a slightly fancier version that actually shows a crate being smashed. The preferred finished product will have the smash going in the direction that it was smashed, but I can't extract that information without integrating the particle system into the Objects.

DivFord commented 9 years ago

I've made a sprite for the flame particles, but I'm going to need to mess with the fire particle system settings. Where are you creating that? And would it be worth making a header file to define different particle systems inheriting from particle system? Like we do with types of block.

Fyll commented 9 years ago

They get created in Object::ignite(). It's a pretty ugly line of code, so if you can clean the fire up a bit, I'd be very grateful.

DivFord commented 9 years ago

I'll see what I can do.

Fyll commented 9 years ago

I figured that I should point out that I've changed how particle effects work, and now freezing/thawing look a lot nicer. If you disagree, all of the relevant code is confined to one function in ParticleEffect.hpp, so you should be able to poke it until you're happy (or even write your own!).

Fyll commented 9 years ago

Seeing as I'm happy with the particle engine as it stands, I'm going to close this. Requests for specific particle effects can be posted separately (or do it yourself you lazy so and so :P).