Game Developer Status 10/9/11
I've done about 8 hours in the last few weeks. Not as much as I wanted, but not too bad. I implemented a fire combat AI prototype based on brute force as I mentioned in my previous post. I took all the shortcuts I could, primarily basing it on LINQ. This worked, but was very slow. For three firing units and 7 potential target units, the code produced 392 fire allocations in 446 seconds!
I then proceeded to optimize this code. In the first pass I improved the logic. The code had been doing repeated searches for hexes and enemies in range at the leaf nodes of the processing. By pre-calculating these before running through the permutations, I reduced the time to around 10 seconds.
This was a decent improvement, but not nearly enough to scale for the introductory scenario, let alone the full campaign.
I then profiled the code and saw that it was spending all its time in LINQ-driven code to determine the hexes within a given range/radius. I rewrote this, replacing the LINQ with code based on directional transforms. This reduced the time for the same problem to 0.035 seconds.
That'll do for now.
I've done about 8 hours in the last few weeks. Not as much as I wanted, but not too bad. I implemented a fire combat AI prototype based on brute force as I mentioned in my previous post. I took all the shortcuts I could, primarily basing it on LINQ. This worked, but was very slow. For three firing units and 7 potential target units, the code produced 392 fire allocations in 446 seconds!
I then proceeded to optimize this code. In the first pass I improved the logic. The code had been doing repeated searches for hexes and enemies in range at the leaf nodes of the processing. By pre-calculating these before running through the permutations, I reduced the time to around 10 seconds.
This was a decent improvement, but not nearly enough to scale for the introductory scenario, let alone the full campaign.
I then profiled the code and saw that it was spending all its time in LINQ-driven code to determine the hexes within a given range/radius. I rewrote this, replacing the LINQ with code based on directional transforms. This reduced the time for the same problem to 0.035 seconds.
That'll do for now.
0 Comments:
Post a Comment
<< Home