lisa wrote:Ok I added in some prints into GetIdName and also GetItemAddress and the prints tell me the romscripts weren't done. Time was still longer than doing the umlauts code.
That's probably because all the ids you looked up were already substantiated. It probably doesn't come across unsubstantiated ids very often. Actually, all object in memory are already in memory so would already be substantiated.
lisa wrote:The GetIdAddressLine() is pretty indepth though so not really surprising to me now that it takes longer.
It's amazing what we have managed to do with that file. I would never have been able to figure out that stuff myself and I still can't quite wrap my head around how the searching works.
lisa wrote:I changed all of the getProc() in that file memorytable.lua to be proc and the time to do it with GetIdName is pretty much the same as with the umlauts code. So that is a huge performance increase on GetIdName() atleast.
That's a good idea.
lisa wrote:If the addresses all move when zoning though this would ruin the idea of course, I have been testing this by using the GetIdName in a print and then zoning and doing it again, it seems to be working fine but without more thorough testing it is hard to say if it will hold true or not.
Remember, we used to do an initial scan at bot startup and use a table of addresses that didn't change. So my guess is they don't change. I wonder though what happens if your table gets huge. Probably not much, seeing as the table is listed by id, so accessing it would always be quick. BTW, this makes a nice difference to the speed.
lisa wrote:I originally started to look at making the id search more efficient but to get there in around 15 tries is pretty damn good. Always starts at mid point, 512047 and takes approx 15 steps to get to the right Id.
Concidering how many ids there are, that's impressive. This is the bit I don't understand. I'm not sure how the pointers are structured to be able to find the id so quickly.
I don't think you can improve the way it searches. It pretty much searches the way the game does and finds the id in the fewest number of hops. But maybe you can make each step more efficient. Maybe use batch read to read the few addresses it does read. I just tested it, it didn't make any measurable difference. 200ms to do object list update either way.
lisa wrote:doing more on the batch reads, it is really efficient
Yeah I like the batch reads for object but I'm not sure I like the idea of adding pawn info to the object class. I don't think it's good programming practice and I think in the end it will cause more problems than it's worth. It may not even make that much difference in the end. After all, one of the big advantages with reading one value at a time is you can avoid reading anymore memory values if a particular value check fails. Plus pawn is now just values, it's also functions such as 'exists' and 'isFriend'.
I noticed in object.lua you assigned the attackableflag to self.attackableFlag but then proceeded to use the attackableFlag variable (minus the "self."). Fixing that adds a little time.
lisa wrote:changed findenemy to not create a pawn and there was a slight decrease in time but only around 300 ms.
I'm not surprised. Remember, if it doesn't pass the object check it doesn't even create the pawn. And if it does create the pawn it only updates values until the first failed check. So the only objects, that would update all the values that your object class adds, are fully valid mobs. Even though memoryReadBatch is fast, you are reading all those values for every object regardless of what type they are.