aliens

Author Topic: [Solved] RNG in recolorUnitSprite?  (Read 2466 times)

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
[Solved] RNG in recolorUnitSprite?
« on: March 22, 2020, 07:25:01 am »
Is it possible to add  access to "BattleGame.randomRange" or any other random in script hook "recolorUnitSprite"?
Thanks.
« Last Edit: February 14, 2023, 11:44:07 am by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9095
    • View Profile
Re: [Suggestion]Random in recolorUnitSprite
« Reply #1 on: March 22, 2020, 08:29:51 am »
Just guessing... but running RNG on every pixel 60 times a second would probably not perform well.

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Suggestion]Random in recolorUnitSprite
« Reply #2 on: March 22, 2020, 10:41:20 am »
Just guessing... but running RNG on every pixel 60 times a second would probably not perform well.
Then it is... err, how to write it on english... shortly, lets think that i never asked this question. :)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Suggestion]Random in recolorUnitSprite
« Reply #3 on: March 22, 2020, 12:44:25 pm »
Random would work fine (most overhead would be function calls), there is bigger problem, game state would be not deterministic if w used main random sequence for that.

Right now there is workaround, you can mix animation frame with unit id to get some unique value, based on it you can fake RNG.
If this is not enough, I already added some new functionality to to scripts to access custom RNG generators that can be separated from game state and safe to altering game state.