I need to fill about 6MB of memory per frame, fast algor needed

Started by
11 comments, last by TrianglesPCT 9 years, 6 months ago

std::vector of what?

And where does the data come from which you are filling it with? Is it calculated? A constant value? Copying it? Is it some transformation of existing data?

a vector of booleans

Actually, I am working on a cooperative pathfinding stuff, In every frame, because I am using a dual map approach, one map to astar and one for cooperative pathfinding, when astar finishes, it starts in fill in this pixelated cooperative pathfinding map (a vector of booleans), if the path is reserved this way, all the pixels that the bounding box of the object casting on, will be reserved.

So say an agent is 30x30 - 40x40 pixels wide, I need to preserve 255 steps in advance and I have about 20 agents, so that's about

30x30x255x20 = 5MB

THX

I'm a little confused, are you doing per pixel pathfinding? Is each agent actually taking up 30x30 grid squares in your pathfinding grid? That seems like a insanely high amount of grid resolution.

Advertisement

I still don't get why this has to happen every frame.

Just because an entity is moving every frame doesn't mean you have to run A* every frame - you only run A* when your path changes, and you save the path itself.

std::vector<bool> happens to be implemented using bits instead of bytes, so you might as well use that instead of hacking in your own implementation on top of it.

This topic is closed to new replies.

Advertisement