My game is what I call a ‘phased’ game. That is to say, I move, the AI moves and then everything is resolved. The problem that I’m having is that during the ‘while everything is resolved’ phase, nothing is getting updated to the screen.
For example. I’ve given a bunch of orders and now I click on End Turn:
And after about 15 seconds:
As you can see, the units have moved, the ‘Fog of War’ has been updated, lots of stuff behind the scenes have happened BUT what didn’t happen is a series of text draws to the top of the screen telling the user what’s going on (it’s fine for the game to go away for 20 seconds IF it’s telling the user what’s going on and has a thermometer; which I’ll add eventually).
Here’s a code snippet from Draw():
if (EndTurn)
{
Display.DisplayBanner(spriteBatch, TopBannerSmythe, "Calculating Movement...");
ProcessTurn.ProcessEndTurn();
// Probably a ton of stuff that needs to be reset.
CurrentGameTime += TimeSpan.FromMinutes(MinutesPerTurn);
CurrentGameTurn++;
Display.DisplayBanner(spriteBatch, TopBannerSmythe, "Calculating Strategic AI...");
RedSAIDS = Loading.LoadRedSAIDS();
BlueSAIDS = Loading.LoadBlueSAIDS();
Display.DisplayBanner(spriteBatch, TopBannerSmythe, "Calculating Fog of War...");
if (ActiveArmy)
{
TacticalAILib.FogOfWar.CalculateFoW(true, BlueArmy, RedArmy, FogOfWar, VisibilityMeters);
}
else
{
TacticalAILib.FogOfWar.CalculateFoW(false, BlueArmy, RedArmy, FogOfWar, VisibilityMeters);
}
HideInvisibleUnits(BlueArmy, RedArmy);
Display.DisplayBanner(spriteBatch, TopBannerSmythe, "Calculating Range of Influence...");
ROI.CalculateROI(BlueArmy, Map.MetersPerPixel);
ROI.CalculateROI(RedArmy, Map.MetersPerPixel);
if (IsSimulation)
{
Display.DisplayBanner(spriteBatch, TopBannerSmythe, "Calculating Courier Paths...");
CalculateCourierPaths();
}
SetupCorpsLists();
DisplayFoW();
DrawUnits();
Mouse.SetCursor(MouseCursor.Arrow);
EndTurn = false;
} /// Here endeth End Turn
And here is a snippet from Update()
if (lastMouseState.LeftButton == ButtonState.Released
&& currentMouseState.LeftButton == ButtonState.Pressed
&& TabIndex == (int)TabNames.Checklist // Checklist
&& ms.X < LeftMapOffset
&& ms.Y > 800)
{
// clicked on End Turn
EndTurn = true;
GivingOrders = false;
TabIndex = (int)TabNames.Scenario;
Mouse.SetCursor(MouseCursor.Wait);
}// clicked on End Turn
And that assignment should change the tab to the Scenario Tab (2nd image, above) but it doesn’t. So, maybe that’s a clue, too.
Do you see all those Display.DisplayBanner() calls? That should be putting all these text messages up on the top of the screen where “Note: that all streams on this map are marked as mud terrain,” is. That’s how it got up there (by using DisplayBanner().
So, clearly, Draw() is getting bogged down or something. Any suggestions?
Again, thanks for all the help. This forum - and MonoGame - rocks.