yangyuan / hearthrock

Hearthstone® Bot Engine
https://yangyuan.github.io/hearthrock/
MIT License
259 stars 68 forks source link

Unable to make v0.4.2 work #8

Closed kaue closed 7 years ago

kaue commented 7 years ago

I am trying to test the last release with the Node.js example

Its running the example app at localhost:7625 and i configured Trace + Bot config to Local. But everytime i click Patch nothing happens

Also, how the Logging works?

Thanks.

yangyuan commented 7 years ago

Patch will only patch hearthrock. U need to click "SyncConfiguration" to save configurations.

kaue commented 7 years ago

@yangyuan Thanks for the help!

I was able to make Hearthrock run.

But i got this issue after the bot played the Primordial Gliph as Mage, the bot just got stuck in the discover spell selection.

[Verbose]: {"Self":{"Resources":0,"PowerAvailable":true,"HasWeapon":false,"Hero":{"RockId":66,"Name":"Jaina Proudmoore","CardId":"HERO_08","Class":1,"Damage":0,"Health":30,"CanAttack":true,"IsExhausted":false},"Power":{"RockId":67,"Name":"Fireblast","CardId":"CS2_034","Damage":0,"Health":0,"CardType":0,"Cost":2,"HasTaunt":false,"HasCharge":false,"Options":[]},"Weapon":null,"Minions":[],"Cards":[{"RockId":46,"Name":"Sorcerer's Apprentice","CardId":"EX1_608","Damage":3,"Health":2,"CardType":4,"Cost":2,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":39,"Name":"Arcanologist","CardId":"UNG_020","Damage":2,"Health":3,"CardType":4,"Cost":2,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":63,"Name":"Cabalist's Tome","CardId":"OG_090","Damage":0,"Health":0,"CardType":1,"Cost":5,"HasTaunt":false,"HasCharge":false,"Options":[]}]},"Opponent":{"Resources":1,"PowerAvailable":true,"HasWeapon":false,"Hero":{"RockId":64,"Name":"Jaina Proudmoore","CardId":"HERO_08","Class":1,"Damage":0,"Health":30,"CanAttack":true,"IsExhausted":false},"Power":{"RockId":65,"Name":"Fireblast","CardId":"CS2_034","Damage":0,"Health":0,"CardType":0,"Cost":2,"HasTaunt":false,"HasCharge":false,"Options":[]},"Weapon":null,"Minions":[],"Cards":[{"RockId":15,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":12,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":33,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":25,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":68,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":29,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]}]},"PlayOptions":[]} [Error]: System.NullReferenceException: Object reference not set to an instance of an object at Hearthrock.Communication.RockJsonSerializer.ConvertToType (System.Object obj, System.Type type) [0x00000] in <filename unknown>:0 at Hearthrock.Communication.RockJsonSerializer.Deserialize[List1] (System.String json) [0x00000] in :0 at Hearthrock.Communication.RockApiClient.Post[List1] (System.String endpoint, System.Object obj) [0x00000] in <filename unknown>:0 at Hearthrock.Engine.RockEngineBot.GetPlayAction (Hearthrock.Contracts.RockScene scene) [0x00000] in <filename unknown>:0 at Hearthrock.Engine.RockEngine.OnRockAction () [0x00000] in <filename unknown>:0 at Hearthrock.Engine.RockEngine.OnRockGamePlay () [0x00000] in <filename unknown>:0 at Hearthrock.Engine.RockEngine.Update () [0x00000] in <filename unknown>:0 [Verbose]: {"Self":{"Resources":0,"PowerAvailable":true,"HasWeapon":false,"Hero":{"RockId":66,"Name":"Jaina Proudmoore","CardId":"HERO_08","Class":1,"Damage":0,"Health":30,"CanAttack":true,"IsExhausted":false},"Power":{"RockId":67,"Name":"Fireblast","CardId":"CS2_034","Damage":0,"Health":0,"CardType":0,"Cost":2,"HasTaunt":false,"HasCharge":false,"Options":[]},"Weapon":null,"Minions":[],"Cards":[{"RockId":46,"Name":"Sorcerer's Apprentice","CardId":"EX1_608","Damage":3,"Health":2,"CardType":4,"Cost":2,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":39,"Name":"Arcanologist","CardId":"UNG_020","Damage":2,"Health":3,"CardType":4,"Cost":2,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":63,"Name":"Cabalist's Tome","CardId":"OG_090","Damage":0,"Health":0,"CardType":1,"Cost":5,"HasTaunt":false,"HasCharge":false,"Options":[]}]},"Opponent":{"Resources":1,"PowerAvailable":true,"HasWeapon":false,"Hero":{"RockId":64,"Name":"Jaina Proudmoore","CardId":"HERO_08","Class":1,"Damage":0,"Health":30,"CanAttack":true,"IsExhausted":false},"Power":{"RockId":65,"Name":"Fireblast","CardId":"CS2_034","Damage":0,"Health":0,"CardType":0,"Cost":2,"HasTaunt":false,"HasCharge":false,"Options":[]},"Weapon":null,"Minions":[],"Cards":[{"RockId":15,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":12,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":33,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":25,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":68,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]},{"RockId":29,"Name":"UNKNOWN ENTITY [cardType=INVALID]","CardId":"","Damage":0,"Health":0,"CardType":0,"Cost":0,"HasTaunt":false,"HasCharge":false,"Options":[]}]},"PlayOptions":[]} [Error]: System.NullReferenceException: Object reference not set to an instance of an object at Hearthrock.Communication.RockJsonSerializer.ConvertToType (System.Object obj, System.Type type) [0x00000] in <filename unknown>:0 at Hearthrock.Communication.RockJsonSerializer.Deserialize[List1] (System.String json) [0x00000] in :0 at Hearthrock.Communication.RockApiClient.Post[List1] (System.String endpoint, System.Object obj) [0x00000] in <filename unknown>:0 at Hearthrock.Engine.RockEngineBot.GetPlayAction (Hearthrock.Contracts.RockScene scene) [0x00000] in <filename unknown>:0 at Hearthrock.Engine.RockEngine.OnRockAction () [0x00000] in <filename unknown>:0 at Hearthrock.Engine.RockEngine.OnRockGamePlay () [0x00000] in <filename unknown>:0 at Hearthrock.Engine.RockEngine.Update () [0x00000] in <filename unknown>:0

yangyuan commented 7 years ago

I noticed that PlayOptions is empty, which means the Bot should return null. But the return value of the bot cannot be deserialized.

And I will close this ticket soon. One ticket should only about one issue.

yangyuan commented 7 years ago

Should be fixed now https://github.com/yangyuan/hearthrock/commit/c505b4ea953e942179f81d45fb57045b6ae5756d

kaue commented 7 years ago

@yangyuan Thanks!

Can you add a release for v0.4.3?

Also, i have a question about the Node.js Example. I added a console.log(request.url) at this line https://github.com/yangyuan/hearthrock/blob/master/examples/node.js/base/service.js#L41 But it never gets printed, also RockTrace.get_mulligan_action does not get called, maybe its because its using the builtin trace / bot?

yangyuan commented 7 years ago

There are some experimental code between 0.4.2 and this fix, so I prefer to not to release a new version right now.

Builtin Bot/Trace will not contact with anything outside Hearthrock and Hearthstone. The builtin bot is the C# bot code in here https://github.com/yangyuan/hearthrock/tree/master/src/Hearthrock.Bot And the trace output will be in Hearthstone\Hearthstone_Data\output_log.txt

U can try "Local", which will use http://127.0.0.1:7625 as Bot/Trace

kaue commented 7 years ago

@yangyuan No problem, i will wait for the next release.

I was able to debug the Node.js example using the Local config!

You plan to implement the discover feature in the api? Everytime the bot hits a discover card the service returns 0 PlayOptions.

Maybe return the cards ids in the PlayOptions and include the discover cards in the scene.Discover?

yangyuan commented 7 years ago

If u look at the code, actually I didn't do any special for "discover feature". Hearthstone, itself, should handle these discover options well.

I will create an issue/task for investigating this.