-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershacktoberfestmodtoberfest
Description
Feature description
Hey,
I've been experimenting with making my own map rendering engine, and I'd like to leave some tips for just better overall performance:
There are 3 ways you can approach raycasting, it seems like you're doing method 1:
Method 1:
- Grab the start location, and add a very tiny miniscule offset, increment by that offset until you reach a frame. (It takes about 5 * 1/offset * distance operations, if your offset is 1/128, you're doing 640 iterations, measures at about 3ms / cast on my machine
Method 2 (1+):
- Grab the start location, and increment by the normalized offset, until there's a frame at the current block. Then, do a finer cast through method one (1-5 + (1/offset iterations, if there is a frame)) - About 5x better, measures at about 0.1ms / cast on my machine
Method 3:
- Grab the start location, and increment by the normalized offset. If there is a frame at the current block, estimate the frame's bounding box by grabbing the frame's center location, and shifting in the opposite direction of where the frame is looking at, you'll always end up with ceil(distance) iterations, instead of <DISTANCE * STEPS_PER_BLOCK>, measures at about 0.015ms / cast on my machine
Further optimizations:
- Cache the converted colors of your ColorMap, from what I've measured, mapping colors takes about 90 microseconds per color, but marginally less if cached.
Relevant issues
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershacktoberfestmodtoberfest