0 Favourites

Regenerating obstacle map for one object?

  • I wanted a have a large map with blocks that could be destroyed. I set up an experiment to destroy a block on click and regenerate the obstacle map right then, and the frame rate goes down for each character that needs to regenerate the obstacle map. Just one character regenerating an obstacle map reduces frame rate by 10 or more for about 3 seconds. With multiple characters it gets to the point where the frame rate is in the teens for a few seconds, and it used to run at a smooth 60. All that for one block destroyed.

    Why can't it just take into account the one block that got destroyed? Why does it need to recalculate the ones that didn't change? I have tried to figure out a way to limit how big of an area it can recalculate, but nothing lets me combine it with regenerate obstacle map.

    My game is a tile based and turn based game. The characters can only move so much at a time. I thought I could limit the regenerating of the obstacle map to only as far as they could move, but it just wants to do the whole map. I also thought maybe using line of sight or a distance check around the character would work, but it doesn't allow these checks (or at least I couldn't figure it out).

    I also didn't have any luck with adding or removing custom obstacles. There didn't seem to be any way for it to work. I could have been doing it wrong I guess.

    I just don't seen any way of being able to destroy tiles/blocks and have pathfinding at the same time. It's just too expensive.

    Here are some things I either tried or was going to try but couldn't figure out how.

    1. each character has a line of sight set to custom so they can see through things, and then maybe limit it to 100 or 200 distance, then regenerate obstacle map within that.

    2. do a compare two values distance check around a character when doing the regeneration.

    3. checking on collision if object has been destroyed then regenerating for that area or removing that object from the custom pathfinding obstacles.

    4. when an object is destroyed that instance is removed from custom obstacles or a path is creating where the object was.

    5. when regenerating an obstacle map, it only considers objects that have changed and ignores the ones that are still the same.

    6. putting a large sprite around a character to test for collisions and see if obstacles are there anymore. I don't know.

    I just couldn't get anything to let me use it to modify the pathfinding behavior.

    It would be nice to have it so each character would only check their immediate surroundings such as a distance of 100 for changes when they regenerate the map. Alternatively, maybe just if they got hung up on an object that's not there they would recalculate it again just in a radius of 100 or so.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Hmm, well I can't figure anything out. I guess I'll have to do without destructible environments. Regenerating an obstacle map is just too draining and has too much impact on FPS.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
81 11,900
LaurenceBedford's avatar
LaurenceBedford
Unread hot topic
0 Favourites
[PLUGIN] Google Map
118 34,680
eryson27's avatar
eryson27
Unread hot topic
132 10,994
Burvey's avatar
Burvey