See the Light

by Kyzrati on 20110831 , under ,

Quick addition: light-emitting items. It was only a few lines of code, since light sources were already attachable to any other object--it was just a matter of detecting and updating light-equipped items. Below is an unexciting shot of an electro-flare (seen top-center, on the ground, as a squad moves in on the area).

The last set of YouTube videos were pretty fuzzy, small, and unimpressive-looking, so I've made a new one that includes most of the same material, but in a larger format and zoomed. Check out the smoke-filled incendiary extravaganza below (you can use HD/fullscreen):

There's no sound yet, so I added some music instead. Not all that X-COMish, but it's the first thing I thought of. The game itself won't really feature much in the way of music--ambient sound/music at the most (like the original)--there'll be an emphasis on sound effects (with lots of interface sfx).

By popular request, here's a screenshot showing damage distribution from a large rocket, as impeded by brick walls:
(Okay, it was just Creepy who mentioned it, but seeing as how few people know about X@COM, he does make up a good percentage of the readership :)

I've also added a page containing the full changelog, which will be updated with every new version (whether internal or released). See the link at the top of the blog.

Probably going to work on parabolic trajectories next, to enable throwing and the potential for weapons like mortars (obviously not something to be included in the initial core game, but they could appear in a later mod).
4 comments more...

Conflagration Propagation

by Kyzrati on 20110828 , under ,

Ready to roast some aliens? The newest additions are all about various ways to turn up the heat.

First, explosions of any kind can now be attached to props and entities, so UFO power sources, cyberdiscs and more can now explode. How to do a suicide run on a UFO:

Taking out a cyberdisc (2x2 units aren't yet implemented, but it blows up just the same):

Incendiary weapons now create fire which ignites terrain and entities. Here's a rocket launcher firing incendiary rockets, after which you can see the fire spread a little (it would spread much more in a wheat field). Burned terrain will produce varying amounts of smoke/dust based on its composition (also occurs when destroyed or when props fall from heights and smash into the ground).

Although not as effective as incendiary ammo for the job, HE weapons may of course cause some small fires, too:

Fire is naturally useful as a makeshift light source:

Smoke grenades make a much denser, longer-lasting patch of smoke (throwing not yet implemented--this is shot from a weapon):

Smoke affects FOV (kinda the point):

And for the grand finale, lets burn that house to the ground, just because we can (and then blow it up afterwards, because that's fun, too :)

On a side note, even though the videos were already cropped down to nothing, YouTube still  felt compelled to compress them to nothing. Maybe next time I'll just record the entire window in HD instead. (I wish I could use screenshots instead, but the latest updates are best shown in videos...)

So here are the latest major additions:
  • Exploding Props & Entities
  • Effects of incendiary weapons/explosions
  • Fire burning/propagation and light emission
  • Entities catch fire and burn
  • Smoke results from fire and some weapon effects
  • Smoke affects FOV and stuns units
  • Materials can release varying degrees of smoke/dust when burned or destroyed

Current state of the near-term TODO list:
  • Light-emitting items
  • Variable animation speed
  • Throwing
  • Sound effects
  • 2x2 units
  • Reaction fire
4 comments more...

Console-Sized Quantum Mechanics

by Kyzrati on 20110821 , under

Talk about an unexpected diversion!

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 more...


    by Kyzrati on 20110811 , under

    Okay, so I haven't added the sound system yet, but I can just hear it already as I test the explosion code. Everything seems to be working nicely--explosions are propagating damage as expected, terrain is blocking the force of explosions based on its stats...

    No animation yet (that's coming up), but below is a shot of the results when a small rocket is fired into a hillside. The rocket hit the second level from the ground, and you can see how the grass is blown away and the dirt caves in.

    On the right is some debugging info, showing the relative damage on each level (0, 1, 2). Unlike X-COM, explosions are in 3D, though I've made them a fair bit weaker in the third dimension, so they would technically be more of an elliptical shape if viewed from the side. Vertical explosion effects are completely optional, and can be deactivated to preserve the original X-COM explosion effects (same level only).

    You may notice another difference from X-COM: blast patterns. X@COM uses a more rounded pattern, rather than the squarish patterns of X-COM, so your explosions will include a few extra squares. This difference is most noticeable for smaller blasts.

    And now on to what I've been waiting for... Time to unleash some serious firepower on that house. Here it is, awaiting destruction, with roof view on (remember, it's two stories):

    First we'll pull out our rocket launcher and smack the front door with a small rocket.

    But that's not enough! Who has time to fire a few small rockets just to bring down a house? You desire a more effective way to level that thing... How about a large rocket fired through an open door (explosion in middle of first floor):

    Still, they have a FENCE left! And someone even managed to survive! Okay, okay--here it comes... the Blaster Launcher!
    Soldier-boy there singed his eyebrows with that one!

    Let's check out the damage distribution (floor 0, 1, 2):

    As you can see, hanging around anywhere outside a window, even in the air far away from ground zero, would be a bad idea when that bomb goes off.

    1 comments more...

    The Sky is Falling

    by Kyzrati on 20110808 , under ,

    It's been a little while since the last update as I wasted (spent?) a couple days fretting over how to code the interface windows. Eventually decided to put that off and continue with the mechanics--next on the list was gravity.

    Gravity is optional for terrain, but obviously adds some fun tactical considerations.

    Damage inflicted by/to falling objects is calculated based on mass, or relative mass in the case of multiple objects (obviously there are armor and other modifiers). Objects can displace each other as they fall, and most objects leave rubble if not completely destroyed--a battlefield littered with rubble is a little harder to traverse (higher TU cost). Terrain now also has a stability property which determines how likely it'll fall apart as it loses support from other connected terrain/objects (i.e., the more holes you shoot in a large section of wall/roof/floor, the more likely it is to come crashing down).

    Here are the results of one test on a house (an exact replica of an actual X-COM house, btw),
    where I opened up on it with my heavy plasma using unlimited TU and ammo :) At present, rubble is represented by semi-colons.

    Apparently there were entities in that house after all! I only fired at the first floor walls, and you can see that half of the second floor collapsed, which brought down areas of the roof as well.

    Next up: Explosions! Probably won't be so much rubble left after this next update...

    Progress Report (copy of public changelog):
    • Units spurt blood when taking critical wounds, and may trail some blood while moving (color of blood, if any, set by race)
    • Added Material class to describe properties common among certain groups of terrain objects
    • Added system of terrain degredation to be followed when terrain objects are destroyed
    • Added terrain/object destruction handling
    • Added [optional] effects of gravity on terrain/objects which have insufficient support from connected terrain
    • Added mass property to units/terrain and relative damage calculations for impacts
    • Added projectile collision handling for all object types
    • Added dynamic updating for light/FOV maps due to terrain/obstruction changes
    8 comments more...