hectorgimenez / koolo

Diablo II Resurrected bot written in Go
MIT License
67 stars 38 forks source link

Koolo closes when first game loads #225

Closed divineblade7 closed 2 months ago

divineblade7 commented 2 months ago

commit: 7c63e7052f269322f7638d39bcf76d485167d08a

Loads game and koolo cloeses almost instantly after creating game.

Used same config as prior build e0840d6eb2ec1cc4dbb2711717422fd223d1febe with pathing changes that worked.

Also started fresh and re-set it up again from scratch.

same symptoms. log only shows:

time=21:27:47 level=INFO msg="Character selection screen found"
time=21:27:47 level=INFO msg="Selecting character..."
time=21:27:48 level=INFO msg="Character found"
time=21:27:53 level=DEBUG msg="Fetching map data..." 

However using the same koolo.yaml on commit: e0840d6eb2ec1cc4dbb2711717422fd223d1febe still works just fine.

divineblade7 commented 2 months ago

checked out commit https://github.com/hectorgimenez/koolo/commit/e0840d6eb2ec1cc4dbb2711717422fd223d1febe again and rebuilt to ensure that version still works. it did.

I am unsure why the commits after will not work, but i'm curious if anyone else is running into that issue as well.

divineblade7 commented 2 months ago

Pulled latest commit 388470ac32c0df8f4940d9f99c5e3a9dcba067c6

Koolo still closes as soon as it makes the first game.

log doesnt show fetching map data this time. only has this:

time=15:56:02 level=INFO msg="Waiting for character selection screen..."
time=15:56:23 level=INFO msg="Character selection screen found"
time=15:56:23 level=INFO msg="Selecting character..."
time=15:56:25 level=INFO msg="Character found"
hectorgimenez commented 2 months ago

@divineblade7 try again with latest commit, I think now you will be able to see the error message properly 🤞

divineblade7 commented 2 months ago

Thanks for checking into this @hectorgimenez

I pulled commit: e371613abb3f3335ae88f0a74bb9b861cfa04667 its the same result as commit 388470a error log doesnt seem to get to that additional log info before koolo closes.

time=16:46:01 level=INFO msg="Waiting for character selection screen..."
time=16:46:28 level=INFO msg="Character selection screen found"
time=16:46:28 level=INFO msg="Selecting character..."
time=16:46:30 level=INFO msg="Character found"

the commit i tried before that https://github.com/hectorgimenez/koolo/commit/e0840d6eb2ec1cc4dbb2711717422fd223d1febe had the additional line of msg="Fetching map data..."

hectorgimenez commented 2 months ago

Weird... nothing changed regarding that part. Could you please try with a fresh config?

divineblade7 commented 2 months ago

Yea strange indeed. I started from scratch with pulling latest again, and set up everything fresh.

No change though. Still closing once in game. Log still shows the same.

From all the commits i tried, it starts doing this at commit: 19edf5f9f1996812c09583f4daefebea85d9e038 and onward.

I looked through in the bug fix commit, and nothing stands out for me as far as changes why its doing this, but is any of the changes looking for anything in a specific format such as calculating mapseed based off date or anything? im using a US layout and my computer has date formatted MM-DD-YYYY. I doubt that would be causing an issue but its one of the only things i can think of at this point.

hectorgimenez commented 2 months ago

Is koolo closing when this happens?

divineblade7 commented 2 months ago

Is koolo closing when this happens?

Yes it closes as soon as it loads the first game.

hectorgimenez commented 2 months ago

try with the latest commit, it will not fix your problem but hopefully will log more information into the logs (now it should not crash the entire koolo, just current running supervisor)

divineblade7 commented 2 months ago

Ok i pulled commit: a051d8359ae6e9391a3925611da94612d5f87827

Just the supervisor crashed like you said. Here is the new log from that.


