Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Super Mario land 2: implement new game #2730

Open
wants to merge 135 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
63cf1e1
Super Mario Land 2!
Alchav Dec 5, 2023
08b27a4
Bring in features from SML2R
Alchav Dec 9, 2023
df5b3e1
Many things
Alchav Dec 10, 2023
f76215e
Auto scroll option fixes
Alchav Dec 11, 2023
0453a15
Vanilla coins built into rom
Alchav Dec 11, 2023
d3d651e
Bosses location name group
Alchav Dec 11, 2023
42b4150
Add host.yaml settings for rom name
Alchav Dec 11, 2023
e97633c
Auto Scroll Trap
Alchav Dec 11, 2023
bb2622a
Exclude Level 10 from auto scroll
Alchav Dec 12, 2023
d280a3f
Mario Land 2 second release
Alchav Dec 15, 2023
e7057d5
Golden Coins Required option and midway bells protection
Alchav Dec 18, 2023
6361e95
Open World, third release
Alchav Dec 21, 2023
8830077
Super Mario Land 2 version 4 release
Alchav Dec 27, 2023
32a3ea2
Super Mario Land 2 version 5 release
Alchav Dec 27, 2023
c020676
Docs and finishing touches
Alchav Dec 28, 2023
5b5d7a0
Fix Hippo Zone
Alchav Dec 31, 2023
8b55b53
Pipe Traversal
Alchav Dec 31, 2023
1d6ce1a
EnergyLink
Alchav Dec 31, 2023
7bc39b1
Fix EnergyLink hopefully
Alchav Jan 1, 2024
9adf476
Fix Tree Zone 2 midway bell item
Alchav Jan 4, 2024
450e758
Version 9 release: shuffle secret exits
Alchav Jan 7, 2024
0df91e6
SML2R Sprite Randomizer fix
Alchav Jan 8, 2024
0e6475a
Fix Pumpkin Zone secret levels
Alchav Jan 10, 2024
09d6461
Update SML2 Docs
Alchav Jan 12, 2024
7d0e9a9
Special Thanks
Alchav Jan 12, 2024
4ea35a4
Fix Macro Zone 1 Secret Exit
Alchav Jan 12, 2024
07a5b82
SML2 finishing touches
Alchav Jan 16, 2024
f94da4c
Update worlds/marioland2/docs/en_Super Mario Land 2.md
Alchav Jan 16, 2024
c63cba9
Update worlds/marioland2/docs/setup_en.md
Alchav Jan 16, 2024
46900e0
Update worlds/marioland2/docs/setup_en.md
Alchav Jan 16, 2024
e648a74
Update readme and codeowners
Alchav Jan 19, 2024
2a1e7be
Merge remote-tracking branch 'origin/mario-land-2' into mario-land-2
Alchav Jan 20, 2024
6076bbf
Python 3.8 compatibility fix
Alchav Jan 20, 2024
33b197e
Pumpkin Zone 2 secret exit fix
Alchav Jan 20, 2024
3c542e3
Fix client bug when energy link disabled
Alchav Jan 21, 2024
9b8f1ce
Add SML2 description
Alchav Feb 5, 2024
ce26609
Merge branch 'main' into mario-land-2
Alchav Feb 10, 2024
7185952
remove backwards compatibility energy link test
Alchav Feb 10, 2024
cf0417a
remove unnecessary logic
Alchav Feb 10, 2024
22b80a4
Merge remote-tracking branch 'origin/mario-land-2' into mario-land-2
Alchav Feb 10, 2024
ce6bb78
Merge branch 'main' into mario-land-2
Alchav Mar 4, 2024
9318b71
Options dataclass
Alchav Mar 4, 2024
8ee62b5
Merge branch 'main' into mario-land-2
Alchav Mar 15, 2024
d9e261b
Coinsanity!
Alchav Mar 30, 2024
195c93a
Re-order options
Alchav Apr 1, 2024
3d87fc0
Random coinsanity checks instead of exact divisions
Alchav Apr 1, 2024
d6815ea
Rename Coinsanity to Shuffle Golden Coins
Alchav Apr 1, 2024
a4c78d6
Item Name Group fix
Alchav Apr 1, 2024
2882669
Location Name Group fix
Alchav Apr 1, 2024
a72bd17
Auto Scroll Mode
Alchav Apr 9, 2024
732dc12
Macro Zone 1 logic
Alchav Apr 11, 2024
d1ff939
Move space zone 2 boss logic to logic file
Alchav Apr 12, 2024
7c7c406
Write second auto scroll table if not trapped
Alchav Apr 12, 2024
bb1284d
Add item name groups
Alchav Apr 12, 2024
2444096
Rename options and fix up some things
Alchav Apr 12, 2024
c512b5c
Traps or Cancel Items
Alchav Apr 13, 2024
21edc9f
Adjust Mushroom Zone logic
Alchav Apr 13, 2024
0d94b12
Merge branch 'main' into mario-land-2-coinsanity
Alchav Apr 14, 2024
a1ec2cd
Begin sprite randomizer rewrite
Alchav Apr 16, 2024
354accd
Randomize platforms
Alchav Apr 16, 2024
d21f710
Mario's Castle Midway Bell
Alchav May 3, 2024
8c6e31c
Chaos auto scroll option
Alchav May 6, 2024
457c44d
Code cleanup
Alchav May 7, 2024
b818846
Sprite Randomizer fixes
Alchav May 21, 2024
7260d22
Space Zone Secret Course coin logic function name fix
Alchav May 21, 2024
cdee96d
1 Coin locations logic fix
Alchav May 21, 2024
a40ecca
Swim renamed to Water Physics
Alchav May 21, 2024
946ffd5
Merge branch 'mario-land-2-coinsanity' into mario-land-2
Alchav May 21, 2024
0049db8
Merge branch 'main' into mario-land-2
Alchav May 21, 2024
7bf1c3d
Update worlds/marioland2/docs/setup_en.md
Alchav May 21, 2024
df92408
Update worlds/marioland2/docs/setup_en.md
Alchav May 21, 2024
3b4bc52
Update worlds/marioland2/options.py
Alchav May 21, 2024
3e31f93
Remove hard logic comment
Alchav May 21, 2024
2402e26
Merge remote-tracking branch 'origin/mario-land-2' into mario-land-2
Alchav May 21, 2024
e295011
Check randomize enemies/platform options
Alchav May 25, 2024
cde24f6
Logic updates
Alchav May 25, 2024
3f5f25a
Turtle Zone 2 coin logic adjustment
Alchav May 28, 2024
4981e0d
Merge branch 'main' into mario-land-2
Alchav Jun 2, 2024
0824b53
Remove BizHawkClientContext import
Alchav Jun 2, 2024
7d7a577
Can't reach some coins without water physics if you are small
Alchav Jun 17, 2024
1e4ad7f
Fix item name mistakes
Alchav Jun 17, 2024
c42b746
Merge branch 'mario-land-2-coinsanity' into mario-land-2
Alchav Jun 25, 2024
ff896ad
Update worlds/marioland2/options.py
Alchav Jun 25, 2024
3f83955
Update README.md
Alchav Jun 25, 2024
a668a23
Update worlds/marioland2/docs/en_Super Mario Land 2.md
Alchav Jun 25, 2024
380418c
Update worlds/marioland2/options.py
Alchav Jun 25, 2024
fbf5f19
Update worlds/marioland2/options.py
Alchav Jun 26, 2024
d0d51bb
Reformat docstrings
Alchav Jun 26, 2024
0620ca5
Reformat Location Rules
Alchav Jun 26, 2024
8ef9388
Further fix Turtle Zone 2 logic
Alchav Jul 14, 2024
e4261dd
Macro Zone 3 Midway Bell coin logic
Aug 5, 2024
b363b69
Update worlds/marioland2/docs/en_Super Mario Land 2.md
Alchav Aug 7, 2024
7702088
Merge branch 'main' into mario-land-2
Alchav Aug 7, 2024
8b0f92d
Merge branch 'refs/heads/main' into mario-land-2
Sep 3, 2024
973f614
Fix Tree Zone 4 coin logic
Sep 3, 2024
6cdfd80
Move all location access rule logic to logic.py
Sep 3, 2024
3394101
Merge remote-tracking branch 'origin/mario-land-2' into mario-land-2
Sep 3, 2024
877b0b9
Double Quotes
Sep 3, 2024
e7d4e5a
Locations -> Full
Sep 3, 2024
d3cceca
More Locations -> Full
Sep 3, 2024
b70dbdf
use has_from_list_unique
Alchav Sep 3, 2024
bc558d7
use self.player_name
Alchav Sep 3, 2024
e8c5f8a
More self.player_name
Sep 3, 2024
d53431c
Merge remote-tracking branch 'origin/mario-land-2' into mario-land-2
Sep 3, 2024
6691a3c
Merge branch 'main' into mario-land-2
Alchav Sep 3, 2024
859f3bc
Fix unbeatable scroll levels not being forced cancellable on chaos
Sep 3, 2024
e71c226
Merge remote-tracking branch 'origin/mario-land-2' into mario-land-2
Sep 3, 2024
aae1b28
Update auto_scroll_max
Sep 3, 2024
f7c3a8c
Update worlds/marioland2/logic.py
Alchav Sep 3, 2024
7fabe1c
Fix Space Zone 1 coin logic
Sep 3, 2024
52fea1f
Fix non-coin rule function name generation
Sep 6, 2024
da43bda
Tree zone 4 exit rewrite
Alchav Sep 7, 2024
4c53035
Update worlds/marioland2/logic.py
Alchav Sep 7, 2024
2892855
Logic fixes
Sep 9, 2024
7c39ea9
Merge remote-tracking branch 'origin/mario-land-2' into mario-land-2
Sep 9, 2024
c27f5be
Pumpkin Zone Secret Course 1 return false
Sep 9, 2024
c1504c7
Macro Zone 2 return false
Sep 9, 2024
7d5a682
Update worlds/marioland2/__init__.py
Alchav Sep 10, 2024
94e58b2
Update worlds/marioland2/__init__.py
Alchav Sep 10, 2024
010c96a
Update worlds/marioland2/logic.py
Alchav Sep 10, 2024
da3a7c5
Update worlds/marioland2/logic.py
Alchav Sep 10, 2024
2e6226f
Update worlds/marioland2/logic.py
Alchav Sep 10, 2024
6126df2
Cleanup
Sep 10, 2024
d9914fe
Merge remote-tracking branch 'origin/mario-land-2' into mario-land-2
Sep 10, 2024
5519685
increase number of filler coin items
Sep 10, 2024
47a3ee3
Adjust Mario Zone 3 auto scroll max
Sep 10, 2024
34676d2
ItemsAccessibility
Sep 10, 2024
bafe770
Corrections to Mario Zone 4 logic and Pumpkin Zone 1 auto scroll max
Sep 10, 2024
d1f136b
Pumpkin Zone 1 unbeatable with Midway Bells unshuffled
Sep 16, 2024
89fb55c
Merge branch 'refs/heads/main' into mario-land-2
Sep 16, 2024
74c6e9f
SML2: whole lotta coin items
Dec 5, 2024
9ca800e
Start at ID 1
Dec 5, 2024
f9d8f3d
Merge branch 'refs/heads/main' into mario-land-2
Dec 5, 2024
fc5af14
Merge branch 'main' into mario-land-2
Alchav Dec 5, 2024
6c2b4e5
fix merge conflict mistake
Alchav Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions worlds/marioland2/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022-2023 Alex "Alchav" Avery

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
369 changes: 369 additions & 0 deletions worlds/marioland2/__init__.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of the spacing in this file is inconsistent and difficult to read properly, fixing it would be helpful

