Line of sight demo
Tuesday, 4 September 2007 | Labels: 2D, Actionscript, AI, Game, Glaze | |I've switched track for a bit.  This time working on the AI.  This demo shows some line of sight testing.  The code calculates 3 rays from an eye that intersect with the two limits and centre of an AABB.  If the object is visible the the turret calculates a firing solution and fire.  At the moment this is all done every frame (30fps).  I'll spread this calculation out over a series of frames.  The current enemy AI plan is:
- Create a list of target candidates within range (1.5x the firing range of the turret)
- Prioritize list
- Lock target
- Check visibility
- Calculate firing solution and fire.
- Reload
- Goto 4
The controls are the same. WASD to move the player, click to fire in the direction of the mouse.
Demo