Skip to content

Conversation

cameronangliss
Copy link
Contributor

@cameronangliss cameronangliss commented Jul 27, 2025

It's nice to be able to serialize/deserialize objects so you can store them in files and save your current situation. Now you can do that with Battle and DoubleBattle objects!

  1. Battle-related objects no longer store a _data field containing GenData, and instead just call GenData.from_gen whenever they need the pokedex or something. This does not lose any performance and we were already doing this in some places, but allows these objects to be pickled now that they aren't carrying a pointer to the giant GenData object.
  2. Removed the deprecated EmptyMove object and its associated tests after realizing we never use that anywhere anymore.
  3. Add tests to check that Battle and DoubleBattle objects are now able to do round trip serialize/deserialize with pickle.
  4. Remove Observation/ObservedPokemon objects, not necessary now that battle objects are pickle-able, giving us a noticeable speed-up when playing battles.

Copy link

codecov bot commented Jul 27, 2025

Codecov Report

❌ Patch coverage is 90.90909% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.86%. Comparing base (f458350) to head (888beab).
⚠️ Report is 195 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #758      +/-   ##
==========================================
+ Coverage   83.38%   84.86%   +1.48%     
==========================================
  Files          39       44       +5     
  Lines        3918     5200    +1282     
==========================================
+ Hits         3267     4413    +1146     
- Misses        651      787     +136     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cameronangliss cameronangliss changed the title Take gendata off of a bunch of stuff Make battle pickle-able Jul 27, 2025
@cameronangliss cameronangliss force-pushed the dont-tie-gendata-onto-objects-its-huge branch from 76ac897 to 076db9e Compare July 27, 2025 16:48
@cameronangliss cameronangliss marked this pull request as ready for review July 27, 2025 17:00
@cameronangliss cameronangliss marked this pull request as draft July 27, 2025 17:16
@cameronangliss cameronangliss force-pushed the dont-tie-gendata-onto-objects-its-huge branch 3 times, most recently from 076db9e to 11c208f Compare July 27, 2025 17:28
@cameronangliss cameronangliss marked this pull request as ready for review July 27, 2025 17:30
@cameronangliss cameronangliss force-pushed the dont-tie-gendata-onto-objects-its-huge branch from 11c208f to 69cd1b9 Compare July 27, 2025 17:32
Copy link
Owner

@hsahovic hsahovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observation and ObservedPokemon are useful for making decisions / inference in choose battle. I don't think we should remove them.

@cameronangliss cameronangliss force-pushed the dont-tie-gendata-onto-objects-its-huge branch from 93a5a48 to 7314edc Compare July 28, 2025 09:58
@cameronangliss cameronangliss marked this pull request as draft August 8, 2025 05:41
@cameronangliss cameronangliss force-pushed the dont-tie-gendata-onto-objects-its-huge branch from b68b72f to b4bc1c3 Compare September 5, 2025 04:59
@cameronangliss cameronangliss force-pushed the dont-tie-gendata-onto-objects-its-huge branch from b4bc1c3 to 24e2d1a Compare September 5, 2025 05:01
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.

2 participants