How to setup a project - ArsonAssassin/Archipelago.Core GitHub Wiki
- Visual Studio
- An internet connection
Fork the Maui Template Project
Rename the files according to your project, and fill in the template with details specific to your game.
We must to set up how we connect to a game. There are several built in clients for emulators, otherwise you can use the GenericGameClient. An example is included in the template project.
ePSXeClient gameClient = new ePSXeClient();
// GenericGameClient gameClient = new GenericGameClient("MyGame");
var connected = gameClient.Connect();
if(!connected)
{
MainForm.WriteLine("Could not connect to ePSXe process");
return;
}
At this point, you can make use of the Memory functions, and if you so choose, can implement your own logic for sending locations, receiving items, and completing the goal. Otherwise, you can make use of the built in functionality by completing the following steps.
After the client has logged in, you can pass a List to Client.PopulateLocations(); This will automatically send a location check when a given memory address value matches a criteria. a location has the following properties.
public ulong Address { get; set; }
public int AddressBit { get; set; }
public string Name { get; set; }
public int Id { get; set; }
public LocationCheckType CheckType { get; set; }
public string CheckValue { get; set; }
public LocationCheckCompareType CompareType { get; set; }
- Address: This is the Memory Address that you want to monitor for this location
- AddressBit: In the case of a binary value, this tells the client which bit of memory is the correct flag for this check.
- Name: The name of the location
- Id: The Archipelago Id of the location
- CheckType: This tells the client which Data Type is being checked. Currently supports Bit, Int, UInt, Byte
- CheckValue: If not using a Bit type, this allows you to specify the value to compare against
- CompareType: This allows you to determine the type of comparison used. Options are Match (default, requires an exact match), GreaterThan, LessThan
To receive items from the client, you can register to Client.ItemReceived. This event will provide a model containing the item id, and the location id that it came from. You can then write the code your implementation uses to give this item to the player. for example:
Client.ItemReceived += Client_ItemReceived;
private static void Client_ItemReceived(object? sender, ItemReceivedEventArgs e)
{
var itemId = e.Item.Id;
var itemToReceive = AllItems.First(x => x.Id == itemId);
if (itemToReceive != null)
{
AddItem((int)itemToReceive.Category, itemToReceive.Id, 1);
}
}
The way a game handles being sent an item will vary from game to game so I can't provide a specific example of how AddItem might be implemented.