Skip to content

Conversation

@shanemadden
Copy link
Collaborator

I finally bothered to get a proof of concept going of getting randomness the 'right' way within Screeps WASM - it's a little tricky since the js feature on the getrandom crate assumes we have interfaces we don't, so going down that path is a trap, and we need a custom randomness function.

This replaces the additional part of the creep name with a random value instead of an incrementor - arguably this makes the example bot worse since it risks failing to spawn a creep when it could before , but also it's...

  1. a common enough feature that people want in their bots,
  2. extremely low risk of actually causing issues since people aren't likely multi-rooming on the example bot unmodified, and
  3. a bit wordy to document the setup for since you're adding two crate dependencies (but one is only to turn on a feature) then calling a macro on the function with the right signature to register

..so it seems like having this as part of the example would be an overall good/not too much extra complexity.

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.

1 participant