Large diffs are not rendered by default.

Binary file added worlds/marioland2/basepatch.bsdiff4
Binary file not shown.
202 changes: 202 additions & 0 deletions worlds/marioland2/client.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't review this type of file, but I will say that Mypy gives 23 errors and 6 notes for this file.
Screenshot 2024-09-04 103011

Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
import base64
import logging

from NetUtils import ClientStatus
from worlds._bizhawk.client import BizHawkClient, BizHawkClientContext
from worlds._bizhawk import read, write, guarded_write

from .rom_addresses import rom_addresses

logger = logging.getLogger("Client")

BANK_EXCHANGE_RATE = 20000000000


class MarioLand2Client(BizHawkClient):
system = ("GB", "SGB")
patch_suffix = ".apsml2"
game = "Super Mario Land 2"

def __init__(self):
super().__init__()
self.locations_array = []

async def validate_rom(self, ctx):
game_name = await read(ctx.bizhawk_ctx, [(0x134, 10, "ROM")])
game_name = game_name[0].decode("ascii")
if game_name == "MARIOLAND2":
ctx.game = self.game
ctx.items_handling = 0b111
return True
return False

async def set_auth(self, ctx):
auth_name = await read(ctx.bizhawk_ctx, [(0x77777, 21, "ROM")])
auth_name = base64.b64encode(auth_name[0]).decode()
ctx.auth = auth_name

