Archipelago icon indicating copy to clipboard operation
Archipelago copied to clipboard

Jak and Daxter: Implement New Game

Open massimilianodelliubaldini opened this issue 1 year ago • 22 comments

This is a draft PR for code review, beta test volunteers, etc. If I've got any style issues, or use deprecated features, or have obvious logical problems, please let me know!

My origin PR squashed some 17 commits, so if you want that kind of granular history, see here.

What is this fixing or adding?

This commit adds Jak and Daxter: The Precursor Legacy to Archipelago. This includes the world, the locations, the items, the text client, web world, documentation, and setup guide.

How was this tested?

  • Ran the generic python tests included with Archipelago.
  • Generated both single-world and multi-world seeds.
  • Read several spoiler logs to ensure the game logic was being followed.
  • Manually tested the text client and the game mod itself.
    • Farthest single-world point I reached was getting 20 power cells and making it to the Blue Sage's hut (hub world 2 of 3).
    • Recorded some footage of a multi-world game here.

If this makes graphical changes, please attach screenshots.

N/A.

A request for feedback: during testing I noticed that if you obtain a particular scout fly before breaking that scout fly's box, the box will not spawn a fly. The game tracks which flies you already have and will not spawn them again. This is a bug I need to fix, since the would-by flies in those boxes now represent other items, but it got me thinking.

In order to receive the Free 7 Scout Flies power cell of any given level, should you

  • receive all 7 scout flies for that level?
  • break all 7 boxes in that level?
    • followup: how do we handle the 2 boxless flies in LPC?

The first option. I see them as this game's skulltulas from Zelda.

LuigiXHero avatar May 14 '24 00:05 LuigiXHero

I ended up implementing both options as separate functions, but the first option is what is in use currently. Unfortunately I've learned about a massive design flaw in how I equated Locations and Items, each instance having a unique ID number within it's type, and matching ID numbers with it's counterpart. That's not how AP works in fact. I need a generic item called "Power Cell" with a single ID, and instead I have 101 items each with their own ID's and names.

So I'm left with rewriting a lot of things both in the APWorld and in the game. There's now 1 item called Power Cell, with 1 ID, and I make 101 copies of it. But the game needed to modified to receive the "same" power cell more than once, and it is now much less stable as a result. It locks up frequently on Geyser. But I'm slowly crawling back to stability.

Another concern is scout flies. I've modified the game with the intent of checking the 7 Scout Fly Location when you receive those 7 specific scout fly Items. But the game doesn't seem to be firing the event that I need it to. Not sure why.

I don't plan on adding to this PR until I work out the regressions and get back to the stability I had before. In the meantime, you can read/clone/compare the code on this branch to see where I currently am.

Updates

  • Genericized the Power Cell and Scout Fly items so that they no longer share names with their respective Locations.
  • Modified the Scout Fly progress menu to show you both how many scout flies you Checked in a level (their Locations) and how many you Received for a level (their Items). Makes it easier to track progress.
  • Separately created "special Locations" to cover specific but abstract Items like Flut Flut and Fisherman's Boat to retain the puzzle-like aspect of finding the unlock to access new areas. So when you complete the fishing minigame, you get both the fisherman's power cell Location, as well as the Fisherman's Boat Location. Then his Boat Item may be somewhere else in the world for you to find.
  • Removed the automatic game/compiler startup from the Client. It was causing some kind of game freeze within 5 minutes of normal gameplay, and I couldn't reproduce the freeze if I opened separate Powershell windows for the REPL and the game. So for the moment, the user will need to run those tasks and connect the Client to them manually.

Testing

  • Completed a full-game solo run on a newly generated seed.
  • Saved and quit overnight and was able to restart the server, reconnect the game and client, load the save, and immediately pick up where I left off.
  • The 7 Scout Fly checks are now automatically triggered when you receive the 7th fly Item for a given level (not by breaking the 7 boxes for their Locations).
  • Victory condition to be triggered on contact with white eco (had to manually test this call because I had already finished the game before I realized I needed a victory condition). Still works even if manually triggered. Item release functions perfectly.

If this makes graphical changes, please attach screenshots.

image

Updates

Updated the regions and rules to better suit the current logic. Two new items and checks were added: the Snowy Mountain Gondola (checked by approaching the gondola), and the Warrior's Pontoons (checked by talking to the Warrior for the first time). This helps gate progression in a more stair-like pattern, rather than cliff-like pattern. Also removes some obscure rules about how to access the gondola in a vanilla game.

Also added back the automatic startup of the game/compiler exe's after I figured out what was causing the game to freeze (they each need to have their own console windows running, independent of each other and anything Archipelago is doing).

