feat: support custom Python EnvironmentObject subclasses#23
Merged
Conversation
YJack0000
force-pushed
the
feat/custom-python-objects
branch
from
February 24, 2026 19:08
809b32c to
a23472d
Compare
Add PyEnvironmentObject trampoline class to enable Python subclassing of EnvironmentObject with proper virtual method dispatch. Add generic add/remove overloads for EnvironmentObject in Environment, with corresponding add_object/remove_object Python bindings. Co-Authored-By: Claude Opus 4.6 <[email protected]>
YJack0000
force-pushed
the
feat/custom-python-objects
branch
from
February 24, 2026 19:13
a23472d to
de3348b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EnvironmentObjectadd_object/remove_objectmethods toEnvironmentpostIteration()overrideget_all_objects()Usage Example (Python)
Discussion Points
get_all_objects()中,但不會出現在get_all_organisms()或get_all_foods()中react()/interact()看到。如果搭配 PR3 的 custom strategy,Python 端可以根據 object type 自定義互動行為postIteration()會在每個 tick 被呼叫,可以用來實作會隨時間變化的地圖物件(如消失的牆壁、移動的障礙物)postIteration()需要回呼 Python,目前的單線程 postIteration 迴圈是安全的Test plan
🤖 Generated with Claude Code