time=09:16:42 level=INFO msg="Waiting for character selection screen..."
time=09:17:02 level=INFO msg="Character selection screen found"
time=09:17:02 level=INFO msg="Selecting character..."
time=09:17:04 level=INFO msg="Character found"
time=09:17:10 level=ERROR msg="fatal error detected, forcing shutdown" supervisor=Doom error="runtime error: index out of range [4] with length 4" stacktrace="goroutine 68 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngithub.com/hectorgimenez/koolo/internal.(*SupervisorManager).Start.func2.1()\n\tgithub.com/hectorgimenez/koolo/internal/manager.go:76 +0x108\npanic({0x1235f20?, 0xc000128e88?})\n\truntime/panic.go:770 +0x132\ngithub.com/hectorgimenez/d2go/pkg/memory.(*GameReader).Inventory(0xc00046e808, {0xc0000cc008, 0xa, 0x16?}, {0x20?, 0x1e0861d0090?, 0xc0008829a8?})\n\tgithub.com/hectorgimenez/d2go@v0.0.0-20240515082353-2a5f31885e1e/pkg/memory/item.go:37 +0x122b\ngithub.com/hectorgimenez/d2go/pkg/memory.(*GameReader).GetData(_)\n\tgithub.com/hectorgimenez/d2go@v0.0.0-20240515082353-2a5f31885e1e/pkg/memory/game_reader.go:52 +0x55d\ngithub.com/hectorgimenez/koolo/internal/game.(*MemoryReader).GetData(_, _)\n\tgithub.com/hectorgimenez/koolo/internal/game/memory_reader.go:64 +0x56\ngithub.com/hectorgimenez/koolo/internal/run.(*Factory).BuildRuns(0xc0001400a0)\n\tgithub.com/hectorgimenez/koolo/internal/run/run.go:44 +0x3e\ngithub.com/hectorgimenez/koolo/internal.(*SinglePlayerSupervisor).Start(0xc000394968)\n\tgithub.com/hectorgimenez/koolo/internal/single_supervisor.go:63 +0x185\ngithub.com/hectorgimenez/koolo/internal.(*SupervisorManager).Start.func2()\n\tgithub.com/hectorgimenez/koolo/internal/manager.go:82 +0xa2\ncreated by github.com/hectorgimenez/koolo/internal.(*SupervisorManager).Start in goroutine 14\n\tgithub.com/hectorgimenez/koolo/internal/manager.go:69 +0x21d\n"
time=09:17:10 level=INFO msg=Stopping... configuration=Doom
time=09:17:10 level=INFO msg="Finished stopping" configuration=Doom 
hectorgimenez commented 2 months ago

Please try again with latest main

divineblade7 commented 2 months ago

Thank you sir. i just tested commit: e853fec0c5b162eaa010b809cf7eb0ac3930c08f Supervisor crashed once entering game. The error log is below. koolo-log-2024-05-19-22-33-44.txt koolo error

I also attached the problem tab from VS code in case any of this may help indicate the issue.

Thank you again for looking into this.

time=22:33:52 level=INFO msg="Waiting for character selection screen..."
time=22:34:19 level=INFO msg="Character selection screen found"
time=22:34:19 level=INFO msg="Selecting character..."
time=22:34:21 level=INFO msg="Character found"
time=22:34:27 level=ERROR msg="fatal error detected, forcing shutdown" supervisor=Doom error="runtime error: index out of range [4] with length 4" stacktrace="goroutine 58 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngithub.com/hectorgimenez/koolo/internal.(*SupervisorManager).Start.func2.1()\n\tgithub.com/hectorgimenez/koolo/internal/manager.go:76 +0x108\npanic({0x15c5040?, 0xc000124690?})\n\truntime/panic.go:770 +0x132\ngithub.com/hectorgimenez/d2go/pkg/memory.(*GameReader).Inventory(0xc00055a808, {0xc000304008, 0xa, 0x16?}, {0x20?, 0x256a9e3ec00?, 0xc0006199e8?})\n\tgithub.com/hectorgimenez/d2go@v0.0.0-20240519114543-079df7a6acb0/pkg/memory/item.go:40 +0x1297\ngithub.com/hectorgimenez/d2go/pkg/memory.(*GameReader).GetData(_)\n\tgithub.com/hectorgimenez/d2go@v0.0.0-20240519114543-079df7a6acb0/pkg/memory/game_reader.go:52 +0x55d\ngithub.com/hectorgimenez/koolo/internal/game.(*MemoryReader).GetData(_, _)\n\tgithub.com/hectorgimenez/koolo/internal/game/memory_reader.go:64 +0x56\ngithub.com/hectorgimenez/koolo/internal/run.(*Factory).BuildRuns(0xc00013e0a0)\n\tgithub.com/hectorgimenez/koolo/internal/run/run.go:44 +0x3e\ngithub.com/hectorgimenez/koolo/internal.(*SinglePlayerSupervisor).Start(0xc0004bc018)\n\tgithub.com/hectorgimenez/koolo/internal/single_supervisor.go:63 +0x185\ngithub.com/hectorgimenez/koolo/internal.(*SupervisorManager).Start.func2()\n\tgithub.com/hectorgimenez/koolo/internal/manager.go:82 +0xa2\ncreated by github.com/hectorgimenez/koolo/internal.(*SupervisorManager).Start in goroutine 9\n\tgithub.com/hectorgimenez/koolo/internal/manager.go:69 +0x21d\n"
time=22:34:27 level=INFO msg=Stopping... configuration=Doom
time=22:34:27 level=INFO msg="Finished stopping" configuration=Doom
time=22:34:39 level=INFO msg="Koolo shutting down..."
hectorgimenez commented 2 months ago

