Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enemy AI #58

Merged
merged 6 commits into from
Oct 21, 2023
Merged

Enemy AI #58

merged 6 commits into from
Oct 21, 2023

Conversation

thombruce
Copy link
Owner

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.

  • Tests passing
  • Coverage sufficient
  • Manual review
  • No A11y regression
  • Translations provided or not needed

@thombruce
Copy link
Owner Author

thombruce commented Oct 20, 2023

  • Game crashes if player dies - maybe add a Game Over screen
  • Game sometimes crashes if bullets fired too close to target (touching) - might be resolved by reordering systems
  • Enemy flight and targeting behaviours can be tweaked
  • Repetition; consider adding a component and separate system for target position selection

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

@thombruce
Copy link
Owner Author

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
Copy link
Owner Author

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) - 6af6c76

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
Copy link
Owner Author

The last two todos...

  • Add game over screen
  • Tweak values

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.

@thombruce thombruce marked this pull request as ready for review October 21, 2023 00:37
@thombruce thombruce merged commit 00bf90d into main Oct 21, 2023
@thombruce thombruce deleted the feat/enemy-ai branch October 21, 2023 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Basic Enemy AI
1 participant