Giter Site home page Giter Site logo

pokemonfireredsinglesequence's Introduction

Overview

This repository contains a list of inputs that theoretically will beat >99% of all Pokémon Firered games. There is no RNG manipulation involved, and there are no frame-perfect inputs required. The sequence of inputs is static, it does not require any information from the game. The intention of this list is to enable beating the game with no visuals/audio, or "blind and deaf".

Contents

The full list of inputs is in fullSequence/inputs.txt. This file is technically untested and is a decompilation of the lua code which involves modularization of specific tasks, like the Doug Cycle. Theoretically the execution of either should be identical.

src/main contains the main lua files usable with BizHawk. The files are separated into 9 individual sections, one for each badge and an additional one for the Elite Four.

The files contain a simple list of commands, with the format [<command>, <frames>], where the first value is the button to press and the second is the number of frames to hold the button for. The raw text list uses the following commands:

Command Description
a A
b B
u Up
d Down
l Left
r Right
st Start
ub Up + B
db Down + B
lb Left + B
rb Right + B
w Wait

Other buttons, like select, L, and R, are unused.

In the Lua files, the same format is used, with additional commands that represent a subset of buttons that can be reused. For example, grass_cycle performs the necessary inputs to travel through one patch of grass, and can be used in the same way other commands are. In this case, the format is slightly different, with the second value being the number of times to repeat the routine. For example, ['doug_cycle_1', 150] would indicate to do the doug_cycle_1 command 150 times in a row.

Additionally, there is a distinction between the directional commands. The u, d, l, and r commands are routines in the Lua code, and are shorthand for a single 5 frame press of the button followed by 16 frames of waiting. This is for moving around the overworld, for example moving up 5 tiles could be denoted as ['u', 5], where the 5 is not the number of frames to hold the button but the number of times to press it. This routine allows a single walk cycle to complete, making navigation of the overworld much easier to write and understand. To denote holding a directional button for a certain number of frames, the commands uf, df, lf, and rf are used.

Note that none of the inputs are dependent on their exact timing.

Notes

  • At some points in the list the frame commands uf/df/lf/rf are used where it really should be the routines for walking u/d/l/r. This was due to some experimentation at the early stages of the project with the method of recording inputs. Almost all inputs were written by hand.

  • There are various unnecessary inputs that could be removed, but ultimately they don't affect the game, just add some extra time to the playthrough.

  • There is a minor chance of failure at the beginning of the game due to inability to run away from abnormally fast wild pokemon. This accounts for nearly all failures. There are two other instances where it is possible for the sequence of inputs to fail, but both are extremely unlikely.

More Info

This project is the result of watching Pokemon challenge runs and wondering if many of the "blind" challenges could be done without the sound or a third party, i.e. a person or group giving directions. At its core, beating a game consistenly with no sound or visuals (or haptic feedback) is the same as stating:

"This game has a knowable solution inpedendent of all in-game events and information."

In this case, a "solution" is an immutable sequence or list of inputs, which a player would press in order to beat the game.

Many games fall outside of this definition. All competitive games, for example, could not be played without information, as it would be akin to trying to play chess without ever knowing the state of the board. Games that rely heavily on random chance may have solutions, but would require such a massive list of inputs that it would be impratical to ever solve them.

Some games may have a solution that couldn't be performed by a human, but are performable by a computer. My main interest is in solutions that are possible by humans; that is to say, not requiring frame-perfect inputs.

Pokemon is a turn-based RPG with a finite and knowable state, since the game will only advance its state if a button is pressed by the player. If one knows the state the game starts in, and knows what buttons they press, they should theoretically always know the state of the game. With a sophisticated enough state machine modeling the game, the solution could be computed automatically with a sufficiently powerful computer and enough time.

Instead of doing that, I computed the solution by hand, as quite frankly, it's a lot faster than modeling the entire game of Pokemon as a finite state machine.

The files in this repository contain the list of inputs which, when pressed in order, advance the game state of Pokemon Firered to victory >99% of the time, with small chances for failure at the beginning of the game.

