Core & LttP: remove 255 player limit

This commit is contained in:
Fabian Dill 2021-10-21 08:15:47 +02:00
parent 8fbbaf7fcb
commit 2fe5459c56
7 changed files with 19 additions and 14 deletions

View File

@ -37,7 +37,7 @@ def mystery_argparse():
parser.add_argument('--player_files_path', default=defaults["player_files_path"], parser.add_argument('--player_files_path', default=defaults["player_files_path"],
help="Input directory for player files.") help="Input directory for player files.")
parser.add_argument('--seed', help='Define seed number to generate.', type=int) parser.add_argument('--seed', help='Define seed number to generate.', type=int)
parser.add_argument('--multi', default=defaults["players"], type=lambda value: min(max(int(value), 1), 255)) parser.add_argument('--multi', default=defaults["players"], type=lambda value: max(int(value), 1))
parser.add_argument('--spoiler', type=int, default=defaults["spoiler"]) parser.add_argument('--spoiler', type=int, default=defaults["spoiler"])
parser.add_argument('--rom', default=options["lttp_options"]["rom_file"], help="Path to the 1.0 JP LttP Baserom.") parser.add_argument('--rom', default=options["lttp_options"]["rom_file"], help="Path to the 1.0 JP LttP Baserom.")
parser.add_argument('--enemizercli', default=defaults["enemizer_path"]) parser.add_argument('--enemizercli', default=defaults["enemizer_path"])
@ -46,7 +46,7 @@ def mystery_argparse():
parser.add_argument('--meta_file_path', default=defaults["meta_file_path"]) parser.add_argument('--meta_file_path', default=defaults["meta_file_path"])
parser.add_argument('--log_output_path', help='Path to store output log') parser.add_argument('--log_output_path', help='Path to store output log')
parser.add_argument('--log_level', default='info', help='Sets log level') parser.add_argument('--log_level', default='info', help='Sets log level')
parser.add_argument('--yaml_output', default=0, type=lambda value: min(max(int(value), 0), 255), parser.add_argument('--yaml_output', default=0, type=lambda value: max(int(value), 0),
help='Output rolled mystery results to yaml up to specified number (made for async multiworld)') help='Output rolled mystery results to yaml up to specified number (made for async multiworld)')
parser.add_argument('--plando', default=defaults["plando_options"], parser.add_argument('--plando', default=defaults["plando_options"],
help='List of options that can be set manually. Can be combined, for example "bosses, items"') help='List of options that can be set manually. Can be combined, for example "bosses, items"')

View File

@ -25,6 +25,7 @@ from NetUtils import *
from worlds.alttp import Regions, Shops from worlds.alttp import Regions, Shops
from worlds.alttp import Items from worlds.alttp import Items
from worlds.alttp.Rom import ROM_PLAYER_LIMIT
import Utils import Utils
from CommonClient import CommonContext, server_loop, console_loop, ClientCommandProcessor, gui_enabled, init_logging from CommonClient import CommonContext, server_loop, console_loop, ClientCommandProcessor, gui_enabled, init_logging
@ -867,7 +868,8 @@ async def game_watcher(ctx: Context):
snes_buffered_write(ctx, RECV_PROGRESS_ADDR, bytes([recv_index & 0xFF, (recv_index >> 8) & 0xFF])) snes_buffered_write(ctx, RECV_PROGRESS_ADDR, bytes([recv_index & 0xFF, (recv_index >> 8) & 0xFF]))
snes_buffered_write(ctx, RECV_ITEM_ADDR, bytes([item.item])) snes_buffered_write(ctx, RECV_ITEM_ADDR, bytes([item.item]))
snes_buffered_write(ctx, RECV_ITEM_PLAYER_ADDR, bytes([item.player if item.player != ctx.slot else 0])) snes_buffered_write(ctx, RECV_ITEM_PLAYER_ADDR,
bytes([min(ROM_PLAYER_LIMIT, item.player) if item.player != ctx.slot else 0]))
if scout_location > 0 and scout_location in ctx.locations_info: if scout_location > 0 and scout_location in ctx.locations_info:
snes_buffered_write(ctx, SCOUTREPLY_LOCATION_ADDR, bytes([scout_location])) snes_buffered_write(ctx, SCOUTREPLY_LOCATION_ADDR, bytes([scout_location]))
snes_buffered_write(ctx, SCOUTREPLY_ITEM_ADDR, bytes([ctx.locations_info[scout_location][0]])) snes_buffered_write(ctx, SCOUTREPLY_ITEM_ADDR, bytes([ctx.locations_info[scout_location][0]]))
@ -899,8 +901,6 @@ async def main():
parser.add_argument('--connect', default=None, help='Address of the multiworld host.') parser.add_argument('--connect', default=None, help='Address of the multiworld host.')
parser.add_argument('--password', default=None, help='Password of the multiworld host.') parser.add_argument('--password', default=None, help='Password of the multiworld host.')
parser.add_argument('--loglevel', default='info', choices=['debug', 'info', 'warning', 'error', 'critical']) parser.add_argument('--loglevel', default='info', choices=['debug', 'info', 'warning', 'error', 'critical'])
parser.add_argument('--founditems', default=False, action='store_true',
help='Show items found by other players for themselves.')
if not Utils.is_frozen(): # Frozen state has no cmd window in the first place if not Utils.is_frozen(): # Frozen state has no cmd window in the first place
parser.add_argument('--nogui', default=False, action='store_true', help="Turns off Client GUI.") parser.add_argument('--nogui', default=False, action='store_true', help="Turns off Client GUI.")
args = parser.parse_args() args = parser.parse_args()

View File