async def game_watcher(self, ctx: BizHawkClientContext):
from . import START_IDS
from .items import items
from .locations import locations

(game_loaded_check, level_data, music, auto_scroll_enabled, auto_scroll_levels, current_level, midway_point,
bcd_lives) = \
await read(ctx.bizhawk_ctx, [(0x0046, 10, "CartRAM"), (0x0848, 42, "CartRAM"), (0x0469, 1, "CartRAM"),
(rom_addresses["Auto_Scroll_Disable"], 1, "ROM"),
(rom_addresses["Auto_Scroll_Levels"], 32, "ROM"),
(0x0269, 1, "CartRAM"),
(0x02A0, 1, "CartRAM"),
(0x022C, 1, "CartRAM")])

current_level = int.from_bytes(current_level)
midway_point = int.from_bytes(midway_point)
music = int.from_bytes(music)
auto_scroll_enabled = int.from_bytes(auto_scroll_enabled)
level_data = list(level_data)
lives = bcd_lives.hex()

# there is no music in the title screen demos, this is how we guard against anything in the demos registering.
if game_loaded_check != b'\x124Vx\xff\xff\xff\xff\xff\xff' or music == 0:
return

items_received = [list(items.keys())[item.item - START_IDS] for item in ctx.items_received]

level_progression = {
"Space Zone Progression",
"Tree Zone Progression",
"Macro Zone Progression",
"Pumpkin Zone Progression",
"Mario Zone Progression",
"Turtle Zone Progression",
}
for level_item in level_progression:
for _ in range(items_received.count(level_item + " x2")):
items_received += ([level_item] * 2)

