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

Add attack mission and battle report logic #265

Merged
merged 33 commits into from
Aug 19, 2024

Conversation

lanedirt
Copy link
Owner

@lanedirt lanedirt commented Jul 14, 2024

Remaining todos:

  • Add basic attack mission scaffolding
  • Add battle report message DB table
  • Add battle report functions based on structure of espionage report functions
  • Add battle system scaffolding
  • Add unit test for max loot depending on attacker remaining ships, planetservice defender and percentage expected.
  • Debug: currently loot of battle report does not match with loot brought back by return mission as shown in return message. Note: return message seems to be correct: 5 LF = 250 capacity = 125 metal/crystal. The battle report shows 375 total resources which would indicate a bug in deuterium which the planet didnt have.
  • Save attacker and defender weapon/armor/shield technology in the battle report because this data can change later and therefore should not stored statically.
  • Add basic round logic where units attack other random units and persist results to battleresult rounds property.
  • Make full battle report JS initialization work with dynamic json data.
  • Conform battle engine output to what full message JSON depends on.
  • Add full battle report message support
  • Make rounds logic follow official rules taking into account shields, attack power etc. Add unittests for absorbed damage per round (shields), full strength attacker (weapons), hitsAttacker (rapidfire).
  • Add unit test for light fighters attacking a large shield dome to test "bounce" logic.
  • Add rapidfire support and unittest this.
  • Refactor rounds logic for maintainability.
  • Implement unit tests for battle engine simulations with different user tech levels.
  • Add feature test to ensure lost units during battle are deducted for attacker and defender. Currently defender losses are not persisted.
  • Add feature test to ensure if attacker loses battle no return mission is launched.
  • Add feature test to ensure both attacker and defender receive battle report.
  • Implement resource loss calculation and show it in battle report small and full.
  • Implement warning in UI if foreign player has an active attack mission towards current player
  • Add feature test for active attack warning in UI
  • Check game mission race condition php artisan tests, during testing 08-12 it triggered errors:
www@51e8cb99fcb5:/var/www$ php artisan test:race-condition-game-mission
Running test iteration... 0
Test user created with ID: 5485
Planet 1: 11194 - 10:79:8
Planet 2: 11195 - 10:79:4
Login as test user...
Login successful.
Dispatched 10 small cargos to users second planet: 10:79:4
Running parallel requests...
Request 0 succeeded with status code 200. (Started at: 2024-08-12 19:50:37.354348, Ended at: 2024-08-12 19:50:37.582154)
Request 1 succeeded with status code 200. (Started at: 2024-08-12 19:50:37.354458, Ended at: 2024-08-12 19:50:37.891340)
Request 2 succeeded with status code 200. (Started at: 2024-08-12 19:50:37.354495, Ended at: 2024-08-12 19:50:37.821020)
Request 3 succeeded with status code 200. (Started at: 2024-08-12 19:50:37.354527, Ended at: 2024-08-12 19:50:37.591430)
Request 4 succeeded with status code 200. (Started at: 2024-08-12 19:50:37.354549, Ended at: 2024-08-12 19:50:37.585825)
Request 5 succeeded with status code 200. (Started at: 2024-08-12 19:50:37.354571, Ended at: 2024-08-12 19:50:37.920076)
Request 6 succeeded with status code 200. (Started at: 2024-08-12 19:50:37.354591, Ended at: 2024-08-12 19:50:37.855041)
Request 7 succeeded with status code 200. (Started at: 2024-08-12 19:50:37.354615, Ended at: 2024-08-12 19:50:38.101543)
Request 8 succeeded with status code 200. (Started at: 2024-08-12 19:50:37.354635, Ended at: 2024-08-12 19:50:38.111381)
Request 9 succeeded with status code 200. (Started at: 2024-08-12 19:50:37.354657, Ended at: 2024-08-12 19:50:38.119625)
[ERROR] There are 2 returning missions in the database while only 1 should be created. Check for race conditions!
Test failed. Exiting...

@lanedirt lanedirt added the enhancement New feature or request label Jul 14, 2024
@lanedirt lanedirt linked an issue Jul 14, 2024 that may be closed by this pull request
@lanedirt lanedirt marked this pull request as draft July 14, 2024 22:12
@lanedirt lanedirt mentioned this pull request Jul 17, 2024
2 tasks
@lanedirt lanedirt marked this pull request as ready for review August 19, 2024 19:48
@lanedirt lanedirt merged commit a0b1566 into main Aug 19, 2024
6 checks passed
@lanedirt lanedirt deleted the 233-implement-attack-mission-and-battle-system-logic branch August 20, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement attack mission and battle system logic
1 participant