Skip to content

Conversation

@daveey
Copy link
Contributor

@daveey daveey commented Dec 15, 2025

TL;DR

Added a new Market object that allows agents to buy and sell resources using hearts as currency.

What changed?

  • Added Market and MarketConfig classes to implement a trading system
  • Markets have terminals on different sides that can be configured for buying or selling
  • Pricing is calculated dynamically based on inventory levels (100/sqrt(inventory))
  • Added helper function opposite_direction() to determine which terminal an agent is using
  • Updated agent inventory regeneration to support vibe-specific regeneration rates
  • Added comprehensive tests for market functionality

How to test?

Run the new test file test_market.py which covers:

  • Selling resources to the market
  • Buying resources from the market
  • Multiple trades in a single transaction
  • Price changes based on inventory levels
  • Edge cases like insufficient funds or out-of-stock items

You can also create a map with a market object and configure terminals on different sides to test buying and selling with different vibes.

Why make this change?

This adds an economic system to the game, allowing agents to trade resources and establish a currency-based economy. The market provides a way for agents to convert between different resource types at dynamically calculated prices, creating interesting economic dynamics and giving value to resource collection.

Copy link
Contributor Author

daveey commented Dec 15, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@daveey daveey changed the title cp Add market object for resource trading Dec 15, 2025
@daveey daveey force-pushed the daveey-remote-aoe branch 2 times, most recently from b35df07 to f7b7e27 Compare December 16, 2025 08:10
@daveey daveey force-pushed the daveey-market-2 branch 2 times, most recently from d47a43e to fc76f37 Compare December 16, 2025 22:31
@datadog-official

This comment has been minimized.

@daveey daveey force-pushed the daveey-market-2 branch 2 times, most recently from 3329320 to 4c0fb69 Compare December 19, 2025 16:59
@daveey daveey force-pushed the daveey-remote-aoe branch 2 times, most recently from 54dd7af to 24f95b0 Compare December 19, 2025 17:08
@openhands-ai
Copy link

openhands-ai bot commented Dec 23, 2025

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Test and Benchmark

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #4359 at branch `daveey-market-2`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

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