Compress unit statistics #107
ponderingdemocritus
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
This wouldn't save anything though. Even with all the properties (type, tier, agility, attack, defense, vitality, wisdom), one Troop is packed into a single felt. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ah, right, but it would help when packing them into a If a Troop's stats don't change, we can store only the ID and vitality and hardcode the rest (type, tier, agility, attack, defense, wisdom). Then, instead of needing 7 felts for the whole |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Proposition to reduce the storage cost of units. We want to minimize all storage where possible.
Currently, troops are being packed into felts. This includes their agility, defense, and wisdom.
` func unpack_troop{range_check_ptr}(packed : felt) -> (t : Troop):
let (r0, type) = unsigned_div_rem(packed, SHIFT)
let (r1, tier) = unsigned_div_rem(r0, SHIFT)
let (r2, agility) = unsigned_div_rem(r1, SHIFT)
let (r3, attack) = unsigned_div_rem(r2, SHIFT)
let (r4, defense) = unsigned_div_rem(r3, SHIFT)
let (wisdom, vitality) = unsigned_div_rem(r4, SHIFT)
`
Within this function instead of unpacking a troop from the felt storage. Why don't we only store the type, tier, and the vitality, then on unpacking just compute the agility, defense, and wisdom from stored values?
Agility, defense, and wisdom -> These do not change, we can store on space by just calling these when we need to.
This would also allow balance tweaking if units have been built, as the actual value is computed on combat, and not stored statically within the squad.
@milancermak thoughts?
Beta Was this translation helpful? Give feedback.
All reactions