Currently, I have 50 entities (51 counting the player) on the dungeon level. Rebuilding the FoVs every turn for every entity is a bit.. slow. Anyone have any input on how to speed things up? Here's what I'm currently doing:
BuildMap():
Builds the FoV Map around the entity based on it's sight. If it has a sight of 5, it loops through position.x-5, position.y-5 to position.x+5, position.y+5
Create Entity
- Initiate FoV Map, which is the size of the level
- BuildMap()
Entity Turn
- BuildMap()
- ComputeFoV()
- check if player pos is in FoV
- Path to player if he is, rebuild path if he has moved
I'm currently rebuilding the FoV every turn even if the entity hasn't moved just in case the player steps into the FoV. This has really slowed down my game though, so it's a bit unacceptable.
Edit: disregard. got some sleep and realized I only needed to build the map once