I had hoped to find a solution with an 100% chance of success, and though there are methods which would allow the solution to approach 100%, it can never be completely reached, and would require significantly more time put in for marginal increases in success rate.

Though the solution provided here works, it is certainly not the only solution. It could be improved in many ways, or it could be overhauled to adopt a completely different strategy. In the future, I would be interested to see just how much faster the solution could become by taking a more complicated route. However, my goal was simply to find out if it was possible, so I took a rather safe, and time-consuming, approach.

This project does not focus on the mechanical or mental skill needed to memorize the sequence of inputs and then actuate it in one sitting. To actually memorize such a massive list of inputs would require an extensive amount of time, and is not my goal.

A sequence of inputs that beats Pokemon FireRed is a solution to the game. The goal of this project is to find a sequence of inputs such that it beats all games of Pokemon FireRed. This means that regardless of the games starting seed, and regardless of the imperfections in the actuation of inputs (i.e., no frame-perfect recreations of the sequence), the sequence should still succeed.

Though it may seem impossible to account for all possible games of Pokemon, many of the possibilities are redundant and can be treated as one. For example, Pokemon have randomly varying hidden stats which are assigned to them upon being acquired or encountered. With each stat varying between 0 and 31, and there being 6 unique stats, there are technically billions of unique states a single Pokemon could be in.

However, by simply ensuring a possible solution is valid for both the highest stat values (all 31) and the lowest (all 0), all states in between those two should succeed as well. This greatly reduces the space which must be considered when creating a solution.

This same principle can be applied to most random events. So long as the solution works for both the lowest and highest result of a random event, the solution should work for all values in the middle. There are very few edge cases where this is not true, and these cases are handled individually when encountered.

Even if random events cause the games state to diverge, so long as the sequence of inputs eventually causes those states to converge, it is valid. Diverging states, however, could split further, and fractal off exponentially, so great care is taken not to allow too much divergence.

In the end, Pokemon is not a difficult game, and despite a rocky beginning, access to the daycare trivializes the majority of the rest of the game. As an extra challenge, I tried to keep the overall level of my team as low as possible, though I didn't spend too much time optimizing everything. Major improvements could be made in the runtime by adjusting the team's composition, level, and strategy.

In my case, I made sparing use of items and berries, not realizing their potential until very late into the game. Heavy optimizations could be made by taking advantage of berries to counter status effects, allowing more leeway in fights and a lower overall level. This, in turn, means less time spent in the daycare, which means a faster overall time. The optimization of late game fights was not my primary objective, however, though it will likely be the focus if I return to this project to attempt completion of the game's after-credits content.

pokemonfireredsinglesequence's People

Contributors

frumpy9 avatar keeyanghoreshi avatar

Stargazers

Fufu Fang avatar Goh Wei Wen avatar Kamil avatar Thomas Kim avatar  avatar Nox Nivis avatar Vincent Houlbrèque avatar  avatar  avatar Timothy Stella avatar  avatar  avatar Alex Trifonov avatar Patrik Ragnarsson avatar Ruairidh MacLeod avatar  avatar  avatar  avatar  avatar Reed Scheper avatar  avatar JohnBedog avatar  avatar  avatar  avatar Dillon Wong avatar Alice avatar pnkthrepwood avatar William Kanashiro avatar silvncr avatar Valerio Maggi avatar Samuel avatar  avatar Jens Lauritsen avatar Thanussian Sharvananthan avatar mchl18 avatar Brahvim Bhaktvatsal avatar Lev Gorodetskii avatar  avatar iRewiewer avatar Ivy Jackson avatar Hannah Davies avatar  avatar Hin Au avatar Agniv Sarkar avatar Antonio Rondán (Kaysera) avatar Cosmo avatar Clap4 avatar Jacob Scherber avatar Ryan Lam avatar froggie avatar Rushvanth avatar Robin avatar Hugues Morisset avatar  avatar isaac avatar Chris Pressey avatar  avatar bb010g avatar Larkin avatar Héctor Molinero Fernández avatar Yair Lopez Poveda avatar Oscar Knagg avatar  avatar Tarang Shah avatar Dee Roberts avatar Federico del Mazo avatar Chris Orlando avatar Zoë Gidiere avatar ????????????????? avatar Philipp Wabnitz avatar Shane Reustle avatar Emymin avatar Sören Beye avatar Sylvain Migaud avatar Christian F. Coors avatar Santiago Fisela avatar  avatar koutsie avatar Avighna avatar  avatar Gibs avatar  avatar  avatar Zomega avatar Lachlan Allison avatar Anthony DiFalco avatar Brayconn avatar Eliaz Bobadilla avatar Laura O'Donnell avatar 4win avatar Calvin Keats avatar Halu avatar Jacob Tracy avatar  avatar GDWR avatar Ethan avatar Shreyas Minocha avatar  avatar  avatar

