Any sort of map validator?

Starcleaver

Chieftain
Joined
Oct 3, 2010
Messages
12
So, I spent the better part of a couple days working on a map for myself.

For all of that time until of the end of the night last night the map worked fine in testing. I would load it up in a game do a "reveal all" in the console, and validate that things were spawning as intended. All was well. I was about ready to finish it up.

I placed a couple of last city state start points, tweaked some tiles here and there, and suddenly, now, I'm getting a crash upon reveal all.

I'm convinced that, since the crash only occurs when I do reveal all, or even explore all, that it's something terrain related. I'm afraid it's something bad like an errant river or cliff that got plopped down in the middle of the ocean or something like that; maybe even something not actually rendering on the map maker, not being removed during game load, and causing a crash when it is revealed. I've gone over lots of areas so far, checked some rivers and things (obviously the areas where I made changes especially), but can't find the culprit.

Is there a map validator out there somewhere? Or, if I were better versed with Firetuner (I'm mostly good with World Builder and file editing to link things up), I guess I could cheat myself up some super units to explore the map in-game tile by tile until I came across the offending area that creates the game crash.

Anyways, I was bummed when I went to bed last night. Don't want to start this map over. And in the future, I have a better idea about how to go about my editing to prevent this situation from happening again, but it doesn't much help for this current map. Alas.
 
not a map validator, but the following may help you to see where it happens:

try to add this in a new action control in a gamecore context tab of the firetuner and press the new button...

lower g_Pause and raise g_LoopPerResume to make it reveal the map faster.

Code:
g_Timer = 0
g_Pause = 0.25
g_LoopPerResume = 1

function LaunchScriptWithPause()
    print("LaunchScriptWithPause")
    Events.GameCoreEventPublishComplete.Add( CheckTimer )
end
--Events.LoadScreenClose.Add( LaunchScriptWithPause ) -- launching the script when the load screen is closed, you can use your own events

function StopScriptWithPause() -- GameCoreEventPublishComplete is called frequently, keep it clean

    print("StopScriptWithPause")
    Events.GameCoreEventPublishComplete.Remove( CheckTimer )
end

function ChangePause(value)
    print("changing pause value to ", value)
    g_Pause = value
end

ExploreMap = coroutine.create(function()

    print("ExploreMap")

    if (Game.GetLocalPlayer() ~= -1) then
        local pVis = PlayersVisibility[Game.GetLocalPlayer()];
        print("pVis", pVis)

        local counter = 0
        for iPlotIndex = 0, Map.GetPlotCount()-1, 1 do
            local plot = Map.GetPlotByIndex(iPlotIndex)
            print("x,y = ",plot:GetX(), plot:GetY(), " iPlotIndex = ", iPlotIndex)
            pVis:ChangeVisibilityCount(iPlotIndex, 0);
            if counter >= g_LoopPerResume then
                counter = 0
                --print("requesting pause in script for ", g_Pause, " seconds at time = ".. tostring( Automation.GetTime() ))
                g_Timer = Automation.GetTime()
                coroutine.yield()
                -- after g_Pause seconds, the script will start again from here
                --print("resuming script at time = ".. tostring( Automation.GetTime() ))            
            end
                counter = counter + 1
        end
    end
    StopScriptWithPause()
end)

function CheckTimer()
    if Automation.GetTime() >= g_Timer + g_Pause then
        g_Timer = Automation.GetTime()
        coroutine.resume(ExploreMap)
    end
end
  
LaunchScriptWithPause()

edit:
change
Code:
pVis:ChangeVisibilityCount(iPlotIndex, 0);
to
Code:
pVis:ChangeVisibilityCount(iPlotIndex, 1);
if you want to "reveal" instead of "explore"
 
Last edited:
Thank you, this would be extremely helpful. I'll need to brush up on Firetuner, admittedly, but this sort of incremental reveal would be absolutely ideal for figuring out whereabouts the issue is. At least, I hope it should be. I'll try to get this working and see how things turn out. Much appreciated.
 
UPDATE: Thank you so much Ged. This worked. It turned out that not only did I have one bad tile, but two. There appeared to be absolutely nothing wrong with them as far as I could tell. I changed them around terrain wise, and a few tiles near them for good measure, and eventually changed them back to be nearly what they were at the start, and now the map works again without issue.

I would never have found those without your script code. Thank you again. You're the BEST!
 
Back
Top Bottom