if "Pipe Traversal" in items_received:
items_received += ["Pipe Traversal - Left", "Pipe Traversal - Right",
"Pipe Traversal - Up", "Pipe Traversal - Down"]

locations_checked = []
modified_level_data = level_data.copy()
for ID, (location, data) in enumerate(locations.items(), START_IDS):
if "clear_condition" in data:
if items_received.count(data["clear_condition"][0]) >= data["clear_condition"][1]:
modified_level_data[data["ram_index"]] |= (0x08 if data["type"] == "bell"
else 0x01 if data["type"] == "secret" else 0x80)

if data["type"] == "level" and level_data[data["ram_index"]] & 0x40:
locations_checked.append(ID)
if data["type"] == "secret" and level_data[data["ram_index"]] & 0x02:
locations_checked.append(ID)
elif data["type"] == "bell" and data["id"] == current_level and midway_point == 0xFF:
locations_checked.append(ID)

if ctx.slot_data:
total_stars = ctx.slot_data["stars"]
else:
total_stars = 5

invincibility_length = int((832.0 / (total_stars + 1))
* (items_received.count("Super Star Duration Increase") + 1))

if "Easy Mode" in items_received:
difficulty_mode = 1
elif "Normal Mode" in items_received:
difficulty_mode = 0
elif ctx.slot_data:
difficulty_mode = ctx.slot_data["mode"] & 1
else:
difficulty_mode = 0

new_lives = int(lives)
energy_link_add = None
# TODO: temporary check to ensure energy_link key for backwards compatibility
if ctx.slot_data and "energy_link" in ctx.slot_data and ctx.slot_data["energy_link"]:
if new_lives == 0:
if (f"EnergyLink{ctx.team}" in ctx.stored_data
and ctx.stored_data[f"EnergyLink{ctx.team}"]
and ctx.stored_data[f"EnergyLink{ctx.team}"] >= BANK_EXCHANGE_RATE):
new_lives = 1
energy_link_add = -BANK_EXCHANGE_RATE
elif new_lives > 1:
energy_link_add = BANK_EXCHANGE_RATE * (new_lives - 1)
new_lives = 1
# convert back to binary-coded-decimal
new_lives = int(str(new_lives), 16)