@ -22,7 +22,7 @@ player's game, they may find items which belong to the other player. If player A
player B, the item will be sent to player B's world over the internet. player B, the item will be sent to player B's world over the internet.
This creates a cooperative experience during multi-world games, requiring players to rely upon each other to complete This creates a cooperative experience during multi-world games, requiring players to rely upon each other to complete
their game. Currently, a maximum of 255 players can participate in a single multi-world. their game.
## What happens if a person has to leave early? ## What happens if a person has to leave early?
If a player must leave early, they can use Archipelago's forfeit system. When a player forfeits their game, all If a player must leave early, they can use Archipelago's forfeit system. When a player forfeits their game, all

View File

@ -19,7 +19,7 @@ def parse_arguments(argv, no_defaults=False):
# we need to know how many players we have first # we need to know how many players we have first
parser = argparse.ArgumentParser(add_help=False) parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--multi', default=defval(1), type=lambda value: min(max(int(value), 1), 255)) parser.add_argument('--multi', default=defval(1), type=lambda value: max(int(value), 1))
multiargs, _ = parser.parse_known_args(argv) multiargs, _ = parser.parse_known_args(argv)
parser = argparse.ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter) parser = argparse.ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
@ -238,7 +238,7 @@ def parse_arguments(argv, no_defaults=False):
For unlit dark rooms, require the Lamp to be considered in logic by default. For unlit dark rooms, require the Lamp to be considered in logic by default.
Torches means additionally easily accessible Torches that can be lit with Fire Rod are considered doable. Torches means additionally easily accessible Torches that can be lit with Fire Rod are considered doable.
None means full traversal through dark rooms without tools is considered doable.''') None means full traversal through dark rooms without tools is considered doable.''')
parser.add_argument('--multi', default=defval(1), type=lambda value: min(max(int(value), 1), 255)) parser.add_argument('--multi', default=defval(1), type=lambda value: max(int(value), 1))
parser.add_argument('--names', default=defval('')) parser.add_argument('--names', default=defval(''))
parser.add_argument('--outputpath') parser.add_argument('--outputpath')
parser.add_argument('--game', default="A Link to the Past") parser.add_argument('--game', default="A Link to the Past")

View File

@ -5,6 +5,7 @@ from Patch import read_rom
JAP10HASH = '03a63945398191337e896e5771f77173' JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = 'e397fef0e947d1bd760c68c4fe99a600' RANDOMIZERBASEHASH = 'e397fef0e947d1bd760c68c4fe99a600'
ROM_PLAYER_LIMIT = 255
import io import io
import json import json
@ -787,7 +788,7 @@ def patch_rom(world, rom, player, enemized):
rom.write_byte(location.player_address, 0xFF) rom.write_byte(location.player_address, 0xFF)
elif location.item.player != player: elif location.item.player != player:
if location.player_address is not None: if location.player_address is not None:
rom.write_byte(location.player_address, location.item.player) rom.write_byte(location.player_address, min(location.item.player, ROM_PLAYER_LIMIT))
else: else:
itemid = 0x5A itemid = 0x5A
location_address = old_location_address_to_new_location_address.get(location.address, location.address) location_address = old_location_address_to_new_location_address.get(location.address, location.address)
@ -1653,8 +1654,10 @@ def patch_rom(world, rom, player, enemized):
rom.write_bytes(0x7FC0, rom.name) rom.write_bytes(0x7FC0, rom.name)
# set player names # set player names
for p in range(1, min(world.players, 255) + 1): for p in range(1, min(world.players, ROM_PLAYER_LIMIT) + 1):
rom.write_bytes(0x195FFC + ((p - 1) * 32), hud_format_text(world.player_name[p])) rom.write_bytes(0x195FFC + ((p - 1) * 32), hud_format_text(world.player_name[p]))
if world.players > ROM_PLAYER_LIMIT:
rom.write_bytes(0x195FFC + ((ROM_PLAYER_LIMIT - 1) * 32), hud_format_text("Archipelago"))
# Write title screen Code # Write title screen Code
hashint = int(rom.get_hash(), 16) hashint = int(rom.get_hash(), 16)
@ -1731,7 +1734,7 @@ def write_custom_shops(rom, world, player):
item_data = [shop_id, item_code] + price_data + \ item_data = [shop_id, item_code] + price_data + \
[item['max'], ItemFactory(item['replacement'], player).code if item['replacement'] else 0xFF] + \ [item['max'], ItemFactory(item['replacement'], player).code if item['replacement'] else 0xFF] + \
replacement_price_data + [0 if item['player'] == player else item['player']] replacement_price_data + [0 if item['player'] == player else min(ROM_PLAYER_LIMIT, item['player'])]
items_data.extend(item_data) items_data.extend(item_data)
rom.write_bytes(0x184800, shop_data) rom.write_bytes(0x184800, shop_data)

View File

@ -15,6 +15,8 @@ def set_rules(world):
player = world.player player = world.player
world = world.world world = world.world
if world.logic[player] == 'nologic': if world.logic[player] == 'nologic':
if player == next(player_id for player_id in world.get_game_players("A Link to the Past")
if world.logic[player_id] == 'nologic'): # only warn one time
logging.info( logging.info(
'WARNING! Seeds generated under this logic often require major glitches and may be impossible!') 'WARNING! Seeds generated under this logic often require major glitches and may be impossible!')

View File

@ -583,6 +583,6 @@ def price_to_funny_price(item: dict, world, player: int):
if any(x in item['item'] for x in price_blacklist[p_type]): if any(x in item['item'] for x in price_blacklist[p_type]):
continue continue
else: else:
item['price'] = min(price_chart[p_type](item['price']) , 255) item['price'] = min(price_chart[p_type](item['price']), 255)
item['price_type'] = p_type item['price_type'] = p_type
break break