diff --git a/Readme.md b/Readme.md index b713167..b4daa3a 100644 --- a/Readme.md +++ b/Readme.md @@ -1,54 +1,58 @@ -PokéBot -======= -An automated computer program that speedruns Pokémon. +# PokéBot + +An automated computer program that speedruns Pokémon Red, Blue, or Yellow. Pokémon Red Any%: [1:51:11](https://www.youtube.com/watch?v=M4pOlQ-mIoc) (23 June 2014) -Watch Live -========== -### [http://www.twitch.tv/thepokebot](http://www.twitch.tv/thepokebot) -PokéBot's official streaming channel on Twitch. Consider following there to find out when we're streaming, or follow the [Twitter feed](https://twitter.com/thepokebot) for announcements when we get personal best pace runs going. +## Watch live -Try it out -========== -Running the PokéBot on your own machine is easy. You will need a Windows environment (it runs great in VM's on Mac too). First, clone this repository (or download and unzip it) to your computer. Download the [BizHawk 1.6.1](http://sourceforge.net/projects/bizhawk/files/BizHawk/BizHawk-1.6.1.zip/download) emulator, and procure a ROM file of Pokémon Red (you should personally own the game). +### [twitch.tv/thepokebot](http://www.twitch.tv/thepokebot) +PokéBot’s official streaming channel on Twitch. Consider following there to find out when we’re streaming, or follow the [Twitter feed](https://twitter.com/thepokebot) for announcements when we get personal best pace runs going. -##About BizHawk## -BizHawk 1.6.1 (Windows only) is the only version known to work. Later versions, like 1.7.2a do not seem to work, due to differences with reading bytes from memory. +### Run the bot locally -Run the [prereq installer](http://sourceforge.net/projects/bizhawk/files/Prerequisites/bizhawk_prereqs_v1.1.zip/download), which should update a C++ distributable needed by BizHawk +Running the PokéBot on your own machine is easy. You will need a Windows environment (it runs great in VMs on Mac/Linux too). -You can unextract BizHawk-1.6.1.zip anywhere. +1. First, clone this repository (or download and unzip it) to your computer. -##Setting up and verifying the ROM## -The ROM file should `Pokemon Red.gb`. The file name doesn't matter, but upload it to http://www.fileformat.info/tool/hash.htm to verify it's the US version. The linked website will spit out lots of hashes, make sure the two below match: -``` -MD5: 3d45c1ee9abd5738df46d2bdda8b57dc -SHA-1: ea9bcae617fdf159b045185467ae58b2e4a48b9a -``` +2. Download the [BizHawk 1.6.1](http://sourceforge.net/projects/bizhawk/files/BizHawk/BizHawk-1.6.1.zip/download) emulator and extract the ZIP file anywhere you like to “install” it. -Open the ROM file with BizHawk (Drag the .gb file onto EmuHawk), and Pokémon Red should start up. -The colors may look weird. To fix this, go to GB>Palette Editor, and then find the POKEMON RED.pal file which should be under Gameboy>Palettes in the directory where BizHawk was unextracted. + **Note:** BizHawk v1.6.1 (Windows only) is the only version known to work. Later versions like v1.7.2a do not seem to work, due to differences with reading bytes from memory. +3. Run [the BizHawk prerequisites installer](http://sourceforge.net/projects/bizhawk/files/Prerequisites/bizhawk_prereqs_v1.1.zip/download), which should update a C++ distributable needed by BizHawk. -##Running the bot## -If you want to test the full run, change [this line](https://github.com/kylecoburn/PokeBot/blob/52232581f227b829ea283d795ddaf60a52ce24fe/main.lua#L4) to be false. -Then, under the 'Tools' menu, select 'Lua Console'. -Click the open folder button, and navigate to the PokéBot folder you downloaded. Select 'main.lua' and press open. The bot should start running! +4. Procure a ROM file of Pokémon Red (you should personally own the game). + + The ROM file has a name like `Pokemon Red (UE) [S][!].gb`, but the file name doesn’t matter. Upload it to [fileformat.info/tool/hash.htm](http://www.fileformat.info/tool/hash.htm) to verify it’s the correct version. The linked website will spit out lots of hashes; make sure the two below match: + + ``` + MD5: 3d45c1ee9abd5738df46d2bdda8b57dc + SHA-1: ea9bcae617fdf159b045185467ae58b2e4a48b9a + ``` + + Open the ROM file with BizHawk (drag the `.gb` file onto EmuHawk), and Pokémon Red should start up. + + The colors may look weird. To fix this, go to _GB_ → _Palette Editor_, and then find the `POKEMON RED.pal` file which should be under _Gameboy_ → _Palettes_ in the directory where BizHawk was extracted. + +5. If you want to test the full run, set [`RESET_FOR_TIME` in `main.lua`](https://github.com/kylecoburn/PokeBot/blob/0fd1258ca17f7d74edbac72fa0afc2b5c6d58bb3/main.lua#L3) to `false` instead of `true`. + +6. Then, under the _Tools_ menu, select _Lua Console_. Click the “open folder” button, and navigate to the PokéBot folder you downloaded. Select `main.lua` and press “open”. The bot should start running! + +## Seeds -Seeds -===== PokéBot comes with a built-in run recording feature that takes advantage of random number seeding to reproduce runs in their entirety. Any time the bot resets or beats the game, it will log a number to the Lua console that is the seed for the run. If you set `CUSTOM_SEED` in `main.lua` to that number, the bot will reproduce your run, allowing you to [share your times with others](Seeds.md). Note that making any other modifications will prevent this from working. So if you want to make changes to the bot and share your time, be sure to fork the repo and push your changes. -Credits -======= +## Credits + ### Developers + Kyle Coburn: Original concept, Red routing -Michael Jondahl: Combat algorithm, Java bridge for connecting the bot to Twitch chat, Livesplit, Twitter, etc +Michael Jondahl: Combat algorithm, Java bridge for connecting the bot to Twitch chat, LiveSplit, Twitter, etc. ### Special thanks -To Livesplit for providing custom component for integrating in-game time splits. + +To LiveSplit for providing custom component for integrating in-game time splits. To the Pokémon speedrunning community members who inspired the idea, and shared ways to improve the bot. diff --git a/Seeds.md b/Seeds.md index 4fda876..cd5ad87 100644 --- a/Seeds.md +++ b/Seeds.md @@ -2,10 +2,14 @@ PokéBot comes with a built-in run recording feature that takes advantage of random number seeding to reproduce runs in their entirety. Any time the bot resets or beats the game, it logs a number to the Lua console that is the seed for the run. This seed allows you to easily share the run with others. -Have you found a seed that results in a run of `1:53:00` or better? [Let us know](https://github.com/kylecoburn/PokeBot/issues/4), and we’ll add it to the list! +Have you found a seed that results in a run of 1:52:00 or better using the bot’s default settings? [Let us know](https://github.com/kylecoburn/PokeBot/issues/4), and we’ll add it to the list! -| Time | Frames | Seed | Bot version | Found by | -|---------|--------|--------------|-------------|----------| -| 1:50:37 | 398226 | `1428414915` | v1.3.0 | Gofigga | +| Time | Frames | Seed | Nidoran name | Bot version | Found by | +|---------|---------|--------------|--------------|-------------|----------------------------------------------| +| 1:50:11 | 396,858 | `1428898417` | , | v1.4.2 | ThePokéBot | +| 1:50:36 | 398,208 | `1428414915` | A | v1.4.0 | [Gofigga](http://www.twitch.tv/gofigga) | +| 1:50:37 | 398,226 | `1428414915` | A | v1.3.0 | [Gofigga](http://www.twitch.tv/gofigga) | +| 1:50:51 | 399,076 | `1428414915` | A | v1.4.1 | [Gofigga](http://www.twitch.tv/gofigga) | +| 1:50:55 | 399,355 | `1428801658` | A | v1.4.0 | [Marcin1503](https://github.com/Marcin1503) | -To reproduce any of these runs, set [`CUSTOM_SEED` in `main.lua`](https://github.com/kylecoburn/PokeBot/blob/0ec69a6a958d15b3a9dccb492fa83e4a1dcae2e0/main.lua#L5) to the seed number and run the bot. +To reproduce any of these runs, set [`CUSTOM_SEED` in `main.lua`](https://github.com/kylecoburn/PokeBot/blob/27aa1dcd2cec1bbe25607fa346836f63b349ad5f/main.lua#L5) to the seed number and run the bot. diff --git a/ai/red/strategies.lua b/ai/red/strategies.lua index cc77902..676c47a 100644 --- a/ai/red/strategies.lua +++ b/ai/red/strategies.lua @@ -2070,6 +2070,17 @@ strategyFunctions.champion = function() return Strategies.hardReset("Back to the grind - you can follow on Twitter for updates on our next good run! https://twitter.com/thepokebot") end if status.tries == 0 then + if STREAMING_MODE and CUSTOM_SEED ~= nil then + gui.text(0, 0, "PokeBot v"..VERSION) + gui.text(0, 7, "Seed: "..Strategies.seed) + gui.text(0, 14, "Reset for time: "..tostring(RESET_FOR_TIME)) + gui.text(0, 21, "Time: "..Utils.elapsedTime()) + gui.text(0, 28, "Frames: "..Utils.frames()) + client.setscreenshotosd(true) + client.screenshot() + client.setscreenshotosd(false) + gui.cleartext() + end Strategies.tweetProgress("Beat Pokemon Red in "..status.canProgress.."!") if Strategies.seed then print("v"..VERSION..": "..Utils.frames().." frames, with seed "..Strategies.seed)