Enhance enemy AI and area connectivity
- Introduced area grid management in WolfEngine to track player-connected areas. - Updated enemy behavior to consider area connectivity when alerting and moving. - Added debugging logs for enemy states and movements to assist in tracking AI behavior. - Implemented fallback area generation for levels lacking area data. - Enhanced patrol behavior for dogs and guards to prevent rapid direction changes after hitting walls. - Updated tests to validate new area connectivity logic and enemy behavior under various conditions. Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -132,6 +132,7 @@ WolfEngine _buildEngine({
|
||||
WolfLevel(
|
||||
name: 'Test Level',
|
||||
wallGrid: wallGrid,
|
||||
areaGrid: List.generate(64, (_) => List.filled(64, -1)),
|
||||
objectGrid: objectGrid,
|
||||
musicIndex: 0,
|
||||
),
|
||||
|
||||
@@ -18,8 +18,9 @@ void main() {
|
||||
ss.takeDamage(999, engine.timeAliveMs);
|
||||
engine.tick(const Duration(milliseconds: 16));
|
||||
|
||||
final droppedMachineGun =
|
||||
engine.entities.whereType<WeaponCollectible>().any(
|
||||
final droppedMachineGun = engine.entities
|
||||
.whereType<WeaponCollectible>()
|
||||
.any(
|
||||
(item) => item.mapId == MapObject.machineGun,
|
||||
);
|
||||
expect(droppedMachineGun, isTrue);
|
||||
@@ -85,6 +86,7 @@ WolfEngine _buildEngine() {
|
||||
WolfLevel(
|
||||
name: 'Test Level',
|
||||
wallGrid: wallGrid,
|
||||
areaGrid: List.generate(64, (_) => List.filled(64, -1)),
|
||||
objectGrid: objectGrid,
|
||||
musicIndex: 0,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user