Clear sm_nextmap so we don't get stuck in a loop#1545
Conversation
c055213 to
a501ccb
Compare
|
Got two potential solutions for the bug here (in each commit), one on the C++ side that is more generic but a slightly hairy implementation (I think only TF2 can take this path though, other games don't recover from bad map changes), or one purely in the nextmap plugin that listens to the event added for TF2 specifically. The plugin code has a nice advantage of preserving the SM-enforced map cycle, whereas the C++ impl just gives up for a map. I'm really not sure which I prefer. |
|
I think having a hybrid of both would be best — the changes on the C++ side are necessary since core manages |
| } | ||
| } | ||
|
|
||
| public void OnChangelevelFailed(Event event, const char[] name, bool dontBroadcast) |
There was a problem hiding this comment.
Note that this event also fires for failed changelevels mid-round (e.g. sm_map workshop/1); will ideally want to introduce an (optional) dependency in SDKTools and check against GameRules_GetRoundState() == RoundState_GameOver.
There was a problem hiding this comment.
I think this triggering even on a failed mid-round change is probably sane, can you see any problem with that? I guess we'd end up picking the "wrong" next map perhaps (it'd be the one after the one they tried to change to).
There was a problem hiding this comment.
The server (well, TF2) forces a map change to advance to the next map in its cycle only during the game over state, so without checking for that, a failed mid-round change would overwrite any existing nextmap even if it would've been okay to use.
Round state may not be the most exact one though; the SDK actually uses g_fGameOver.
|
Ah, I hadn't spotted that any other plugins were using SetNextMap - yeah, probably best to take both of these then (they do work well together). The core changes will ensure nothing gets stuck, and the plugin changes will keep it on the right mapcycle if it would have gotten stuck. |
This sounds rather undesirable - no? |
I believe that comment was for the original version of the PR, which (if I remember correctly) blanked out nextmap at the start of every map change. The latest revision for core should be fine with an older version of the plugin; the effect of a failed map change will be one off-cycle map before getting back on track (with an updated plugin, a failed map change will advance to the next available map in the cycle). |
|
I've tested the latest commit against TF2 - including running a copy of |
|
I don't like this - I think there's a better approach. This has messed up my bench for ages (readas: 15 years) - the reason why is we don't do any validation of the level before setting the convar. Things are OK as the engine takes over and ignores case sensitivity which is excellent as levels are delivered using netchannel at a speedy What I think we should do: I think we should resolve the relative path, then verify the file exists, and then set the convar. It's going to result in a "no workshop2" support situation, but we can add support for that situation when it happens (like when workshop shipped previously). |
|
Could you clarify? There is no change in that the engine still handles checking the validity of the map and preparing resources here; I don't quite understand where
|
|
Yeah, boiling the ocean lead to nothing happening... this is still an improvement, feel free to merge. |
|
Sounds like this should be merged a while ago and nobody pressed da button. Handling failed mid-round mapchanges slightly wrong is better than deadlocking in a map loop and can be addressed later. |
* Pure C++ solution * Pure SourcePawn solution
|
I actually liked that forced change map behaviour... Anyway, this change affected DOD:S game, because it have a bug inside game. *edit |
This seems to work well, but it requires a change to the nextmap plugin as well as the implementation in core - which will be a pain for users as they almost never update the base plugins on upgrade. If the old plugin is used against a newer core version the
sm_nextmapcvar will never get re-populated after map change, so SM will stop controlling the map cycle.Fixes #1429