Skip to content

API and simulation suite for game data of Yu-Gi-Oh! Forbidden Memories

License

Notifications You must be signed in to change notification settings

sg4e/YGOFM-gamedata

Repository files navigation

Yu-Gi-Oh! Forbidden Memories data and simulation suite

build workflow status Javadoc

YGOFM-gamedata is a Java library that provides a fluent API for all of the game data in the PlayStation game Yu-Gi-Oh! Forbidden Memories as well as simulation capabilities.

Features

  • All data in the game is available and accessible: Cards, card information, duelists, drop pools, deck compositions, fusions, rituals, and more.
  • Simulation suite and exact re-implementation of the game's RNG: Generating AI duelists' decks, determining card order after shuffle, and discovering RNG seed values based on card draws are all supported. See the examples folder for how it's all done.
  • Extensive unit tests: Functionality is covered by unit tests, which include checking memory dumps generated by the game in an emulator and verifying that the library's behavior mimics game behavior exactly.
  • JDK8 and above compatibility: Whether you're using the most modern JDK or the 10+ year-old JDK8, you'll have no issues running this library in your project.
  • Pure Java implementation with zero dependencies: As can be seen in the build.gradle file, this library depends on no other projects to build and run. A few dependencies are used to run the unit-test framework, but these are neither required nor shipped with any of the Maven artifacts.
  • Cross-platform and cross-language: In addition to integrating with any JVM language, this library's bytecode can be compiled to machine code with LLVM or GraalVM to interface with other code natively.
  • Extremely performant: All game data has been coded directly into Java source files, and no external files are loaded to build the database at start-up. Simulations run parallel on multiple threads to leverage modern CPUs' full potential.
  • Complete and descriptive documentation: An extensive Javadoc covers all of the library's functionality to make working with it as hassle-free as possible.

Examples

Get information about a card

FMDB db = FMDB.getInstance();
Card blueEyes = db.getCard(1);
System.out.println(blueEyes.getAttack());
// prints: 3000

Check a fusion

FMDB db = FMDB.getInstance();
Card boltPenguin = db.getCard(461);
Card babyDragon = db.getCard(4);
System.out.println(babyDragon.fuse(boltPenguin));
// prints: Thunder Dragon

Get a duelist's hand size

FMDB db = FMDB.getInstance();
Duelist seto2 = FMDB.getDuelist(Duelist.Name.SETO_2);
System.out.println(seto2.getHandSize());
// prints: 18

Find out who drops Raigeki

FMDB db = FMDB.getInstance();
Card raigeki = db.getCard(337);
Set<Duelist> duelists = db.getAllDuelists();
Set<Duelist> dropsRaigeki = new HashSet<>();
for (Duelist d : duelists) {
    for(Pool.Type type : new Pool.Type[] {Pool.Type.SA_POW, Pool.Type.SA_TEC, Pool.Type.BCD}) {
        Pool pool = d.getPool(type);
        if(pool.getEntry(raigeki) != null) {
            dropsRaigeki.add(d);
        }
    }
}
System.out.println(dropsRaigeki);
// prints: [Heishin, Shadi, Ocean Mage, Heishin 2nd, Seto 2nd, Seto, Seto 3rd]

Determine the composition and permutation of the AI's deck from the player's card draws

This example is too complicated to include here, but you can find it in SeedSearchExample.java in the examples directory. You can run it on Windows with:

cd examples
gradlew.bat seedSearch

or on Linux with:

cd examples
./gradlew seedSearch

How to include in your project

Builds of this project are published on GitHub Packages.

Use with Maven:

<dependency>
    <groupId>moe.maika</groupId>
    <artifactId>ygofm-gamedata</artifactId>
    <version>1.1.0</version>
</dependency>

Use with Gradle:

dependencies {
    implementation 'moe.maika:ygofm-gamedata:1.1.0'
}

This project uses SemVer versioning. Please use only versioned releases of this project, as the API stability of the SNAPSHOT/HEAD of this repository is not guaranteed.

Looking for the raw game data?

If you'd prefer to use the raw game data instead of this library, you can find all of it inside either of the following convenient formats:

These files are no longer used for this project, as their data has been converted to Java source code, but they are preserved in this repository for their usefulness.

Disclaimer

This project is neither endorsed by nor affiliated with Konami. All Intellectual Property rights to the Yu-Gi-Oh! franchise and the Forbidden Memories game belong to Konami. None of the Forbidden Memories ROM is included in this repository.