Skip to content
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

Need to store (un)enchanted states? #5

Closed
peter1591 opened this issue Nov 23, 2016 · 6 comments
Closed

Need to store (un)enchanted states? #5

peter1591 opened this issue Nov 23, 2016 · 6 comments

Comments

@peter1591
Copy link
Owner

Need to store (un)enchanted states in entity?

Or, when we need to update/re-calculate enchanted states, we...

  1. Load the raw card information from database
  2. If the minion is silenced, add a 'SILENCED' enchantment
    --> which remove divine-shield / charge / spell damage / etc.
  3. Apply all enchantments
@peter1591
Copy link
Owner Author

But, when we need to re-calculate the enchanted states
--- which is a very often operation in game flow ---
we need to grab the original states from database

WHAT'S IMPORTANT IS...
If we're disconnected and then reconnected,
the game log contains only the current states.

That is, we have no idea what enchantments yield the current states.
In this situation, a fallback method might be

  1. Use the current state as the Base states
  2. Enchantments applied after this moment will be applied as usual
    In this way, we can guarantee the re-calculation will be correct.

Even, we can deal with silence, as long as we load the base states from the database.

So, we might need to store un-enchanted states in entity.

BTW, this comes with a price.

  • The game state has a larger memory footprint.

@peter1591
Copy link
Owner Author

Yes, we should store unenchanted states. So we can do enchantment re-calculation for aura-update phase.

@peter1591
Copy link
Owner Author

For the base stats, we could

  • reload them from card database
    --> Since card database is designed as a raw array, which supports fast access to card's raw data

For the enchantment recalculation issue when parsing from log, we could...

  1. The base states are fetched from card database
  2. Add aura minions normally
  3. Let the game engine resolve the board
  4. Compare the differences of the resolved board and the log-parsed board
  5. Add a special enchantment which counters the differences

Now, we should have a consistency states.

@peter1591 peter1591 reopened this Dec 2, 2016
@peter1591
Copy link
Owner Author

Fixed in commit: 6a48407

@peter1591
Copy link
Owner Author

Some fields (e.g., owner, a.k.a. controller, player) does not resides in card database

So we still need to store the original states in entity

@peter1591 peter1591 reopened this Dec 14, 2016
@peter1591
Copy link
Owner Author

Fixed in commit: fc9d27f

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

No branches or pull requests

1 participant