Watchers

James Cloos avatar Alice avatar  avatar  avatar  avatar

pokemonfireredsinglesequence's Issues

Problems Loading Scripts in BizHawk

Hi, let me just start by saying this work is amazingly creative and must have taken a crazy amount of effort. I really respect this work!

I'm kind of new to the TAS scene and was having issues loading the lua scripts you provided. Specifically getting this error:
NLua.Exceptions.LuaScriptException: [string "main"]:2: attempt to call global 'dbtn' (a nil value)

which is from line 2 in movement.lua

Is this because there is a missing file which defines dbtn? I would greatly appreciate any help and am eager to try out the sequence for myself :)

Is line 15 correct?

I'm working on a romhack version of this based on the full inputs.txt. It would not enter a sensible name and after a lot of debugging I've figured out that changing line 15 to last 60 frames instead of 5 fixes it. This input was hitting at a time when it would not do anything, and caused the input queue to be slightly ahead when it got to the name input.

I have not tested the lua scripts in bizhawk, but this seems to be the same in 1.lua. Is that input meant to last just 5 frames?

Tutorial

This isn't an issue, I didn't know where to ask. I know it may be some trouble but could you walk me through the steps to setting this up? I'm confused on where to start. I downloaded BizHawk but I don't know where to go from there.

Running script on BizHawk

Hi there,

I recently discovered a video on YouTube that piqued my interest and I decided to try out BizHawk. I've successfully run the lua script, but I'm having an issue where all of the inputs seem to be running on top of each other when I drag in 1-9.lua and movement.lua and start the ROM. Is there a way to drop all of the files into the emulator and have them run through in sequence, or do I need to add them one by one as the previous script finishes?

Any help would be greatly appreciated. Thank you.

just a question I have

My question is which emulator does it use? Does it use something like BizHawk, mGBA, VBA, batgba, no$gba, or another one that I don't know.

I believe 7.lua is running the wrong inputs.

m.executeOrders(b)

m.executeOrders(b)

I realized that when I started 7&8.lua it was doing random inputs. I thought it was an issue where 7 was just running the code 8 was supposed to, but then I realized that 8 has the same issue. 7&8 both seem to do the same inputs which are both wrong. Fixing the executeOrders in both files to the correct letters makes everything work.

I am not very good at github, but I am going to try to send a Pull Request with my fix.

Edit: Just finished the elite 4. Very cool :)

Issue with 2.lua

1.lua works great. I have ran 2.lua twice. Every time I get stuck on a Pidgey right above the Daycare after beating Misty.. The script moves up and down endlessly in a wild battle with Pidgey.

Bizhawk load issue

Hi, so several month ago I saw a TikTok on this and didn't think much of it till I go the idea to play Pokémon on my computer that's when I stumbled upon the youtube video that peaked my interest. Let me say I have no experience in coding or of bizhawk. I downloaded the script and put it in the lua console of BizHawk but keep getting an error for NLua.Exceptions.LuaScriptException: [string "main"]:4: attempt to call global 'movement' (a nil value). I have tried everything and I'm sure its my lack of knowledge. Please help me, this project is so awesome and I want to see it in action. I am very sorry if this question has already be answered or its a simple fix. any help is appreciated. Attached is the script I have if that help, I converted to a TXT doc to attach.

lua script.txt

Thank you, Joe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.