data_writes = [
(rom_addresses["Space_Physics"], [0x7e] if "Space Physics" in items_received else [0xaf], "ROM"),
(rom_addresses["Get_Hurt_To_Big_Mario"], [1] if "Mushroom" in items_received else [0], "ROM"),
(rom_addresses["Get_Mushroom_A"], [0xea, 0x16, 0xa2] if "Mushroom" in items_received else [0, 0, 0], "ROM"),
(rom_addresses["Get_Mushroom_B"], [0xea, 0x16, 0xa2] if "Mushroom" in items_received else [0, 0, 0], "ROM"),
(rom_addresses["Get_Mushroom_C"], [00] if "Mushroom" in items_received else [0xd8], "ROM"),
(rom_addresses["Get_Carrot_A"], [0xea, 0x16, 0xa2] if "Carrot" in items_received else [0, 0, 0], "ROM"),
(rom_addresses["Get_Carrot_B"], [0xea, 0x16, 0xa2] if "Carrot" in items_received else [0, 0, 0], "ROM"),
(rom_addresses["Get_Carrot_C"], [00] if "Carrot" in items_received else [0xc8], "ROM"),
(rom_addresses["Get_Fire_Flower_A"], [0xea, 0x16, 0xa2] if "Fire Flower" in items_received else [0, 0, 0], "ROM"),
(rom_addresses["Get_Fire_Flower_B"], [0xea, 0x16, 0xa2] if "Fire Flower" in items_received else [0, 0, 0], "ROM"),
(rom_addresses["Get_Fire_Flower_C"], [00] if "Fire Flower" in items_received else [0xc8], "ROM"),
(rom_addresses["Invincibility_Star_A"], [(invincibility_length >> 8) + 1], "ROM"),
(rom_addresses["Invincibility_Star_B"], [invincibility_length & 0xFF], "ROM"),
(rom_addresses["Enable_Bubble"], [0xcb, 0xd7] if "Hippo Bubble" in items_received else [0, 0], "ROM"),
(rom_addresses["Enable_Swim"], [0xcb, 0xcf] if "Swim" in items_received else [0, 0], "ROM"),
(rom_addresses["Pipe_Traversal_A"], [16] if "Pipe Traversal - Down" in items_received else [0], "ROM"),
(rom_addresses["Pipe_Traversal_B"], [32] if "Pipe Traversal - Up" in items_received else [10], "ROM"),
(rom_addresses["Pipe_Traversal_C"], [48] if "Pipe Traversal - Right" in items_received else [0], "ROM"),
(rom_addresses["Pipe_Traversal_D"], [64] if "Pipe Traversal - Left" in items_received else [0], "ROM"),
(rom_addresses["Pipe_Traversal_SFX_A"], [5] if "Pipe Traversal - Down" in items_received else [0], "ROM"),
(rom_addresses["Pipe_Traversal_SFX_B"], [5] if "Pipe Traversal - Up" in items_received else [0], "ROM"),
(rom_addresses["Pipe_Traversal_SFX_C"], [5] if "Pipe Traversal - Right" in items_received else [0], "ROM"),
(rom_addresses["Pipe_Traversal_SFX_D"], [5] if "Pipe Traversal - Left" in items_received else [0], "ROM"),
(0x022c, [new_lives], "CartRAM"),
(0x02E4, [difficulty_mode], "CartRAM"),
(0x0848, modified_level_data, "CartRAM")
]

if midway_point == 0xFF and ctx.slot_data and ctx.slot_data["midway_bells"]:
# after registering the check for the midway bell, clear the value just for safety.
data_writes.append((0x02A0, [0], "CartRAM"))

if "Auto Scroll" in items_received:
if auto_scroll_enabled == 0xaf: # auto scroll has not yet been enabled
data_writes.append((rom_addresses["Auto_Scroll_Disable"], [0x7e], "ROM"))
# if the current level is an auto scroll level, turn on auto scrolling now
if auto_scroll_levels[current_level] == 1:
data_writes.append((0x02C8, [0x01], "CartRAM"))

success = await guarded_write(ctx.bizhawk_ctx, data_writes, [(0x0848, level_data, "CartRAM"),
(0x022C, [int.from_bytes(bcd_lives)], "CartRAM")])

if success and energy_link_add is not None:
await ctx.send_msgs([{
"cmd": "Set", "key": f"EnergyLink{ctx.team}", "operations":
[{"operation": "add", "value": energy_link_add},
{"operation": "max", "value": 0}],
}])

if not ctx.server or not ctx.server.socket.open or ctx.server.socket.closed:
return

if locations_checked and locations_checked != self.locations_array:
self.locations_array = locations_checked
await ctx.send_msgs([{"cmd": "LocationChecks", "locations": locations_checked}])

