Console-Sized Quantum Mechanics
by Kyzrati on 20110821 , under Video
With explosion damage calculations out of the way, next up was figuring out how to best animate them. One moment I'm scratching out some possibilities, then I jot down an innocuous little note along the lines of "need a particle system?" and ended up resting on the idea.
Next time back at my desk I'm writing a fully-featured particle engine, and the next and the next...
Never written one of these things before so it was a somewhat slow start, but once the pieces started coming together it became obvious this was the way to go. Particle engines are awesome!
I've opted for the heavily parameterized single-class model. Overall it's a pretty versatile system:
- Particles make use of a wide range of dynamic variables:
- Age can be a constant, random, or dependent on distance from a point
- Speed can be static, constant, random, or follow a linear or sine function
- ASCII characters, if used, can be static, based on direction, or sourced from an animated list or a random set
- Color blending options (foreground/background) are more or less the same list available in libtcod:
- Add
- Subtract
- Multiply
- Scale
- Linear Interpolation
- Add Alpha
- Screen
- Color Dodge
- Color Burn
- Overlay
- Any color can be dynamic, since particles are able to mix multiple colors based on their current age or speed using 10 or so kinds of linear/sine functions
- Particles can also be emitters themselves, spawning other particles based on various triggers, rates, randomness, direction information, etc, so it's pretty easy to chain together complex effects
- All these parameters are loaded from a text file, and attaching a particle effect to a weapon/item is as easy as writing its name in the item text file.
Internally, projectiles and explosion results are now a kind of particle, since integrating them into the system seems like an obvious choice.
Particle engines are pretty powerful, and I still don't know all the tricks to using this one, but in the coding process I designed several test effects and made a video where you can see them in action. Everything's kinda small at first, but it'll zoom in; and going fullscreen will help a lot since I recorded it in large format. (Note: This was my first-ever attempt at recording a video. Next time I'll try to keep the mic out of my mouth, promise!)
9 comments
-
Kyzrati
August 22, 2011 at 8:25 AMYep, expect quite a few unexpected features :) There's plenty more in store that's hopefully going to make X@COM a *very* unique experience.
The most important part of the design is of course gameplay, but X-COM wouldn't be as much fun if your impact on the world wasn't rendered in at least a minimally appealing fashion.
-
Creepy
August 22, 2011 at 6:43 PMI really love that second laser effect. The other stuff is good too, but that one looks like someone's carrying around a craft laser cannon on their shoulder or something. Got some OOMPH to it!
Real good job of translating the effects over into an ascii particle system and still managing to seem "XCOM-y".
-
Kyzrati
August 22, 2011 at 10:14 PMThanks! The effects in the game should be much cooler than these and I can't wait to make them, but I've got to move on and don't have time for actual design work at present. Glad there's already some stuff in there that you're liking though! Actually, since the particles are pretty to make, I'll probably write a little manual on that when I do an early demo release so that everyone else can play with them and probably come up with far better effects! It'll be fun to see what players can come up with.
-
Joshua Day
August 23, 2011 at 1:36 AMHow much trouble will it be to get bits of detritus and debris integrated into the particle system? It's visually distracting that walls don't interact with explosions until the last moment -- and it would be really cool if they dealt damage while hurtling along.
-
Kyzrati
August 23, 2011 at 10:16 AMActually, it wouldn't be any trouble at all, because I already did it :)
Explosion particles *do* deal damage as they move, it's just that some of the test particles were intentionally set to *not* do that, because they are, after all, just tests (their design was based solely on debugging requirements). And debris from impacts is easily created by having explosion particles emit more particles of whatever type(s) is/are desired when they collide with something. I stuck with relatively simple particles for the tests since I didn't want to introduce too many factors that could hide any real problems.
The system is already integrated with projectiles/explosions, so explosion particles can tear through walls as they move, and projectiles will break glass as they fly and, if/when I eventually add projectiles that can pass through other objects, will damage those on the fly as well.
Everything'll look better once I actually spend some time on design. For now I'm trying as hard as possible to *not* completely finish any particular part of the game while coding, a difficult fight against my perfectionist tendencies that will otherwise slow me down in my effort to produce at least something playable within a reasonable amount of time. This goal already started slipping away as I poured more and more time into tweaking and expanding particle system features. Time to move on to something else...
-
Joshua Day
August 24, 2011 at 3:29 AMWhat I really mean (and I do think you addressed this sufficiently, but I want to make it totally clear) is that it looks like terrain is getting damaged all at once, at the end of the explosion, instead of being damaged only by particles -- and it doesn't look like bits and pieces of terrain are getting caught up in the explosion, as particles.
Looking forward to sound!
-
Kyzrati
August 24, 2011 at 9:30 AMYeah, I get exactly what you mean, and the engine does that. Particles actually carry projectile/explosion damage with them, and apply it when they arrive at their respective target, after which you can do whatever you want with the design, e.g. spawn more debris particles or whatever. I just didn't design any to do that specifically. (In fact, some of the test weapons I fired in the demo are doing stun damage, meaning they don't even harm terrain.) The only debris you see being created at present are not actually particles, instead they're rubble terrain created when objects/terrain are destroyed. Particles can be used to spawn more inconsequential debris, though, purely to enhance the visual effect.
Sound isn't too far down on my list, but not before I implement exploding terrain, a better light source system, and fire/smoke (all coming soon).
-
Kyzrati
September 3, 2011 at 5:42 AMAnother comment about "terrain being damaged simultaneously" by explosions:
I don't show it in the videos, but one thing viewers might forget/not know is that the house has three stories (including roof), and I'm always shooting at the first, so the rubble you see "appearing later" (all those semicolons...) are actually pieces falling from higher floors. The falling is done in realtime--it's not instantaneous, so those things will naturally appear later.
It'll be more apparent when you're actually playing the game (and when you hear sounds of crashing debris :).
August 21, 2011 at 9:23 PM
Wow, very cool! I sure didn't expect all kinds of fancy effects and color fading in an ascii game. Neat!