Testing

Second (nearly full) playthrough of the game. No crashes, discovered one bug with the gondola which after fixing a function and restarting the game seems to have been squashed.

Updates

  • Fixes https://github.com/ArchipelaGOAL/Archipelago/issues/11), separates logs that a player should see from logs that only a developer would want to see.
  • Implements https://github.com/ArchipelaGOAL/Archipelago/issues/14, adds an item tracker to the options menu.
  • In tandem with https://github.com/ArchipelaGOAL/ArchipelaGOAL/pull/5, updated the world info doc to refer to the Archipelago menu for certain features like the Item Tracker and Warp To Home.

Testing

Incremental updating/testing of the menu itself, checking the client output as well as the PyCharm output for debug statements, and checking the markdown preview of the world doc.

Updates

Deathlink Added https://github.com/ArchipelaGOAL/Archipelago/issues/8

Deathlink signals are sent when:

  • Jak dies while on foot, on Flut Flut, or on the Zoomer.
  • Jak catches a poison eel during the fishing minigame.
  • Jak is eaten by the plant boss or lurker shark.

When Deathlink signals are received:

  • If Jak is in a cutscene, the signal is swallowed and he will live.
  • If Jak is in the fishing minigame, he will immediately fail the minigame.
  • If Jak is on foot, on Flut Flut, or on the Zoomer, he will die in a random way.

In-game Settings Added

Deathlink is toggleable at any time during gameplay through the Archipelago Options menu. This setting is saved to, and loaded from, a *.GC file in the ArchipelaGOAL mod folder. This may serve as the foundation for future optional features.

Potential fix to incorrect Scout Fly counts added. https://github.com/ArchipelaGOAL/Archipelago/issues/6

Translations Added

  • Swedish, by Level70
  • Danish, by Jacobmix
  • German, by Abbacchio
  • French, by Troyoo

Testing

