• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Blitzkrieg

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
This is a template to demonstrate the use of simple algebraic line equations to detect dynamic collision. There are 3 main spells...

Thunder: Creates a line of lightning.

Orb: Creates an Orb of lightning that will explode on contact with other units and bounce off Thunder.

Lightning: Strikes a target with lightning. It can be used to hit an enemy or an orb, which will send the target flying. Or it can hit a Thunder, which will destroy the Thunder and shoot the caster backwards.

The gameplay aspects are merely for polish. The main purpose of this is to demonstrate the ability to detect collision using the slope-intercept form of a linear equation. Using a hash table and a dummy unit, the Y-intercept, slope, X minimum, and X maximum are stored. A periodic cycle determines when an Orb strikes one of these, and they are then reflected off it.

The lightning ability uses a similar algorithm to detect when an orb collides with its path. It is mathematically more accurate than the usual method (atleast for me) of testing for units in a small radius incrementally in a line.

Enjoy!

Keywords:
collision, lighting, physics
Contents

Blitzkrieg (Map)

Reviews
17:12, 13th Nov 2009 ap0calypse: Rejected Spells/Systems go into the "spells"-section
Top