Skip to content

fix - #110

Merged
lch24 merged 1 commit into
eesast:devfrom
jxd136:main
May 15, 2026
Merged

fix#110
lch24 merged 1 commit into
eesast:devfrom
jxd136:main

Conversation

@jxd136

@jxd136 jxd136 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Descriptions of this pull request:

No additional description.

Copilot AI review requested due to automatic review settings May 14, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_scale bonus; reordered termination check before reward computation.
  • Cross-market arbitrage rule: new Unit.prod_origin map; 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) to mkt.get_price(pid, t, 1.0); _best_buyable re-ranks by val_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.

Comment thread logic/pve/GameLogic/game_env.py
Comment thread logic/pve/GameLogic/character.py
Comment thread logic/pve/GameLogic/action_space.py
Comment thread logic/pve/GameLogic/reward_calculator.py
Comment thread logic/pve/GameLogic/reward_calculator.py
Comment thread logic/pve/GameLogic/reward_calculator.py
Comment thread logic/pve/GameLogic/game_env.py
Comment thread logic/pve/GameLogic/game_env.py
@lch24
lch24 merged commit 8811aeb into eesast:dev May 15, 2026
9 checks passed
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.

3 participants