strategyonly
C2C Supreme Commander
Without those movement changes the same turn took only a few minutes. I have to see if i can find that save and upload it here.
Definitely, thx
Without those movement changes the same turn took only a few minutes. I have to see if i can find that save and upload it here.
I can believe that. Unfortunately I'm not sure if there's a better way to accomplish the same effect. Again, perhaps checkPlot might be able to take on a 3rd function run and that might be a lot less time-costly. I'll have to get that save and play around with that as an alternative.In the right conditions those unit movements changes cause huge slowdowns that can't happen. It might not be visible in your game using the internal profiler and that is exactly what i was saying a few months back. It only appears as noise in the profiler logs until you have the right conditions and then you are able to see it really slowing down the turn time. The main problem is that the code you have added causes too much recursive looping through units, the same thing happened in the healer build evaluation.
You end up with far too many calls to CvUnit* getUnit(IDInfo unit). That leads too alot of spin time because of the CriticalSections needed for the multithreading. I'am not sure but i think the internal profiler doesn't show the spin time so you can only see it in the turn times.
I had a save somewhere that had a bit over 50 minutes turn time and after my changes it was down to ~20 minutes. Without those movement changes the same turn took only a few minutes. I have to see if i can find that save and upload it here.
if (pPlot != NULL)
{
CLLNode<IDInfo>* pUnitNode = pPlot->headUnitNode();
bool bFound = false;
while(pUnitNode != NULL)
{
CvUnit* pUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = pPlot->nextUnitNode(pUnitNode);
if (pUnit && pUnit != this && GET_PLAYER(pUnit->getOwnerINLINE()).getTeam() == eTeam)
{
if (isEnemy(eTeam) || isAlwaysHostile(pPlot) || pUnit->isAlwaysHostile(pPlot))
{
bFound = true;
if (!canUnitCoexistWithEnemyUnit(pUnit,pPlot))
{
return false;
break;
}
}
}
}
if (bFound)
{
return true;
}
}
<snip>
I just lost my job (again - gotta love these damned call centers where no position is safe and hiring and firing is done on the slightest whim) so I MAY have additional time to work on this now - probably even more when I do find another position - this last one was taking up 12 hrs a day. However, next week and the next week after that we have family visiting so RL will definitely get in the way of further work on a solution during that time. We'll see how much I can get done between now and then.
EDIT: VERY nice to have ya back Joe!
@Alberts2: If you can get me that save you were using I can test it against a very simple change I believe will make a very big impact on turn times provided there are large stacks in play. I believe there were many thousands of checks that cycled the canUnitCoexistWithEnemyUnit function that could be very simply averted. It won't eliminate all of them but most of the ones that should be taking up a ton of unnecessary processing time. Again, a very simplistic fix but it may well be what was needed.
EDIT: NVM the simple solution doesn't quite work as intended. Will take more evaluating.
edit The AI is making good use of the fact that workers and other zero strength wont be attacked.
edit The AI is making good use of the fact that workers and other zero strength wont be attacked.
Yeah, that had something to do with it. That and that there's very few places in the Unit AI codes where the AI will consider such an attack. However, where it generally is I've corrected and will commit to the SVN tomorrow.
any idea when 36 will be released? I'm thinking i might get back into the map modding when it comes out.
No idea when. There is at least one serious issue, workers not being attacked, still left to resolve.
I will be introducing two new terrain types after it does Lake and Lake Shore for fresh water lakes. They are equivalent to Ocean and Coast in nature. I could add them into v36 and not implement them ie not have them appear in game until after v36 for the map makers.