Skip to content

Conversation

@daveey
Copy link
Contributor

@daveey daveey commented Dec 14, 2025

Increase Inventory Capacity with Base-100 Encoding

TL;DR

Increases the maximum inventory capacity from 255 to 65,535 and implements a base-100 encoding scheme for observation tokens to support larger inventory values.

What changed?

  • Changed InventoryQuantity from uint8_t to uint16_t to support values up to 65,535
  • Updated InventoryDelta from int16_t to int32_t to accommodate the full range of changes
  • Implemented a base-100 encoding scheme for inventory observations:
    • inv:{resource} contains the ones digit (value % 100, 0-99)
    • inv:{resource}:ton contains the hundreds digit (value / 100, 0-255)
    • This allows representing values up to 25,599 (255 * 100 + 99)
  • Added inventory token encoding/decoding logic in the observation system
  • Updated the Python simulator to properly decode the base-100 encoded inventory values
  • Removed inventory value capping at 255 in the configuration conversion

How to test?

Run the new tests in test_set_inventory.py which verify:

  • Small inventory values (< 100) only emit the ones token
  • Medium values (100-255) emit both ones and tons tokens
  • Large values (> 255) correctly encode and decode using the base-100 scheme
  • The maximum representable value (25,599) works correctly

Why make this change?

The previous 8-bit inventory limit of 255 was too restrictive for many gameplay scenarios. This change allows for much larger inventory quantities while maintaining backward compatibility with existing systems. The base-100 encoding scheme efficiently represents these larger values in the observation space without requiring additional tokens for most common inventory amounts.

@daveey daveey changed the title cp Increase inventory capacity with base-100 encoding for values up to 25599 Dec 14, 2025
Copy link
Contributor Author

daveey commented Dec 14, 2025

@daveey daveey marked this pull request as ready for review December 14, 2025 06:26
@daveey daveey requested a review from sasmith December 14, 2025 06:26
@daveey daveey force-pushed the daveey-resource-limit branch from b8320d7 to 3f47205 Compare December 14, 2025 06:29
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@daveey daveey force-pushed the daveey-resource-limit branch from 3f47205 to 4aea879 Compare December 14, 2025 06:36
@daveey daveey changed the base branch from main to graphite-base/4355 December 14, 2025 19:03
@daveey daveey force-pushed the daveey-resource-limit branch from 4aea879 to d0a68f9 Compare December 14, 2025 19:03
@daveey daveey changed the base branch from graphite-base/4355 to daveey-inventory-config December 14, 2025 19:03
@graphite-app graphite-app bot changed the base branch from daveey-inventory-config to graphite-base/4355 December 14, 2025 20:25
@daveey daveey force-pushed the daveey-resource-limit branch from d0a68f9 to a5dbc90 Compare December 15, 2025 02:35
@daveey daveey force-pushed the graphite-base/4355 branch from 0735eea to 80c1cf6 Compare December 15, 2025 02:35
@daveey daveey changed the base branch from graphite-base/4355 to daveey-inventory-config December 15, 2025 02:35
@daveey daveey removed their assignment Dec 15, 2025
@daveey daveey force-pushed the daveey-resource-limit branch from a5dbc90 to ab4e5b9 Compare December 15, 2025 07:39
@daveey daveey force-pushed the daveey-inventory-config branch from 1b1303c to e02535f Compare December 18, 2025 05:11
@daveey daveey force-pushed the daveey-resource-limit branch from 3a053d9 to 659744a Compare December 18, 2025 05:11
@daveey daveey force-pushed the daveey-inventory-config branch from e02535f to f6a24b2 Compare December 18, 2025 06:33
@daveey daveey force-pushed the daveey-resource-limit branch from 659744a to b63adff Compare December 18, 2025 06:33
@daveey daveey requested a review from sasmith December 18, 2025 06:35
@daveey daveey force-pushed the daveey-resource-limit branch from b63adff to 2ffd88e Compare December 18, 2025 06:44
@daveey daveey force-pushed the daveey-inventory-config branch from f6a24b2 to 13f0211 Compare December 18, 2025 06:44
@daveey daveey force-pushed the daveey-resource-limit branch from 2ffd88e to f207eb2 Compare December 18, 2025 06:48
@daveey daveey force-pushed the daveey-inventory-config branch from 13f0211 to 57f5cee Compare December 18, 2025 06:48
@daveey daveey force-pushed the daveey-resource-limit branch 2 times, most recently from 28bd91e to 6e533b4 Compare December 19, 2025 01:47
@daveey daveey force-pushed the daveey-inventory-config branch from 57f5cee to 1f7cfef Compare December 19, 2025 01:47
@daveey daveey force-pushed the daveey-resource-limit branch from 6e533b4 to befbdc9 Compare December 19, 2025 16:25
@daveey daveey force-pushed the daveey-inventory-config branch from 1f7cfef to 5c7bc8a Compare December 19, 2025 16:25
@graphite-app graphite-app bot changed the base branch from daveey-inventory-config to graphite-base/4355 December 21, 2025 00:10
@daveey daveey force-pushed the daveey-resource-limit branch from befbdc9 to d9199b5 Compare December 21, 2025 20:28
@daveey daveey force-pushed the graphite-base/4355 branch from 5c7bc8a to 089772d Compare December 21, 2025 20:28
@daveey daveey changed the base branch from graphite-base/4355 to daveey-inventory-config December 21, 2025 20:28
@daveey daveey force-pushed the daveey-resource-limit branch from d9199b5 to f4f2626 Compare December 21, 2025 20:33
@daveey daveey force-pushed the daveey-inventory-config branch from 089772d to 803c303 Compare December 21, 2025 20:33
@daveey daveey changed the base branch from daveey-inventory-config to graphite-base/4355 December 23, 2025 04:18
Copy link
Contributor

sasmith commented Dec 23, 2025

I think this is no longer relevant?

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