thombruce / verse

🚀 A universe in progress
Other
8 stars 0 forks source link

Enemy AI #58

Closed thombruce closed 1 year ago

thombruce commented 1 year ago

closes #57

By submitting this pull request, you agree to follow our Code of Conduct: https://github.com/thombruce/.github/blob/main/CODE_OF_CONDUCT.md


Internal use. Do not delete.

thombruce commented 1 year ago

Still no indication of player health (except the game crashing). Consider adding it here or creating a separate issue for this.

thombruce commented 1 year ago

Bullet issue is fairly regular and not necessarily when targets are touching. Here's the error:

thread 'Compute Task Pool (3)' panicked at 'Attempting to create an EntityCommands for entity 55v4, which doesn't exist.', src\ships\ship.rs:85:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `verse::ships::ship::ship_damage`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
error: process didn't exit successfully: `target\debug\verse.exe` (exit code: 101)

The problem is an attempt to do something with the bullet in the ship_damage system, but by the time this thing is attempted to be done... the bullet no longer exists.

All that we do attempt to do with the bullet is despawn it:

commands.entity(event.bullet).despawn();

It seems reasonable to assume that the bullet ship contact event is being triggered twice (bullets move fast - perhaps it has hit two targets before the event handling system has caught up).

thombruce commented 1 year ago

I was able to resolve that bug by moving the contact logic into the AttackSet system set. This places it before the damage system, which is set to happen .after(AttackSet) - 6af6c76c073c81c4df3ccf3cd9c4ef296c404afc

This is a quick, hacky resolution, and it should be considered a target for refactoring when we reorganise modules into separate systems and components files.

thombruce commented 1 year ago

The last two todos...

I've created a new issue for the first (#59), and I just don't want to do the second one right now... I could spend a long time tweaking values, but it's all going to be worked into a broader AI system later so... I think it should be deferred to after that work.

If that work doesn't come before v0.1, value tweaking might be a last thing before that milestone.