Played a multi-world seed with Jak and Noita. Had Jak die while on foot, on Flut Flut, on the Zoomer, and catching a poison eel during the fishing minigame. All scenarios send out the Deathlink flag to Noita, along with the properly formatted death text. Had Noita die while Jak was on foot, on Flut Flut, on the Zoomer, and playing the fishing minigame. All scenarios saw Jak die in a random way (with some limited animation options for Flut Flut and Zoomer) (and fishing minigame triggered an instant failure) (unlike fishing minigame, Jak dies normally during Billy's rat minigame with no special code required).

If this makes graphical changes, please attach screenshots.

image image

~~What's up with Github not doing pretty formatting sometimes?~~ Oh they only do it when the issue/PR link is in a list. That's annoying.

Updates

  • Implements https://github.com/ArchipelaGOAL/Archipelago/issues/7.
    • Jak's moveset has been broken into 11 unique items and added to the item pool.
    • The orb caches in the game have been added as locations (excluding the caches in Citadel) (you need to collect all the orbs from the cache, not just open the cache, to complete the check).
    • All the regions in the game have been redone - going from about 20 to over 100 - to account for the different movement options you need to reach different areas.
    • The feature is optional and has an in-game override setting.
    • Also included in the settings is a tracker showing you which moves you found.
    • If the option is off, all moves are instead added to your starting inventory. The item pool is filled with green eco pills as filler in their place.
  • Fixed https://github.com/ArchipelaGOAL/Archipelago/issues/23.
    • The snowy fort gate used to open when pressing the fort gate switch button. Now, this no longer occurs.
    • The gate used to not open when receiving the item while standing in front of it. You needed to reload the level by dying, leaving and returning, or reloading a save. Now, the gate opens by itself in real-time if you receive the item while standing in front of it.
    • All the same fixes have been applied to the final staircase and final elevator in Citadel with regard to the "Freed the Sage" items.
  • Debug text has been removed from the game - it now looks like you're playing the retail release of the game.
    • You should no longer see AS: UNKNOWN ID and other odd text elements on screen.
    • You should still be able to skip cutscenes by pressing Triangle.
  • Documentation has been updated to list the moves being randomized, along with the orb caches that now act as location checks.
  • Added unit tests to ensure that the correct number of items have been added to the game's regions (101 cells, 112 flies, 2000 orbs).
  • Fixed local imports.

Testing

Created both a Move Rando seed and a non-Move Rando seed. The "on" seed was 20 spheres long. I played it for 3.5 hours, finding the moves along the way. Checking the spoiler log, I made sure that the logic would allow me to complete the game. I also played the "off" seed to ensure that the starting inventory had all the moves in it, and that the game could properly receive the green eco pills as filler items.

If this makes graphical changes, please attach screenshots.

image image image image

Updates

  • Implements https://github.com/ArchipelaGOAL/Archipelago/issues/9 .
  • Fixed some values that display in different HUD modes.
    • Regular HUD shows Received values, alternate modes show Per-Level or Global Checked values.
  • Added Update instructions to the setup doc.
  • Fixed error spam in text client while offline, when dying with Deathlink enabled.
  • Fixed ability to Roll into a Crouch stance.
    • If you don't have Crouch and you Roll, Jak is forced to stand.

How was this tested?

  • Played through to Rock Village with multiple settings.
    • Orbsanity off, Orbsanity with Global 1 orb bundles, Orbsanity with Local 1 orb bundles, Orbsanity with Local 20 orb bundles.
  • Generated multiple seeds to verify integrity of regions, ability to pay traders, etc.

If this makes graphical changes, please attach screenshots.

image image image

Updates

  • Fixes https://github.com/ArchipelaGOAL/Archipelago/issues/35 by increasing the minimum height of the orb cache top when it opens, so Jak can walk under it.
  • Fixes part of https://github.com/ArchipelaGOAL/Archipelago/issues/34, where the Raise The Chamber power cell needed more height than a single jump (may need to take the chamber back down to get it).
  • Fixes https://github.com/ArchipelaGOAL/Archipelago/issues/33.
  • Implements https://github.com/ArchipelaGOAL/Archipelago/issues/27.
  • Implements https://github.com/ArchipelaGOAL/Archipelago/issues/22 by adding the following completion options:
    • Defeat the Dark Eco Plant
    • Defeat Klaww
    • Defeat Gol and Maia
    • Cross Fire Canyon
    • Cross Mountain Pass
    • Cross Lava Tube
    • Open the 100 Cell Door
  • Added options to change the power cell requirements for Fire Canyon, Mountain Pass, and Lava Tube.
  • Implements https://github.com/ArchipelaGOAL/Archipelago/issues/20, by changing the order of loading a save and connecting to AP. You connect on the title screen, then load the correct save.
  • Implements https://github.com/ArchipelaGOAL/Archipelago/issues/19. You can see Got {Item} From {Player} in the normal HUD, and Sent {Item} To {Player} in the alternate HUD. Both HUD modes change to Found {Item} when you find your own item.
  • Fixed an issue where dying in front of the final elevator will improperly cause it to spawn.

How was this tested?

  • Individual unit tests of each fix or feature, combined with an end-to-end test of a 100-cell-door run, with orbsanity, with move randomizer, and with altered cell counts for connector levels.

If this makes graphical changes, please attach screenshots.

  • See issue links above for screenshots.

Taking this out of Draft just to get some more eyes on it. I'll be taking a break for a week or two, let the comments come in during that time, and I can address them when I return. Thanks all!

Lots of fixes included in the code-review-updates branch so that's available for anyone who has free time to take a look.

I did also release another APWORLD+mod update today to clear the backlog of things I was sitting on. It did not include any other code review updates, since these will require some serious testing. Thanks @Exempt-Medic for providing all your feedback!

Just in case this got lost in the conversations above, I want to make sure this doesn't get merged until OpenGOAL's official launcher gets mod support, since that is going to affect documentation, user onboarding, etc. I want the opportunity to make sure the transition goes smoothly.

EDIT: Not even 24 hours later...

We're almost at 5,000 lines. Come on guys, step up your code reviews! Gotta give me something to break the 5k barrier. XD

EDIT: lfg

Maybe consider adding option groups? Would make it easier to parse, especially since I'd imagine most people won't modify their cell counts and orb shop prices

ScipioWright avatar Sep 17 '24 13:09 ScipioWright

image

How's this?

It only auto-expands the Game Options, so I'd recommend ditching the "Challenge Modes" group and just letting those live in Game Options. Maybe an Orbsanity group?

ScipioWright avatar Sep 17 '24 14:09 ScipioWright

You can also change Game Options to be a different group ( like what Stardew does ) and it won't auto-expand. Or you can use start_collapsed to change the behaviors

Exempt-Medic avatar Sep 17 '24 14:09 Exempt-Medic

It only auto-expands the Game Options, so I'd recommend ditching the "Challenge Modes" group and just letting those live in Game Options. Maybe an Orbsanity group?

These option groups all started open by default? start_collapsed is by default False, and I didn't override it.

The latest couple of commits have changed the client and its agents quite extensively, just want to put that out there, it may warrant extra review.

Things I'd like to handle before this is considered mergeable:

  • https://github.com/open-goal/jak-project/pull/3692
    • Mod has been updated to now use this feature.
  • https://github.com/ArchipelaGOAL/Archipelago/pull/54
  • https://github.com/ArchipelaGOAL/ArchipelaGOAL/pull/15

From this point forward, I plan on finalizing the code: only code review notes from this PR, and any egregious bugs that come out of v0.4.0 beta. This is so nobody has to make a merge decision (yay or nay) on a moving target.

Checking in to see if anyone wants to do another code review. I'd like to get this into the next Archipelago release if possible. If anything needs more discussion, just let me know.

EDIT: I realized I never advertised this feature:

Auto Detect OpenGOAL Install

The client will now automatically find your install location of OpenGOAL and use it. You no longer have to touch the Host.yaml whatsoever after installing the apworld or mod. If it fails to find your install directory, you can still provide it manually in the Host.yaml and turn the auto-detection feature off.

Ran fuzzer just to sanity check the unit test. I ran 50k attempts expecting that about 10k would make it.

python .\fuzz.py -r 50000 -g "jakanddaxter"

Success: 9806
Failures: 1
Timeouts: 83      # Exclusively 1-orbsanity seed
Ignored: 40110    # Incompatible options throwing OptionErrors

Time taken:1159.93s

You would definitely be correct in saying orbsanity is a big performance sink, so thanks for checking that out.

Getting some failures

57387667797706808072 66658242622731250053

Jak and Daxter The Precursor Legacy.json

Are these restrictive fill errors?

NewSoupVi avatar May 18 '25 22:05 NewSoupVi

Seems like they are. Idk if anything can be done about it, I did turn off the friendly settings thing to get more valid generations

NewSoupVi avatar May 18 '25 22:05 NewSoupVi

Those seem to just be OptionErrors, unless you mean to say you've turned friendly limits off? Note that some errors, like these, will throw even if you turned off friendly limits.

Options.OptionError: The options you have chosen may result in seed generation failures. 
Please adjust the following Options for a singleplayer game. 
  Fire Canyon Cell Count must be no greater than 34 (currently 87).
Or use 'random-range-x-y' instead of 'random' in your player yaml.
Or set 'enforce_friendly_options' in your host.yaml to false. (Use at your own risk!)

Options.OptionError: The options you have chosen may result in seed generation failures. 
Please adjust the following Options for a singleplayer game. 
  Fire Canyon Cell Count must be no greater than 34 (currently 67).
  Mountain Pass Cell Count must be no greater than 63 (currently 70).
Or use 'random-range-x-y' instead of 'random' in your player yaml.
Or set 'enforce_friendly_options' in your host.yaml to false. (Use at your own risk!)

For more context - those limits (34, 63, etc.) were determined empirically under the most restrictive settings (move rando on, orbsanity off). In a multiplayer game, you can exceed these with the expectation that some of these power cells (mcguffins) will be in other players' worlds. But in a singleplayer game, these are the maximum number of locations for power cells in hub 1, assuming you do not find another key item that grants you access to more locations (e.g. fisherman's boat).

