[TF2] Get map type without relying on map name
2 Attachment(s)
So, I wrote a little snippet that lets you find out what game type the current map is even if it has been renamed to something else.
This also has info on how to determine which type of CP map you're on. PHP Code:
I wrote this code as part of a detection script for what control points are currently active, but that's not done yet. |
Re: [TF2] Get map type without relying on map name
Except there are things like trade maps with cps and broken logic and such that do nothing... And these "fun" maps are the type of maps that usually have strange prefixes. Grantd they may not have control point masters, but again, they may.. And a lot of them also have flags.
A better method is to detect and write out kvs to file.. Then ops can modify said kvs to override autodetection, and say.. Execute a servercommand (blag.cfg or something, etc) would be most useful. Also, you can have multistage arena maps.. Vsh megaman? Or there are multistage cp maps.. Dustbowl, kakario which are not properly made. No idea how they are organized, but there are also castrated versions if these maps that are popularly used in vsh. |
Re: [TF2] Get map type without relying on map name
Quote:
The map type is discovered by first asking the GameRules entity what type of map it thinks is running. It checks the 5 standalone netprops first: MvM, KOTH, SD, ItemTest, and Training. If it's not one of those, it asks the GameRules entity for the map type, which is one of unknown, CTF, CP, PL, or Arena. For CTF, it just returns that it's CTF. For Arena, it just returns that it's Arena. For PL, it checks for the existence of the "tf_logic_multiple_escort" entity which is requires for PLR to actually work. The only complicated checks come for maps that GameRules reports back as CP. For CP maps, it checks first to see how many rounds the map has. While it's checking that, it checks if a round's priority is the same as the highest priority its encountered yet. If it runs into multiple rounds with the same priority, it's a Terriority Control map (this is actually mentioned in the comments). If it's a multi-round map and one team is marked as unable to win in all rounds, it's an A/D CP map. Any other multi-round CP map is a push/pull TC map. If it's a single round CP map where one team is marked as unable to win, it's an A/D CP map. Any other single-round CP map is a symmetric CP map keeping in mind that we already checked if it was a KOTH map, and Arena maps aren't considered CP maps. Incidentally, I checked a good number of standard maps against this, including: cp_granary cp_gravelpit cp_dustbowl ctf2_fort sd_doomsday tr_dustbowl tr_target arena_lumberyard tc_hydro ph_lumberyard pl_goldrush plr_pipeline One map I know for sure it will fail on is tc_meridian... because it currently doesn't subdivide CTF maps into categories. cp_kakariko may also be subject to this due to it having multiple rounds. It'd be nice if Valve would subdivide CP in the gamerules stuff, like marking which maps are A/D. |
Re: [TF2] Get map type without relying on map name
I read it, and yes, i see how it works, but isn't the point to detect the type of gameplay regardless of prefix?
And as I posed, what of these odd custom maps or trade maps with wonky logic? Which is probably only time you would need this type of thing, as they are the most likely to be mislabeled.. Dm_ pkmn_ mlp_ achievement_ etc. Here a "deathmatch" category would be most useful, eventhough it does not officially exist, many many many servers use it. You can have a map with no logic at all, and just info player teamspawns... It will run fine, the game will tag it as capture points i think, it is not. You can also have this same kind of maps with item temflags, capture zones, and capture points (tcpm) and again, it could be a trade map with no way to win. |
| All times are GMT -4. The time now is 18:33. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.