shenef / SoS-TAS

Sea of Stars TAS
3 stars 0 forks source link

TAS Inventory management #138

Open orkaboy opened 9 months ago

orkaboy commented 9 months ago

We need to track how much money we are carrying and what items we have in our inventory/equipped. This kind of information can be used to manage the item route.

We could get some of this stuff from memory, but the pickups are also static, so as long as we are following a particular route we can make some assumptions about what we have based on what we have picked up.

Also need to have code for these things:

knutwalker commented 9 months ago

In case it might be helpful, I'm tracking a few key items in the auto splitter and I have this for the inventory memory reading: https://github.com/knutwalker/sea-of-stars-autosplitter/blob/6c7a6a1633a528fcdb8ed7a8ff661bb62c027c31/src/data.rs#L2024-L2054

Some observations

Eein commented 9 months ago

In case it might be helpful, I'm tracking a few key items in the auto splitter and I have this for the inventory memory reading: https://github.com/knutwalker/sea-of-stars-autosplitter/blob/6c7a6a1633a528fcdb8ed7a8ff661bb62c027c31/src/data.rs#L2024-L2054

Some observations

  • I haven't really found a item_type field, but every different kind of item has its own subclass of IventoryItem. In order to check what kind an item is, I had to implement an instanceof check. At the end, it's probably easier to build a list of item ids and map them to whatever item type you want (that's what I am doing now as well). Maybe you find a better though
  • the money you have is separate in the CurrencyManager, but I haven't mapped them because I didn't need it for the autosplitter. I did play around with it in CE at one point, it's quite similar to the Inventory at the end
  • I haven't looked at reading weapon stats or anything like that because I only needed to track certain KeyItems for the autosplitter

It seems we came to the same conclusion for how we should handle these item objects

i believe weapons follow a similar setup as items, which we will have to map to ids and add up at runtime.

Thanks for the additional research!

orkaboy commented 9 months ago

The code I've written so far is mostly to track and reason about these things, but if we can get some/all info from memory that is ofc better. I think the code will still be useful since we can use it to route and reason about things that we don't have yet.

orkaboy commented 7 months ago

Shop inventory has been implemented, but there is a strange behavior in the memory bits when items are sold. This messes up the list exposed to the TAS. A bit unclear what's going on right now.