Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Particles help - trailing light

Author
Message
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 27th Aug 2013 18:14
Hi everyone. I'm looking to see if the current particle system would allow something like this:
http://www.youtube.com/watch?v=YrLkkxvkj24
at 45 seconds you'll see little lights in the background that are outlining what looks like circuits.
I'd really like to use something like this in my game and I'm exploring options on how to do it the easiest way.
I'm only working in 2D and with AppGameKit particles I've only seen that they fall downward. Can this be changed so they just stay stationery and the emitter is what moves?
Also how the heck would I get a solid light that decays like what is seen in this video?
All ideas are welcome.
Thanks!!

Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 1st Sep 2013 10:56
You could try doing it with sprites instead of particles. If you had something moving you could create small (say 1x1 or 2x2) blank sprites and behind it every time it moved, then set them to any color you want. Keep a static count of the sprites then every so often cycle through them and reduce their alpha values by a certain amount (you could also slowly reduce the color values to make them darken too) until it gets below a minimum level and then either hide, delete, or move them off screen. This way you could recycle the same sprites to save the hit on creating them, and if you calculated predefined maximums (for example 5 emitters producing sprites which dropped at 5 points of color and alpha per frame would be a maximum of 50 sprites per emitter, or 250 in total) then you could control the performance. It depends what you're going to run it over though, and how much spare processing power you have - this may be too slow to add into a main game, although you could updated them on alternating frames etc.

I guess you could even create a "spark" which slowly faded into nothing in an art package, then save it off as an image, load it as an animated sprite, then use the above technique but once the sprite is dropped just starts it's animation without looping, then AppGameKit will handle the fading. This might be much more practical to work around a complex game engine. Kinda like pre-cooking shadows in a 3d game.

Just two thoughts.
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 1st Sep 2013 19:46
Yeah, i was hoping that there might be a solution with particles, but I'm not seeing one.
Your idea is similar to one that I've decided not to go through with just because it will take too much resources (in my opinion) - my game is also very very light, so I'm trying to keep it that way. The only thing taking any time in my game at the moment is server checks and I have whittled it down to one that actually bottlenecks a little (it kind of has to).

What I'm likely going to end up doing is making an animation in Blender that will work for this. The only problem I'll have is that I want to use this around boxes and the boxes will vary in size. So the only solution I can come up with that won't cause stretching is to simply light up the top and bottom of the box and not do the sides as the sides and the corners will not work out good.
The animation technique I've found for Blender for this is pretty nice. We'll see how it turns out. I am going to try the sides too.
Thanks for the input I'm interested to hear any other ideas.

Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 1st Sep 2013 22:22
Ah, I wish I'd seen this reply an hour ago. Lol.

Anyway, the basic effect isn't too system killing. I knocked this very simple example up:



On my PC this gets about 1'900 FPS, and my mobile device (perhaps not surprisingly) returns a constant and smooth 60FPS (it's can't go above this due to Android screen syncing). If you change the sync rate to 60 it looks ok I think. It's also quite nice if you drop the sync rate to 60, then add a check to make it only update once every 3rd frame as in the attached .exe - I think that is a good speed myself, and would allow easy staggering of more than 5 strands.

Attachments

Login to view attachments
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 2nd Sep 2013 00:10 Edited at: 2nd Sep 2013 00:15
Quote: "Can this be changed so they just stay stationery and the emitter is what moves?"

Yes - SetParticlesDirection( Emitter , 0 , 0 )

Here's a basic attempt with an emitter and no sprites.

It just does a circle, but you get the idea


Should give you a starting point

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-24 20:36:58
Your offset time is: 2024-11-24 20:36:58