-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More gas efficient #84
Comments
(based on optimization of 1) 2. Caching run-time piece attributes
There was a time when Based on the optimization of
And this optimization is also compatible with our implementation of |
automatic attack strategy of pieceThis is the current strategy used by all pieces:
In every turn, for each piece, it will try to attack every enemy piece, calculate the exact damage value it can caused and find the best action to do. It turns out that heroes with less armor will always be focused by enemy. On the one hand, it's not the same strategy of hero in traditional auto-chess game. It's a little bit too intelligent and might lead to a situation where no player buy Mage whose armor is usually less than Warrior. On the other hand, this stragety will become more gas-consuming when we implement effect feature. Because we must additionally consider the effects applied to the piece in turn and effects applied to all it's enemies. It's too complexe to maintain. So we're thinking to implement a much simpler strategy, like pieces would only try to attack the frontmost enemy. This will make various hero lineups be meaningful. |
close #134 |
Where we might be wasting gas
1. Constructing a piece from a hero of tier 1/2
This is how we do now:
Creature
table. This costs1 slot
. (despite ofCreature.uri
)CreatureConfig
table.Creature.health
,Creature.attack
andCreature.defense
.uint16
.3 (slots) = 1 + 1 + 1
.So we spend
4 slots
in total for constructing a piece of tier 1/2. And it should be clear that this job is done at the first turn of each round. So since aCreature
can be packed tightly and stored in one slot, why not store any hero of tier 1/2 in the same way as hero of tier 0. Then we will save3 slots
for every players in every round.Obviously this optimization is feasible and quiet worth doing. Further more, we can integrate tier info into index of
Creature
. One suggestion is: (max_tier=255
andmax_creature_num=255
)Besides,
Creature.uri
is not used in any game playing. And heroes with same creature index but different tier share the sameuri
. So we can create a new table to only storeuri
.The text was updated successfully, but these errors were encountered: