Posted: Wed Feb 16, 2011 7:09 pm Post subject: Efficiently scanning memory, optimizations?
Here's my problem: the game in question contains an array of structures, each containing a string and a pointer among other things. I need to search through this array in my program to find the right structure. Each structure is 32 bytes and there's a few thousand of them in the array. The one structure I'm looking for is at an arbitrary location and can only be identified by the string. I need to find my structure as quickly as possible.
Is using ReadProcessMemory repeatedly on 32 byte chunks slower than reading larger chunks to a big buffer and checking that? What I really want to know is how fast ReadProcessMemory is, and if copying memory over to my own program and working with that will be faster than accessing it in another process.
What are your experiences with this?
------------------
Another part of my program will be to extract the game's level geometry. Should I just extract the BSP tree in its entirety or is ReadProcessMemory fast enough to read thousands of scene polygons without keeping them in a buffer?
Any suggestions you have in optimizing my approach would be helpful. I'm looking to see if the line segment between two players is unobstructed. My approach will be to find the node of the BSP tree that encompasses but does not divide the line segment. At this point, every leaf under this node will contain polygons that possibly intersect my segment, meaning each will be checked. I'm trying to keep the overhead of my program down.
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
Posted: Thu Feb 17, 2011 1:09 pm Post subject:
reading a larger chunk of memory is more efficient as there will be less taskswitching involved
as for what you want to do it might be easier to use code injection into the game itself and make use of internal functions like isInLineOfsight(xxx) (you'll have to find those out yourself) _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
Thanks for the info. I'd do as you suggested with the isInLineOfSight() if I wasn't planning on using the BSP for other purposes too. I probably should have mentioned that.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum