Understanding Pointer Chains
In games, data structures like player health are often allocated dynamically and move around in memory. However, you can reach them by following a chain of pointers from a static base address.Anatomy of a Pointer Chain
Deep Pointer Example
This real-world example from the README demonstrates using a pointer chain from Cheat Engine to access player health:How It Works
Find the Base Address
Start with a static address - typically a module base plus an offset. This base address never changes between game restarts.
Define the Offset Chain
Create an array of offsets that describe the path through memory. These offsets are found using tools like Cheat Engine.
Resolve the Chain
Call
deep_pointer_ex to follow each pointer in the chain, dereferencing and adding offsets until reaching the final address.Internal Process Pointer Chains
For the current process, use the non-Ex variant:
Finding Pointer Chains
Pointer chains are typically discovered using memory scanning tools:Using Cheat Engine
Find the Value
Use Cheat Engine’s value scanning to locate the address of your target data (e.g., player health).
Perform Pointer Scan
Right-click the address and select “Pointer scan for this address”. This searches for pointer chains that lead to it.
Filter Results
Restart the game and rescan to filter out invalid pointer paths. Valid paths will still point to the same data.
Common Patterns
Single-Level Pointer
Two-Level Pointer
Multi-Level Pointer Chain
Error Handling
Always check if pointer resolution succeeded:Best Practices
Validate Pointer Chains
Validate Pointer Chains
Always check if
deep_pointer_ex returns a valid address. Invalid chains return LM_ADDRESS_BAD or None.Use the Shortest Chain
Use the Shortest Chain
Shorter pointer chains are more reliable and less likely to break when the game updates.
Cache Base Addresses
Cache Base Addresses
Module base addresses don’t change during runtime, so cache them instead of looking them up repeatedly.
Re-resolve After Game Updates
Re-resolve After Game Updates
Game updates may change offsets. Be prepared to re-scan pointer chains after patches.
Handle Dynamic Structures
Handle Dynamic Structures
Some data may be NULL or invalid depending on game state (e.g., no player loaded). Add validation.
Common Use Cases
- Player Stats: Health, mana, stamina, experience points
- Inventory Items: Item counts, equipment stats
- Game State: Level ID, checkpoint data, quest flags
- Entity Data: Enemy health, positions, AI states
- Resource Pools: Ammunition, currency, crafting materials
Troubleshooting
Pointer Chain Returns NULL
Pointer Chain Returns NULL
- Verify the base address is correct (module.base + offset)
- Check if the game state has changed (e.g., not in a level yet)
- Ensure offsets are in the correct order
- Re-scan pointer chain with Cheat Engine
Value Doesn't Update
Value Doesn't Update
- Pointer chain may be stale after a game update
- Game might be using a different instance of the data
- Try refreshing the pointer scan
Game Crashes
Game Crashes
- Pointer chain may be invalid, leading to bad memory access
- Add validation before reading/writing
- Ensure offsets are correct size for the target architecture
Next Steps
Memory Operations
Learn basic read/write operations
Memory API
Explore all memory functions