fix - #110
Conversation
There was a problem hiding this comment.
Pull request overview
This PR substantially reshapes the PvE RL environment in two ways: (1) it rewrites RewardCalculator to deliberately remove the dense per-step money/score signals and shaping bonuses (per the new docstring, in order to defeat standard PPO/DQN), keeping only a sparse terminal score bonus, time penalty, harvest bonus, and bankruptcy/invalid-action penalties; and (2) it changes the BUY semantics to charge live market price rather than manufacturing cost, and adds per-product prod_origin tracking on units to forbid selling a product at the same market it was bought from. Action masking and _best_buyable are updated to match.
Changes:
- Reward redesign: zeroed per-step money/score signal, removed compute-center & tech bonuses, added sparse terminal
env.score * terminal_score_scalebonus; reordered termination check before reward computation. - Cross-market arbitrage rule: new
Unit.prod_originmap; BUY records origin, SELL blocks same-market sale, LOAD selectively clears origin only for previously-empty slots. - BUY pricing changed from
pdef["cost"](+factory.cost_delta) tomkt.get_price(pid, t, 1.0);_best_buyablere-ranks byval_range[1] - price; mask uses live market price for affordability check.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| logic/pve/GameLogic/reward_calculator.py | Removes shaping bonuses and dense money/score reward; adds sparse terminal score bonus and new "anti-PPO/DQN" design docstring. |
| logic/pve/GameLogic/game_env.py | Reorders termination before reward; rewrites BUY/SELL/LOAD to track and enforce prod_origin; rewrites _best_buyable to use market price and upside vs. val_range max. |
| logic/pve/GameLogic/character.py | Adds prod_origin: Dict[int, int] field on Unit and initialises it in __post_init__. |
| logic/pve/GameLogic/action_space.py | Mask resolves the nearest market to a Market object, checks affordability against live market price, and blocks SELL_pid when the carried product's origin is the current market. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Descriptions of this pull request:
No additional description.