mmm I think something went wrong during your building? look like you don't have the latest d2go changes, maybe try to run the go mod download command before building. Also pull latest changes from main

divineblade7 commented 2 months ago

ok i pulled the latest commit, and ran the go mod download command as well. image

it shows its downloading the proper d2go version from go.mod when building as well.

Here is the log from it as well.


time=07:07:57 level=INFO msg="Waiting for character selection screen..."
time=07:08:23 level=INFO msg="Character selection screen found"
time=07:08:23 level=INFO msg="Selecting character..."
time=07:08:25 level=INFO msg="Character found"
time=07:08:31 level=ERROR msg="fatal error detected, forcing shutdown" supervisor=Doom error="runtime error: index out of range [4] with length 4" stacktrace="goroutine 25 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngithub.com/hectorgimenez/koolo/internal.(*SupervisorManager).Start.func2.1()\n\tgithub.com/hectorgimenez/koolo/internal/manager.go:76 +0x108\npanic({0x895040?, 0xc000cea9a8?})\n\truntime/panic.go:770 +0x132\ngithub.com/hectorgimenez/d2go/pkg/memory.(*GameReader).Inventory(0xc000bec808, {0xc000288a88, 0xa, 0x16?}, {0x20?, 0x14308072f30?, 0xc000e24808?})\n\tgithub.com/hectorgimenez/d2go@v0.0.0-20240520122915-52bb744b9b60/pkg/memory/item.go:40 +0x1257\ngithub.com/hectorgimenez/d2go/pkg/memory.(*GameReader).GetData(_)\n\tgithub.com/hectorgimenez/d2go@v0.0.0-20240520122915-52bb744b9b60/pkg/memory/game_reader.go:52 +0x55d\ngithub.com/hectorgimenez/koolo/internal/game.(*MemoryReader).GetData(_, _)\n\tgithub.com/hectorgimenez/koolo/internal/game/memory_reader.go:65 +0x56\ngithub.com/hectorgimenez/koolo/internal/run.(*Factory).BuildRuns(0xc0001420a0)\n\tgithub.com/hectorgimenez/koolo/internal/run/run.go:44 +0x3e\ngithub.com/hectorgimenez/koolo/internal.(*SinglePlayerSupervisor).Start(0xc000b82008)\n\tgithub.com/hectorgimenez/koolo/internal/single_supervisor.go:63 +0x185\ngithub.com/hectorgimenez/koolo/internal.(*SupervisorManager).Start.func2()\n\tgithub.com/hectorgimenez/koolo/internal/manager.go:82 +0xa2\ncreated by github.com/hectorgimenez/koolo/internal.(*SupervisorManager).Start in goroutine 6\n\tgithub.com/hectorgimenez/koolo/internal/manager.go:69 +0x21d\n"
time=07:08:31 level=INFO msg=Stopping... configuration=Doom
time=07:08:31 level=INFO msg="Finished stopping" configuration=Doom
time=07:08:46 level=INFO msg="Koolo shutting down..."
hectorgimenez commented 2 months ago

Not sure why this is happening to you, I'm not able to reproduce it, I pushed a new commit, hopefully it will fix this issue this time

divineblade7 commented 2 months ago

That did fix it with commit: b4eaf3a7753eeaa0817a90edba132b5fcd281723

It seems it was the index in this loop i guess. I agree it made no sense to me either why it was crashing every time i tried debugging it. It got past game creation now, thank you so much for all your work with this.


stashedGold := [4]int{}
    stashedGold[0] = mainPlayerStashedGold.Value
    for i, puKey := range stashPlayerUnitOrder {
        if i > 3 {
            break