Skip to content

Commit

Permalink
Move Randomizer (ArchipelagoMW#26)
Browse files Browse the repository at this point in the history
* Finally remove debug-segment text, update Python imports to relative paths.

* HUGE refactor to Regions/Rules to support move rando, first hub area coded.

* More refactoring.

* Another refactor - may squash.

* Fix some Rules, reuse some code by returning key regions from build_regions.

* More regions added. A couple of TODOs.

* Fixed trade logic, added LPC regions.

* Added Spider, Snowy, Boggy. Fixed Misty's orbs.

* Fix circular import, assert orb counts per level, fix a few naming errors.

* Citadel added, missing locs and connections fixed. First move rando seed generated.

* Add Move Rando to Options class.

* Fixed rules for prerequisite moves.

* Implement client functionality for move rando, add blurbs to game info page.

* Fix wrong address for cache checks.

* Fix byte alignment of offsets, refactor read_memory for better code reuse.

* Refactor memory offsets and add some unit tests.

* Make green eco the filler item, also define a maximum ID. Fix Boggy tether locations.
  • Loading branch information
massimilianodelliubaldini authored Jun 27, 2024
1 parent 8293b9d commit 1c42bdb
Show file tree
Hide file tree
Showing 33 changed files with 1,912 additions and 655 deletions.
6 changes: 3 additions & 3 deletions worlds/jakanddaxter/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from NetUtils import ClientStatus
from CommonClient import ClientCommandProcessor, CommonContext, logger, server_loop, gui_enabled

from worlds.jakanddaxter.GameID import jak1_name
from worlds.jakanddaxter.client.ReplClient import JakAndDaxterReplClient
from worlds.jakanddaxter.client.MemoryReader import JakAndDaxterMemoryReader
from .GameID import jak1_name
from .client.ReplClient import JakAndDaxterReplClient
from .client.MemoryReader import JakAndDaxterMemoryReader

import ModuleUpdate
ModuleUpdate.update()
Expand Down
3 changes: 3 additions & 0 deletions worlds/jakanddaxter/GameID.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# All Jak And Daxter Archipelago IDs must be offset by this number.
jak1_id = 741000000

# This is maximum ID we will allow.
jak1_max = jak1_id + 999999

# The name of the game.
jak1_name = "Jak and Daxter The Precursor Legacy"
40 changes: 33 additions & 7 deletions worlds/jakanddaxter/Items.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from BaseClasses import Item
from .GameID import jak1_name
from .locs import CellLocations as Cells, ScoutLocations as Scouts, SpecialLocations as Specials
from .GameID import jak1_name, jak1_max
from .locs import (OrbLocations as Orbs,
CellLocations as Cells,
ScoutLocations as Scouts,
SpecialLocations as Specials,
OrbCacheLocations as Caches)


class JakAndDaxterItem(Item):
Expand Down Expand Up @@ -34,13 +38,14 @@ class JakAndDaxterItem(Item):
91: "Scout Fly - GMC",
}

# TODO - Orbs are also generic and interchangeable.
# orb_item_table = {
# ???: "Precursor Orb",
# }
# Orbs are also generic and interchangeable.
orb_item_table = {
1: "Precursor Orb",
}

# These are special items representing unique unlocks in the world. Notice that their Item ID equals their
# respective Location ID. Like scout flies, this is necessary for game<->archipelago communication.
# TODO - These numbers of checks may be inaccurate post-region refactor.
special_item_table = {
5: "Fisherman's Boat", # Unlocks 14 checks in Misty Island
4: "Jungle Elevator", # Unlocks 2 checks in Forbidden Jungle
Expand All @@ -56,11 +61,32 @@ class JakAndDaxterItem(Item):
70: "Freed The Green Sage", # Unlocks the final elevator
}

# These are the move items for move randomizer. Notice that their Item ID equals some of the Orb Cache Location ID's.
# This was 100% arbitrary. There's no reason to tie moves to orb caches except that I need a place to put them. ;_;
move_item_table = {
10344: "Crouch",
10369: "Crouch Jump",
11072: "Crouch Uppercut",
12634: "Roll",
12635: "Roll Jump",
10945: "Double Jump",
14507: "Jump Dive",
14838: "Jump Kick",
23348: "Punch",
23349: "Punch Uppercut",
23350: "Kick",
# 24038: "Orb Cache at End of Blast Furnace", # TODO - IDK, we didn't need all of the orb caches for move rando.
# 24039: "Orb Cache at End of Launch Pad Room",
# 24040: "Orb Cache at Start of Launch Pad Room",
}

# All Items
# While we're here, do all the ID conversions needed.
item_table = {
**{Cells.to_ap_id(k): cell_item_table[k] for k in cell_item_table},
**{Scouts.to_ap_id(k): scout_item_table[k] for k in scout_item_table},
# **{Orbs.to_ap_id(k): orb_item_table[k] for k in orb_item_table},
**{Orbs.to_ap_id(k): orb_item_table[k] for k in orb_item_table},
**{Specials.to_ap_id(k): special_item_table[k] for k in special_item_table},
**{Caches.to_ap_id(k): move_item_table[k] for k in move_item_table},
jak1_max: "Green Eco Pill" # Filler item.
}
21 changes: 12 additions & 9 deletions worlds/jakanddaxter/JakAndDaxterOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
from Options import Toggle, PerGameCommonOptions


# class EnableScoutFlies(Toggle):
# """Enable to include each Scout Fly as a check. Adds 112 checks to the pool."""
# display_name = "Enable Scout Flies"
class EnableMoveRandomizer(Toggle):
"""Enable to include movement options as items in the randomizer.
Jak is only able to run, swim, and single jump, until you find his other moves.
Adds 11 items to the pool."""
display_name = "Enable Move Randomizer"


# class EnablePrecursorOrbs(Toggle):
# """Enable to include each Precursor Orb as a check. Adds 2000 checks to the pool."""
# display_name = "Enable Precursor Orbs"
# class EnableOrbsanity(Toggle):
# """Enable to include Precursor Orbs as an ordered list of progressive checks.
# Each orb you collect triggers the next release in the list.
# Adds 2000 items to the pool."""
# display_name = "Enable Orbsanity"


@dataclass
class JakAndDaxterOptions(PerGameCommonOptions):
# enable_scout_flies: EnableScoutFlies
# enable_precursor_orbs: EnablePrecursorOrbs
pass
enable_move_randomizer: EnableMoveRandomizer
# enable_orbsanity: EnableOrbsanity
6 changes: 5 additions & 1 deletion worlds/jakanddaxter/Locations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from BaseClasses import Location
from .GameID import jak1_name
from .locs import CellLocations as Cells, ScoutLocations as Scouts, SpecialLocations as Specials
from .locs import (CellLocations as Cells,
ScoutLocations as Scouts,
SpecialLocations as Specials,
OrbCacheLocations as Caches)


class JakAndDaxterLocation(Location):
Expand Down Expand Up @@ -44,4 +47,5 @@ class JakAndDaxterLocation(Location):
**{Scouts.to_ap_id(k): Scouts.locLT_scoutTable[k] for k in Scouts.locLT_scoutTable},
**{Scouts.to_ap_id(k): Scouts.locGMC_scoutTable[k] for k in Scouts.locGMC_scoutTable},
**{Specials.to_ap_id(k): Specials.loc_specialTable[k] for k in Specials.loc_specialTable},
**{Caches.to_ap_id(k): Caches.loc_orbCacheTable[k] for k in Caches.loc_orbCacheTable},
}
Loading

0 comments on commit 1c42bdb

Please sign in to comment.