Author Topic: How are game generated turret appearances done?  (Read 194 times)

FuryoftheStars

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    283
    • View Profile
on: January 31, 2020, 10:22:39 PM
I think this is more a question for the devs, but if anyone else happens to know this....

I'm working on a mod that, among other things, will hopefully allow a player to pick the look of their turret at turret factories.  IE, they can pick the seed that's used.

In looking into this, I see in weapongenerator.lua where weapon.appearenceSeed is set to a random signed 32 bit integer.  So, that's over 4 billion possibilities.

I'd really rather not have users scrolling through 4 billion + possible numbers and I'm guessing (though I could certainly be wrong!) that the game won't actually generate 4 billion + unique weapon designs for each weapon type.

My question here is, assuming the above is true, could the devs, or anyone else who's experimented with this and gained some knowledge, share some of the inner workings here?  Specifically, my assumption here is that there is a function/formula in the core of the game that takes this appearenceSeed value and is somehow pairing it down to the actual number of unique weapon designs that the game can do.  If this could be shared, it'd allow me to limit the user to only going through 0 - x (being the limit of the weapon designs the game does), and then I can set the needed value to appearenceSeed that would generate this.

I hope that makes sense.  :-\

Thank you!
« Last Edit: February 01, 2020, 12:48:38 AM by FuryoftheStars »



KaneNOD

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    19
    • View Profile
on: February 01, 2020, 12:43:55 AM
Hello, i'm the creator of High Efficiency Turrets mod (HET) and I use this line to show to me what is the seed of a turret. After a large amount of tests I chose some numbers that represent a execly turret design and save it. So all weapons will have that design.

Code: [Select]
-- use this line to get the right seed of a weapon.
-- print(string.format("(HET) [weaponName] seed: %d", weapon.appearanceSeed))



FuryoftheStars

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    283
    • View Profile
on: February 01, 2020, 12:47:56 AM
Yup, I got that in there now. It’s how I confirmed that they had such a large range of seed values.

Just hoping to get something more definitive so I’m not wasting a lot of time trying or recording different values. With me, there’d be a high chance of me missing a few, too.  :P



KaneNOD

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    19
    • View Profile
on: February 01, 2020, 12:51:35 AM
Seed are created by hardcode side. So we can't do nothing better..



FuryoftheStars

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    283
    • View Profile
on: February 01, 2020, 12:53:45 AM
Well, if they share how they use that value core side, then we can use that to figure out all valid combinations.

Edit: Should say, rather than all valid combinations, all unique combinations.  If they had a simple formula they could share (not sure if it is that simple... hoping), then that'd solve everything. :)
« Last Edit: February 01, 2020, 01:06:00 AM by FuryoftheStars »