Those seem to just be OptionErrors, unless you mean to say you've turned friendly limits off? Note that some errors, like these, will throw even if you turned off friendly limits.

Options.OptionError: The options you have chosen may result in seed generation failures. 
Please adjust the following Options for a singleplayer game. 
  Fire Canyon Cell Count must be no greater than 34 (currently 87).
Or use 'random-range-x-y' instead of 'random' in your player yaml.
Or set 'enforce_friendly_options' in your host.yaml to false. (Use at your own risk!)

Options.OptionError: The options you have chosen may result in seed generation failures. 
Please adjust the following Options for a singleplayer game. 
  Fire Canyon Cell Count must be no greater than 34 (currently 67).
  Mountain Pass Cell Count must be no greater than 63 (currently 70).
Or use 'random-range-x-y' instead of 'random' in your player yaml.
Or set 'enforce_friendly_options' in your host.yaml to false. (Use at your own risk!)

For more context - those limits (34, 63, etc.) were determined empirically under the most restrictive settings (move rando on, orbsanity off). In a multiplayer game, you can exceed these with the expectation that some of these power cells (mcguffins) will be in other players' worlds. But in a singleplayer game, these are the maximum number of locations for power cells in hub 1, assuming you do not find another key item that grants you access to more locations (e.g. fisherman's boat).

Yeah, I've turned friendly limits off, and I'm getting FillErrors, not OptionErrors.

NewSoupVi avatar May 19 '25 14:05 NewSoupVi