Git Product home page Git Product logo

Comments (6)

peter1591 avatar peter1591 commented on May 18, 2024

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.

from hearthstone-ai.

peter1591 avatar peter1591 commented on May 18, 2024

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

from hearthstone-ai.

peter1591 avatar peter1591 commented on May 18, 2024

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.

from hearthstone-ai.

peter1591 avatar peter1591 commented on May 18, 2024

Fixed in commit: 6a48407

from hearthstone-ai.

peter1591 avatar peter1591 commented on May 18, 2024

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

from hearthstone-ai.

peter1591 avatar peter1591 commented on May 18, 2024

Fixed in commit: fc9d27f

from hearthstone-ai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.