if music == 0x18:
await ctx.send_msgs([{"cmd": "StatusUpdate", "status": ClientStatus.CLIENT_GOAL}])
ctx.finished_game = True

def on_package(self, ctx: BizHawkClientContext, cmd: str, args: dict):
super().on_package(ctx, cmd, args)
if cmd == 'Connected':
ctx.set_notify(f"EnergyLink{ctx.team}")
if ctx.slot_data and "energy_link" in ctx.slot_data and ctx.slot_data["energy_link"] and ctx.ui:
ctx.ui.enable_energy_link()
ctx.ui.energy_link_label.text = "Lives: Standby"
elif cmd == "SetReply" and args["key"].startswith("EnergyLink"):
if ctx.ui:
ctx.ui.energy_link_label.text = f"Lives: {int(args['value'] / BANK_EXCHANGE_RATE)}"
elif cmd == "Retrieved":
if f"EnergyLink{ctx.team}" in args["keys"] and args['keys'][f'EnergyLink{ctx.team}'] and ctx.ui:
ctx.ui.energy_link_label.text = f"Lives: {int(args['keys'][f'EnergyLink{ctx.team}'] / BANK_EXCHANGE_RATE)}"
58 changes: 58 additions & 0 deletions worlds/marioland2/docs/en_Super Mario Land 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Super Mario Land 2: 6 Golden Coins

## Where is the settings page?

The [player settings page for this game](../player-settings) contains all the options you need to configure and export a
config file.
Alchav marked this conversation as resolved.
Show resolved Hide resolved

## What items and locations get shuffled?

Completing a level's exits results in a location check instead of automatically bringing you to the next level.
Where there are secret exits, the secret exit will be a separate location check. There is one exception, Hippo Zone,
that does not have a separate check for its secret exit. The Hippo Zone secret exit will still bring you to the Space
Zone.

Unlocking paths to new levels requires finding or receiving Zone Progression items. For example, receiving the first
"Turtle Zone Progression" will unlock the path from Turtle Zone 1 to Turtle Zone 2. Paths to secret levels are separate
items, so Turtle Zone Secret will open the path from Turtle Zone 2 to the Turtle Zone Secret Course.

Mario Zone, Pumpkin Zone, Tree Zone, and Macro Zone each have one "Zone Progression x2" item that opens two paths at
once.

The path from Tree Zone 2 to the branch to Tree Zone 3 and 4 is one unlock, so both levels will open at this point.

Besides the zone progression unlocks, the following items are always shuffled:
- Mushroom: required to become Big Mario. If you are Fire or Bunny Mario and take damage, and have not obtained the
Mushroom, you will drop straight down to Small Mario.
- Fire Flower: required to become Fire Mario.
- Carrot: required to become Bunny Mario.
- Swim: Mario will fall through water as though it is air until this is obtained.
- Hippo Bubble: required to use the bubbles in Hippo Zone to fly.
- Space Physics: the Space Zone levels will have normal gravity until this is obtained.
- Super Star Duration Increase: you begin with a drastically lowered invincibility star duration, and these items will
increase it. This is the main filler item and the number of them appearing in the item pool depends on your settings.

Additionally, the following items can be shuffled depending on your YAML settings:
Alchav marked this conversation as resolved.
Show resolved Hide resolved
- The 6 Golden Coins: note that the game will still show you the coin being sent to the castle when defeating a boss
regardless of whether the coin is actually obtained in that location.
- Midway Bells: ringing bells results in a location check, and the midway check points are shuffled as items.
Note that you may have to backtrack from the midway point to reach some secret exits!
- Normal Mode/Easy Mode: you can start the game in Normal Mode with an Easy Mode "upgrade" in the item pool, or start in
Easy Mode with a Normal Mode "trap" item, swapping the difficulty.
- Auto Scroll: auto-scrolling levels can be set to not auto scroll until this trap item is received.
- Pipe Traversal: required to enter pipes. Can also be split into 4 items, each enabling pipe entry from a different
direction.


## When the player receives an item, what happens?

There is no in-game indication that an item has been received. You will need to watch the client to be sure you're aware
of the items you've received.

## Special Thanks to:

