5 ms·
Show HN: Fireplace, a Hearthstone Simulator
- scrollaway 12y agoOver the past few months, I've been hard at work on a simulator for the Hearthstone game by Blizzard. This turned into a full-blown reimplementation of the game logic pretty fast. As it turns out, working on this has been the most enlightening and rewarding experience I've ever had in programming. Hearthstone is a very well designed game with very few hacks (much unlike other Blizzard games) and extremely logical rules it has a lot of respect for. Working on this, more than anything else, has been the most fun I've ever had working on a project. While it is still incomplete, I'm hoping it is of interest to someone as I would love to welcome others to the project. I'm available to answer any questions about it or the Hearthstone's internal design. Edit: For those looking for an entry point to what this all looks like, since this is very much programmer-oriented for now, the docs I wrote on the wiki (https://github.com/jleclanche/fireplace/wiki https://github.com/jleclanche/fireplace/wiki) and the tests (https://github.com/jleclanche/fireplace/blob/master/tests/test_main.py https://github.com/jleclanche/fireplace/blob/master/tests/te...) are the best ones.
- TillE 12y agoIs the end goal to implement AIs and try to come up with interesting decks via something like genetic algorithms? Because that does sound like a fun project.
- scrollaway 12y agoThere's a lot of end goals! This is something that did cross my mind, yes. I think Fireplace is more of an enabler for this kind of thing. Writing an AI that would directly interact with it would be easy and I'm also posting here so that if anyone has a cool idea for something they want to do with it can poke me and I'll accomodate!
- forrestthewoods 12y agoAwesome. I've always wanted to do exactly but like you said, it's a full reimplementation!
- dsjoerg 12y agoVery cool! Have you looked into the legal issues, for example ToS and copyright? I wonder if Blizzard would be within their rights to force a takedown of the code whenever they want.
- TillE 12y agoCard names and text would be covered by copyright, but that's really unlikely to escalate beyond a DMCA takedown at worst, and Blizzard is more likely to just ignore it, as they do with the handful of Hearthstone wikis (which also include copyrighted art). Game mechanics are almost never copyrightable, so you could come up with aliases for the cards and be 100% in the clear.
- scrollaway 12y agoI have, to an extent. I've been working with Blizzard games for almost ten years (I worked on reverse engineering in WoW before), and Blizzard tends to be very cautious with this sort of projects. In this case, it would be relatively easy to implement a server on top of Fireplace which would communicate with a slightly modified Hearthstone client. This would be a huge no-no for Blizzard and they would try their best to shut it down, so I'm not doing that. You'll also note that the game files I am reusing in fireplace are actually in a separate repo (hearthstone-data submodule) so that I can take it down separately, should Blizzard request it. Edit: Part of me also hopes that Team 5, the team behind Hearthstone, is a bit different. They have been incredibly close to the community, much closer than Blizzard has with other games, and I'm hoping that if issues arise, we can work them out peacefully.
- jzelinskie 12y ago>In this case, it would be relatively easy to implement a server on top of Fireplace which would communicate with a slightly modified Hearthstone client. This would be a huge no-no for Blizzard and they would try their best to shut it down, so I'm not doing that. Besides doing something like this, how else would you go about testing this kind of thing?
- 12y ago
- jc4p 12y agoThis is awesome dude. I actually found it via your hearthstone-data repo yesterday since I'm working on a related application (obj-c app to screen-capture arena and tell me which card I should draft), I'm excited to play around with this.
- scrollaway 12y agoThanks! Ping me on github if you need anything.
- 147 12y agoCould you document the rules of the game somewhere? Blizzard doesn't make it clear. I was going to embark on a simulator just like this, except I had a hard time figuring out the weird interactions and edge cases. For instance, I just played a game last night where there was an enemy mad scientist on the board. I play a madder bomber and it kills it, playing a secret for the mage, which turned out to be mirror entity, proccing that secret, and the board was left with me and him having a madder bomber. I wanted to make AI for hearthstone to test and simulate things, but these weird interactions was preventing me from making a simulator like this.
- rtpg 12y agoso one thing is that battlecries trigger before the "summon" effect, and it's a stack, so you do one effect, resolve those consequences, and then go to the next effect. In the case of multiple effects being added due to one effect, it goes by seniority (cards that have been on the board longer trigger first). There's a decent amount of noted rules on it, but you get some strange things like Kel'Thuzad ( which was completely borked on release, not sure about it now). I think the general rule is "the code is the spec"
- 147 12y agoRight. The problem with Kel'Thuzad is that they changed some interactions to fix bugs and they don't really tell you.
- scrollaway 12y agoBattlecries happening before the summon is a popular opinion but I have strong reasons to believe it's wrong. However, I wrote above the series of events that leads to the CARD_PLAYED event to happen after the Mad Scientist is dead, so Mirror Entity indeed summons the copy after the battlecry has happened. So basically, battlecries in this case have precendence over secrets so to say. But the minion is already on the field. This is important because, say you had a Cult Master that ALSO had a "deal 1 damage" battlecry and you played it, killing one of your own minions with it: it would see the death, as it is already on the field. Regarding Kel Thuzad, we're again talking about ordering issues. What could have happened is something such as the aura/internal tag it was setting disappearing a tad too late after its death as during end of turn, if killed by an END_TURN effect, the aura would trigger before it disappears. But all of this is extremely internal. If the designers believe it's a bug, then it's a bug. That's why I'm not touching Warsong Commander yet. :)
- seanalltogether 12y agoOne immediate idea that comes to mind is the ability to create and share quick puzzle games for other HS players. You could define parameters like "clear the board", "find lethal", "minion x must survive", etc... Some players have already been trying to make them by hobbling together screenshots, but they're not as effective.
- aiiane 12y agoThis is cool. I only wish it didn't require quite so cutting-edge Python features; a lot of systems are still running a bit behind Python 3.4, even if they're running Python 3. :)
- scrollaway 12y agoYeah, I understand. This was a project for myself mostly and I needed IntEnums so I decided to just go with it. On the other hand, it has zero other dependency than python (with an optional dependency on pytest for better test output).