View Issue Details

IDProjectCategoryView StatusLast Update
0005118The Dark ModMappingpublic13.05.2021 16:36
ReporterDragofer Assigned Tostgatilov  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
OSWindowsOS Version10 
Product VersionTDM 2.07 
Target VersionTDM 2.10Fixed in VersionTDM 2.10 
Summary0005118: No 'Press attack to start' anymore if error message stops first attempt to load map
DescriptionIf the mapper opens TDM to test his map but runs into any error message (i.e. scripting error, entity targets itself etc.), he can fix the error but the map becomes unplayable because the 'Press attack to start' window never shows up.

This bug happens if the error stops the first attempt to load a map after starting TDM.

The workaround for solving this bug is to either restart TDM or load a different map, then load the first map again.
Steps To ReproduceBug reproduction: The attached archive contains a map with a script that has a typo. Attempting to load it will cause an error message. Correcting the typo will let the map load but no 'Press attack to start' shows up so it's unplayable.

1) Extract the attached archive to darkmod/fms/5118/*
2) Start TDM and install the new FM titled: 5118
3) Use console to 'map fd'. You will get a warning that there's an error in the .script and be returned to menu.
4) Alt-tab out of TDM, open fms/5118/maps/fd.script. Change hread to thread in line 9 and save.
5) Alt-tab back to TDM, use console to 'map fd'. The map loads, but no 'Press attack to start' ever appears so you can't play the mission.

To fix, either:
A) Restart TDM, then use the console to 'map fd'
B) Load a different .map, then use the console to 'map fd'
Additional InformationThis has been around at least since TDM 2.04.
TagsNo tags attached.

Relationships

related to 0003763 resolvedgrayman Loading bar progress should better represent actual progress 

Activities

Dragofer

Dragofer

18.02.2021 12:56

developer   ~0013702

Last edited: 18.02.2021 13:06

View 3 revisions

Just saw that my reproduction steps and the test FM are still written in the original form, when I thought that the problem was with dmap (since deleting dmap files and restarting TDM was what I did to solve it back then - but it would already be sufficient to restart TDM or load another map).

Updated repro steps and attachment.
Dragofer

Dragofer

18.02.2021 13:03

developer   ~0013703

5118.pk4 (7,750 bytes)
stgatilov

stgatilov

15.03.2021 16:19

administrator   ~0013791

Last edited: 15.03.2021 16:19

View 2 revisions

In fact, we have a cvar (which is even archived) which controls if this "press attack to start" screen shows up at all.
If you set "tdm_player_wait_until_ready 0", then you will never see this GUI at all, the map will simply start when it gets loaded.

However, if you disable the waiting screen, the game still does not start after error.
So the problem is not with the screen itself, but with something else.
stgatilov

stgatilov

15.03.2021 17:38

administrator   ~0013793

Ok, the reason game did not start was this condition:
   if ( m_time2Start && player->WaitUntilReady() ) // grayman 0003763
More precisely, the m_time2Start flag.

This flag is raised via idGameLocal::SetTime2Start method, which is called in idSessionLocal::RunGameTic:
    // grayman 0003763 - allow "Mission Start" gui if the mission uses it
    if ( ( loadDoneTime > 0 ) && ( Sys_Milliseconds() > loadDoneTime ) )
    {
        game->SetTime2Start();
        loadDoneTime = 0;
    }

The loadDoneTime is set in idSessionLocal::PacifierUpdate under event LOAD_KEY_IMAGES_INTERIM:
        case LOAD_KEY_IMAGES_INTERIM: // loading textures (finer granularity)
            pct += pct_delta;
            if ( (pct >= 1.00f) && (loadDoneTime == 0))
            {
                // 5s delay between load bar at 100% and Mission Start gui display
                loadDoneTime = Sys_Milliseconds() + 5000;
            }
            if ( time - lastPacifierTime < 500 )
            {
                return;
            }
            break;

The thing is: when you reload a map, these image-related pacifier events do not happen.
They do not happen either because of this code in idSessionLocal::ExecuteMapChange (or because images are already loaded):
    // actually purge/load the media
    if ( !reloadingSameMap ) {
        renderSystem->EndLevelLoad();
        soundSystem->EndLevelLoad( mapString.c_str() );
        declManager->EndLevelLoad();
        SetBytesNeededForMapLoad( mapString.c_str(), fileSystem->GetReadCount() );
    }
    uiManager->EndLevelLoad();
As you see, the whole stuff about image progress bar happens only if you change to different map.
In other words, it does not happen if you restart mission, or reload same map after fixing an error.

So the question is: why restarting map usually works, this case does not?
Well, the answer is: the m_time2Start flag is never reset back to false!
As long as you manage to load any map successfully, it has no effect in the future, even if you load a different FM.
And obviously, you cannot "restart FM" or load same map without loading some new/other map first =)

My question is: is this system of loadDoneTime even necessary?
It makes sure that after progress bar hits 100%, at least 5 seconds pass before game starts (yeah, it waits doing nothing if needed).
Note that progress bar hits 100% BEFORE all loading is finished, but by some unpredictable amount of time ( = time for loading last 35 images):
            // the -35 below guarantees there will be
            // some time between the loading bar
            // hitting 100% and the "Mission Loaded / Press Attack" screen
            pct_delta = (LOAD_KEY_DONE_PROGRESS - LOAD_KEY_IMAGES_START_PROGRESS) / (count - 35);

And it actually works only on the very first fresh start of the game.
stgatilov

stgatilov

16.03.2021 04:29

administrator   ~0013794

In the linked thread I see:
   Leave 5s after the loading bar reaches 100% to allow for the reading of any posted tips.
However, when I don't see any specific tips after it hits 100%.

Are there some specific missions which want badly to show something to player at this moment?
Even if there were, it is a bad design, since player can go away and get some coffee during initial load (I think that's the whole point behind "press attack to start" screen).
stgatilov

stgatilov

17.03.2021 02:48

administrator   ~0013796

Found some information on forums:
  https://forums.thedarkmod.com/index.php?/topic/16332-the-mission-loading-process/&do=findComment&comment=348308
  https://forums.thedarkmod.com/index.php?/topic/16368-potential-load-bar-changes/

Here are the quotes:
  Grayman: "I left a couple seconds between arriving at 100% and painting the "Start when ready" screen, in case folks like seeing the "Mission Starting" or "Chill Out" messages."
  Springheel: "Hmm...I know in my missions, and St. Lucia and possibly others, the loading screen displays a "tip" once it hits 100% (ex: "You can lean into doors to eavesdrop on the next room"). It's probably important to make sure there's a good five seconds minimum for those cases."
  Grayman: "I had only noticed tips during the loading bar, not tips appearing afterward. I'll check St. Lucia again (it was one of the 10 I gathered data from). (Edit: Yeah, it posts a tip. Rats.) Adjusting up to 5s shouldn't be a problem. That's a long wait, though, if the mission isn't making use of the screen at that time."

To be honest, I did not notice anything special displayed in New Job...
stgatilov

stgatilov

17.03.2021 02:52

administrator   ~0013797

Yes, there is the tip in Saint Lucia.
But despite the obvious 5000 ms in the code, it only displays for one seconds for me, even on fresh load.
So the whole system does not work anyway.
stgatilov

stgatilov

31.03.2021 03:50

administrator   ~0013822

Discussed here:
  https://forums.thedarkmod.com/index.php?/topic/16332-the-mission-loading-process/&do=findComment&comment=458233

Removed the pause system in svn rev 9231.

I will leave this issue open until I get the opportunity to fix tips in FMs:
  follow
  score_to_settle
  matterofhours
  Builder's Influence.
stgatilov

stgatilov

13.05.2021 16:27

administrator   ~0014008

I'm doing the FMs repacking as the final part of FM database migration (0005551).

Here are related commits (to FM database repo):
  r53 [matterofhours] 0005118. Adjusted mission loading tips.
  r54 [matterofhours] 0005118. Bumped version.
  r55 [follow] 0005118. Adjusted displaying tip in loading GUI.
  r56 [score_to_settle] 0005118. Adjusted time for dispalying tip during mission loading.
  r58 [builders_influence] 0005118. Adjusted tip in mission loading GUI.


In the Matter of Hours, there are two pools of tips, and one tip from each pool is chosen randomly.
I have split time 50 : 50 between two tips.

In Reputation to Uphold (follow), fixed long text is displayed for the most time, and fixed tip is shown when loaded.
After a bit of discussion with Springheel: https://forums.thedarkmod.com/index.php?/topic/16332-the-mission-loading-process/&do=findComment&comment=460494
I split the time 80 : 20 between story text and the tip.

In Score to Settle, there is one pool for story text, and one pool for various tips. One random message is shown from each.
I have split the time 60 : 40 between story text and tip. It feels fine to me.

In Builder's Influence, the long story text is displayed while loading, and tip is displayed when loaded.
Both of them are images (supporting localization), and both of them are fixed (no randomness).
However, story text has different location, color and style, and the two texts look well together.
I have changed it so that story text is displayed always, and tip text shows up after 60% of loading is done.
stgatilov

stgatilov

13.05.2021 16:35

administrator   ~0014009

Also adjusted Saint Lucia mission:
  r16252 [stlucia] 0005118. Adjusted time for displaying tip in Saint Lucia loading screen.

The time is split into showing story text and tip in 70 : 30 proportion.

Issue History

Date Modified Username Field Change
08.01.2020 11:29 Dragofer New Issue
08.01.2020 11:29 Dragofer File Added: dmap_script.pk4
14.02.2020 08:49 Dragofer Summary Dmap fails if the map's .script file has an error => No 'Press attack to start' if an error message stops map loading
14.02.2020 08:49 Dragofer Description Updated View Revisions
14.02.2020 08:49 Dragofer Steps to Reproduce Updated View Revisions
14.02.2020 08:52 Dragofer Description Updated View Revisions
14.02.2020 08:52 Dragofer Steps to Reproduce Updated View Revisions
16.02.2021 08:25 Dragofer Target Version => TDM 2.10
16.02.2021 08:27 Dragofer Summary No 'Press attack to start' if an error message stops map loading => No 'Press attack to start' anymore if error message stops first attempt to load map
18.02.2021 11:57 stgatilov Assigned To => stgatilov
18.02.2021 11:57 stgatilov Status new => assigned
18.02.2021 11:57 stgatilov Priority normal => high
18.02.2021 12:56 Dragofer Note Added: 0013702
18.02.2021 13:03 Dragofer Note Added: 0013703
18.02.2021 13:03 Dragofer File Added: 5118.pk4
18.02.2021 13:03 Dragofer File Deleted: dmap_script.pk4
18.02.2021 13:05 Dragofer Steps to Reproduce Updated View Revisions
18.02.2021 13:05 Dragofer Note Edited: 0013702 View Revisions
18.02.2021 13:06 Dragofer Note Edited: 0013702 View Revisions
15.03.2021 16:19 stgatilov Note Added: 0013791
15.03.2021 16:19 stgatilov Note Edited: 0013791 View Revisions
15.03.2021 17:15 stgatilov Relationship added related to 0003763
15.03.2021 17:38 stgatilov Note Added: 0013793
16.03.2021 04:29 stgatilov Note Added: 0013794
17.03.2021 02:48 stgatilov Note Added: 0013796
17.03.2021 02:52 stgatilov Note Added: 0013797
31.03.2021 03:50 stgatilov Note Added: 0013822
13.05.2021 16:27 stgatilov Note Added: 0014008
13.05.2021 16:35 stgatilov Note Added: 0014009
13.05.2021 16:36 stgatilov Status assigned => resolved
13.05.2021 16:36 stgatilov Resolution open => fixed
13.05.2021 16:36 stgatilov Fixed in Version => TDM 2.10