#1649: Droid movement code improvement patch
---------------------------+------------------------------------------------
Reporter: Zarel | Owner:
Type: patch | Status: new
Priority: critical | Milestone: 3.0
Component: Engine: other | Version: svn/trunk
Keywords: movement | Operating_system: All/Non-Specific
Blockedby: | Blocking:
---------------------------+------------------------------------------------
We all know that the droid movement code has Serious Problems.
This patch aims to address some of them.
'''First''', it makes sure that the current waypoint (i.e. the direction
the droid is currently moving in) is always the furthest waypoint on the
list. In other words, if a droid doesn't have LOS to the current waypoint,
it moves towards the previous waypoint. If it can't find a single waypoint
it has LOS to, it will recalculate the path instantly.
This involves doing a LOS calculation about once per moving droid per
update. Shouldn't be too much of an issue (the old code did it
approximately that often), especially since I rewrote the LOS function
(more on that later).
'''Second''', it makes sure that the LOS raycasts are always from the tile
the droid "logically" occupies. This mostly only happens to cyborgs. Think
of it like this:
{{{
W
* Wc
W
}}}
`*` is the destination, `W` is a wall, and `c` is a cyborg. The cyborg is
close enough to the wall that the tile it's on is the same tile as the
wall is done. So when the LOS raycast is done from the W tile, it thinks
it has LOS to the destination, even though it really doesn't.
My fix is to cast the ray from the closest ''non-blocking'' (i.e.
unoccupied) tile.
'''Third''', it rewrites parts of the LOS raycasting routine to eliminate
rounding errors, and improve its speed. This rewrite will be applied to
other usages of the `rayCast` function in a future patch.
These changes seem to fix most of the movement problems we have.
--
Ticket URL: <http://developer.wz2100.net/ticket/1649>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project
_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev