Submissions from 2017-10-26 to 2017-10-27 (2 total)

Was hoping to tweak my weapons' ballistics tonight. My current system just assigns an arbitrary muzzle velocity to every weapon and removes gravity from projectiles. It works, but, it basically makes it impossible to create something like a grenade launcher; something that ought to have a low muzzle velocity forcing you to fire in a pretty arc to hit distant targets.

Enter 'Projectile Motion Equations.' Specifically, my goal was to figure out what angle I need to fire a projectile at given (1) the projectile's speed (2) the range to the target and (3) the altitude of the target. Wikipedia has a nice entry on the topic and a nifty formula that I ought to be able to use.

https://en.wikipedia.org/wiki/Projectile_motion#An...

Specifically, I was looking at the "Angle [theta] required to hit coordinate" formula.


To cut a frustrating story short, I have myself some ballistic calculations using this formula, but, the calculations fail to actually hit their target. The formula has a + and - option. If I use the + option, all my shots overshoot by 2-3 units. If I use the - option, all my shots undershoot by a 1/2 unit or so. WTF, ballistics formula?!?!

At this point, I'm too tired to care any more. I have to assume that the formula is correct and that I'm just failing to do something properly in my translation. Either that, or I have a rigidbody setting screwed up. Hopefully, a fresh mind will show me an obvious problem to correct tomorrow.

This was kinda out of left field, but I decided to implement a basic fog of war system tonight. It uses a separate TileMap (aka layer), and a simple flood fill algorithm to fill the whole level with fog. Next, I do un-flood fill the area around the player, but only out to a set distance (4 tiles for now). Finally, entities, like the canisters, can query whether they're in the Fog, and decide to hide themselves.

A few caveats:

  • The 'un-filled' logic doesn't take into account line of sight, so it will mistakingly allow the player to see areas around corners or in other rooms. That will have to wait for proper pathfinding.
  • The 'fog' has very sharp corners right now. But since it is just another tilemap, I should be able to smooth it out with a programmable tile like the walls.