- [froggestspirit](https://github.com/froggestspirit) for his Super Mario Land 2 disassembly. While very incomplete, it
had enough memory values mapped out to make my work significantly easier.
- [slashinfty](https://github.com/slashinfty), the author of the
[Super Mario Land 2 Randomizer](https://sml2r.download/) for permitting me to port features such as Randomize Enemies
and Randomize Platforms directly from it.
75 changes: 75 additions & 0 deletions worlds/marioland2/docs/setup_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Setup Guide for Super Mario Land 2: 6 Golden Coins

## Important

As we are using BizHawk, this guide is only applicable to Windows and Linux systems.

## Required Software

- BizHawk: [BizHawk Releases from TASVideos](https://tasvideos.org/BizHawk/ReleaseHistory)
- Version 2.9.1 is recommended.
- Detailed installation instructions for BizHawk can be found at the above link.
- Windows users must run the prereq installer first, which can also be found at the above link.
- The built-in Archipelago client, which can be installed [here](https://github.com/ArchipelagoMW/Archipelago/releases)
- A Super Mario Land 2: 6 Golden Coins version 1.0 ROM file. The Archipelago community cannot provide this.

## Configuring BizHawk

Once BizHawk has been installed, open EmuHawk and change the following settings:

- Under Config > Customize > Advanced, make sure the box for AutoSaveRAM is checked, and click the 5s button.
This reduces the possibility of losing save data in emulator crashes.
- Under Config > Customize, check the "Run in background" box. This will prevent disconnecting from the client while
EmuHawk is running in the background.

It is strongly recommended to associate GB rom extensions (\*.gb) to the EmuHawk we've just installed.
Alchav marked this conversation as resolved.
Show resolved Hide resolved
To do so, we simply have to search any Gameboy rom we happened to own, right click and select "Open with...", unfold
Alchav marked this conversation as resolved.
Show resolved Hide resolved
the list that appears and select the bottom option "Look for another application", then browse to the BizHawk folder
and select EmuHawk.exe.

## Configuring your YAML file

### What is a YAML file and why do I need one?

Your YAML file contains a set of configuration options which provide the generator with information about how it should
generate your game. Each player of a multiworld will provide their own YAML file. This setup allows each player to enjoy
an experience customized for their taste, and different players in the same multiworld can all have different options.

### Where do I get a YAML file?

You can generate a yaml or download a template by visiting the [Super Mario Land 2 Player Settings Page](/games/Super%20Mario%20Land%202/player-settings)
Alchav marked this conversation as resolved.
Show resolved Hide resolved

## Joining a MultiWorld Game

### Generating and Patching a Game

1. Create your settings file (YAML).
Alchav marked this conversation as resolved.
Show resolved Hide resolved
2. Follow the general Archipelago instructions for [generating a game](../../Archipelago/setup/en#generating-a-game).
This will generate an output file for you. Your patch file will have a `.apsml2` file extension.
3. Open `ArchipelagoLauncher.exe`
4. Select "Open Patch" on the left side and select your patch file.
5. If this is your first time patching, you will be prompted to locate your vanilla ROM.
6. A patched `.gb` file will be created in the same place as the patch file.
7. On your first time opening a patch with BizHawk Client, you will also be asked to locate `EmuHawk.exe` in your
BizHawk install.

You must connect Super Mario Land 2 to a server, even for a single player game, or progress cannot be made.

### Connect to the Multiserver

By default, opening a patch file will do steps 1-5 below for you automatically. Even so, keep them in your memory just
in case you have to close and reopen a window mid-game for some reason.

1. Super Mario Land 2 uses Archipelago's BizHawk Client. If the client isn't still open from when you patched your
game, you can re-open it from the launcher.
2. Ensure EmuHawk is running the patched ROM.
3. In EmuHawk, go to `Tools > Lua Console`. This window must stay open while playing.
4. In the Lua Console window, go to `Script > Open Script…`.
5. Navigate to your Archipelago install folder and open `data/lua/connector_bizhawk_generic.lua`.
6. The emulator may freeze every few seconds until it manages to connect to the client. This is expected. The BizHawk
Client window should indicate that it connected and recognized Super Mario Land 2.
7. To connect the client to the server, enter your room's address and port (e.g. `archipelago.gg:38281`) into the
top text field of the client and click Connect.

To connect the client to the multiserver simply put `<address>:<port>` on the textfield on top and press enter (if the
server uses password, type in the bottom textfield `/connect <address>:<port> [password]`)
Comment on lines +74 to +75
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples of these would be helpful, since it comes up a lot

Loading
Loading