Animated Bitmap Explosions, 2

Animated Bitmap Explosions, 2

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Animated Bitmap Explosions, 2

Post by Argh »

Seriously, this is beyond MTR, and it's relatively simple to add.

Just take a CSphereParticleSpawner. Add in the frame-changing code from the smoke, for time control.

Finally, add a request for a specific texture file (not an Atlas texture), the dimensions x, y, and the number of frames. All frame results should be POT. So, a 64 * 512 texture, 32 frames = 16 * 64 pixels per frame. If people screw this up, it should not run and should give them an error message.

Then cycle N times, 0 being infinite (until the death of the particle), with each cycle being an offset x,y on the texture, and just run it as a CSphereParticleSpawner otherwise, in terms of growth and physics.

I don't even care if it uses colormap, we can do that in the texture, and it'd be cheaper, just give us an alpha control like in colormap, so that it can either be additive or just blend.

I'm probably going to implement this in Lua pretty soon, but meh, I figured I'd ask one more time, I think that this is a very basic tool for effects that we need and don't have.
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Animated Bitmap Explosions, 2

Post by quantum »

CA has copy-paste powered animated CEG explosions. They work quite well. Check unused_charlize.tdf.

You could use Lua for CEG config files (I don't have an example), and thus avoid the ugly repetition.

Or, of course, lups.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Animated Bitmap Explosions, 2

Post by Argh »

I actually tried it that way (the unused_charlize.tdf way) quite awhile ago. I thought that that was far too CPU-intensive for practical use- the main cost with a CEG is when it's initializing, and if you have 10 of those, initializing every frame... and 10 guys are shooting weapons with that effect... yeah.

That, and it eats valuable room on the TextureAtlas. And the position of the particles can't be transmitted from one instance to another, along with gravity, etc.- basically, it just has to sit at the origin, and that's it. If there was a way to pass that data from one CEG to another, that might be worth it, but I think that what I proposed would be faster and cheaper even then.

As for Lups, meh. I tested it, and wasn't terribly happy with it. Don't get me wrong, it's a nice example of what you can do with Lua, it just wasn't suitable.

It's not well-documented, and it doesn't have plug-and-play ways to just emulate CEG functionality, if that's what you want to do- the examples using Lups aren't anything near the complexity of a typical CEG event system, and it's a process I'm comfortable with.

I'd rather write something from scratch than import a complex system that cannot be used to immediately replace CEG functionality and would require studying a lot of source to use. But I don't see any of those issues getting fixed, frankly, so I just don't have any real interest. Again, no insult meant, it's very nice technology, just not something I want to use.

If you guys want to talk to me about that sometime, with an eye on making it more user-friendly and documented, I'd be willing to give up a week of my time and make a show-piece.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Animated Bitmap Explosions, 2

Post by smoth »

if the animation feature isn't too costly I give it a +1 thumbs up for what it is worth. I don't think i will use it but others may.
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

Re: Animated Bitmap Explosions, 2

Post by Noruas »

Abit off topic, but is there any way to randomize the chance of something spawning, or rolling dice, all i see are timers, and random variables, does not allow for something different the same time to make the weapon look more chaotic.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Animated Bitmap Explosions, 2

Post by Argh »

You cannot produce random results with a guaranteed "good outcome", no. There is no way to produce random branching or cause one event to cancel another event, in CEG. You can do all of that in COB, or write your own code to handle this stuff in Lua, then call for the appropriate CEG via Lua (Kloot committed it, I assume it's still in Spring, but it's not documented anywhere, just hold up, I'll go get it).
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Animated Bitmap Explosions, 2

Post by Argh »

:shock: Three awesome things that aren't documented in the changelog or in the Wiki, all by Kloot:
add a SpawnCEG(tag, px, py, pz, dx, dy, dz, rad, dmg) synced Lua callout (guess what it does ;))
* new call-ins:
ProjectileCreated(projectileID, projectileOwnerID) (arg #2 is -1 if no owner)
ProjectileDestroyed(projectileID)

* new call-outs:
GetProjectilePosition(projectileID) --> px, py, pz
GetProjectileVelocity(projectileID) --> vx, vy, vz
SetProjectilePosition(projectileID, px, py, pz) --> nil
SetProjectileVelocity(projectileID, vx, vy, vz) --> nil
submarines can now travel directly underneath surface vessels
and floating obstacles (and conversely; ships can move across
underwater objects), EDIT your mod's MoveInfo entries so that
the classes used by submarine-style units have "subMarine=1;"
set if you want to enable this fully
Documented. Need to create a Wiki doc for MoveTypes, that's gotta be confusing as hell for newbie modders anyhow...
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Animated Bitmap Explosions, 2

Post by smoth »

I wonder though, will that change allow amphibs to go under ships also?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Animated Bitmap Explosions, 2

Post by Argh »

Dunno, haven't had time to try it out yet.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Animated Bitmap Explosions, 2

Post by FLOZi »

SpawnCEG and the projectile calls are all documented in the changelog...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Animated Bitmap Explosions, 2

Post by Argh »

Are they? I didn't see 'em. Ah well. They weren't in the Wiki, now they are.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Animated Bitmap Explosions, 2

Post by REVENGE »

Yeah, they were definitely in the changelog. Sef and I were discussing using SpawnCEG in particular to do some map effects.
[Krogoth86]
Posts: 1176
Joined: 23 Aug 2007, 19:46

Re: Animated Bitmap Explosions, 2

Post by [Krogoth86] »

smoth wrote:I wonder though, will that change allow amphibs to go under ships also?
It does just as diving below floating DTs for example... :-)
Well of course only if the water isn't too shallow and the hitboxes collide because of that...
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Animated Bitmap Explosions, 2

Post by smoth »

completely understandable krogoth.
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

Re: Animated Bitmap Explosions, 2

Post by Noruas »

Xta already uses the submarine feature, its awesome.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Animated Bitmap Explosions, 2

Post by KDR_11k »

Noruas wrote:Abit off topic, but is there any way to randomize the chance of something spawning, or rolling dice, all i see are timers, and random variables, does not allow for something different the same time to make the weapon look more chaotic.
On SimpleParticles you can simply use a random expression on the number of particles. e.g. numParticles=.6 r.6; produces a 33% chance that a particle spawns (it's rounded down). If you want larger numbers that either spawn all or nothing you could use something like numParticles=10 r10 k17; which spawns 17 particles with a chance of 70%.
User avatar
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

Re: Animated Bitmap Explosions, 2

Post by Noruas »

Ok so if the particles do spawn, and then what stops the other particles from spawning in the 30 percent chance? they aren't synced but i will see what i can do with what you gave me Kdr.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Animated Bitmap Explosions, 2

Post by KDR_11k »

Yeah, okay, it doesn't pick one out of the particle systems (I don't even want to know what happens when you try to pass information from one CEG to another using buffers, I expect a desync).
Post Reply

Return to “Feature Requests”