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

Parallel Project #1

Open
danielyule opened this issue Jul 11, 2014 · 7 comments
Open

Parallel Project #1

danielyule opened this issue Jul 11, 2014 · 7 comments

Comments

@danielyule
Copy link

Hi!

I'm working on a very similar project to this one, over at https://github.com/danielyule/hearthstone-simulator. Ours is written in Python, but has an almost identical focus. Obviously, there's enough room for two simulators, written in different languages, but I think it makes sense to coordinate, for example in any exporting or importing format.

Java might be really useful, since both HearthStats and Hearthtracker are written in that language. I chose Python because I wanted to use SciPy for my analysis out the other side.

If you're interested in working together, let me know. We've got a mailing list at https://groups.google.com/forum/#!forum/hearthstone-simulator-dev, or you can shoot me an email at [email protected].

@oyachai
Copy link
Owner

oyachai commented Jul 11, 2014

Hi! Thanks for letting me know about your project! It looks like a good project and I'd love to collaborate on things going forward.

@Kallin
Copy link
Contributor

Kallin commented Aug 25, 2014

One thing we could consider doing is extracting all the card data into a 3rd party project. At one point I was playing with building LUA based cards w/ a reference Java implementation but didn't get too far, https://github.com/Kallin/hearth4j/tree/master/src/main/resources/org/hearth4j/lua. The overheard of keeping up with card changes over time will be challenging, and having both teams contribute to the same codebase for that component would be awesome.

@danielyule
Copy link
Author

There's a project called Focus which has a JSON based description of all Hearthstone cards. You can see it at http://fluiddruid.net/forum/viewtopic.php?f=7&t=4808.

The goal of the project I linked above (now called Hearthbreaker) is to be what you mention. It's a now complete implementation of all the cards. I think both HearthSim and Focus are built around a particular modeling ideology (oyachai can correct me if I am wrong), whereas Hearthbreaker was designed from the start to be agnostic, and easily embedded in other systems.

The issue is the same as any, where it's more trouble than it's worth to make applications written in different languages work together directly. I think standards (such as Focus's JSON implementation, or the serialization format being worked on for Hearthbreaker) will allow for interoperability. I plan to support the Focus JSON format, to allow for custom cards.

@Kallin
Copy link
Contributor

Kallin commented Aug 29, 2014

That Focus project looks really cool, but I wonder what the JSON schema will have to look like to support every possible card mechanic. You'll end up with a lot of identifiers for which you'll have to re-implement in your logic. If the cards were all written in Lua or Python or something that could be easily digested by any major language it might require a lot less work to integrate.

@jleclanche
Copy link

@danielyule Funny that; I just found your project. I knew about HearthSim but not HearthBreaker.

I've been working on a Python HS simulator myself. It is still at a very rough stage though:
https://github.com/jleclanche/fireplace

One of my main focus points is reusing the actual game's XML card format and not have to implement too much myself so it's partly a reverse engineering project as well. I am also planning to add a clojure API and/or core to it so that cards can be defined in Clojure files, similarly to @mischanix's soot.

Take a look if you wish, let me know if you have any question. My email is on my profile.

@jleclanche
Copy link

@danielyule @Kallin @oyachai

A quick update on fireplace after exchanging some emails as well.
I've been looking through the game's internals and am starting to more and more faithfully simulate it.

A very insightful talk is in the GDC Vault about the game's internals. The gist of it is that the game is implemented on two principles: Rules and Tags. Tags are a basic-ish key/value (and param) store, rules declare what happens and how (and cards can break rules). Everything is an Entity and Entities have tags. Turn time, health, frozen, has-attacked-this-turn, all of these are tags.

I am slowly reimplementing some of my mechanics using a similar tag system (example in jleclanche/fireplace@574b507).
Incidentally this falls quite nicely into my design reusing the CardXML because it means that, instead of having to set the max health and so on, I can just keep the tags as is when I summon the minion.

@jleclanche
Copy link

Cards themselves are very terse and fast to implement once the rules are in place. I even have a few helpers for common actions. For example, "destroy target" is the same action whether it comes from assassinate, big game hunter or shadow word pain. They simply have different play requirements.

A few examples below:

As you can see, for example in backstab, I don't have to implement an erroring logic for damaged minions - Not only is it already implemented in the card's PlayRequirements, but also that would be wrong (eg. execute into spellbender would break).

My next big step is implementing game ticks. Not completely sure on how to architecture them quite yet but I see them as a form of atomic transaction: The contents of a tick are guaranteed to happen when the tick is complete. "Ragnaros hits Gruul for 8 AND Gruul gains 1/1. This happens at the same time so the result is 9/1".

My TODO list is still fairly big, available here

oyachai pushed a commit that referenced this issue Jun 16, 2015
oyachai pushed a commit that referenced this issue Aug 29, 2015
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

4 participants