.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Best way to detect the maps types ? (http://forums.bots-united.com/showthread.php?t=4170)

The Storm 01-07-2005 16:24

Best way to detect the maps types ?
 
Ok I suspect that EPB didn't detect the CS maps correct. So I ask how is the best way to detect the map types? Maybe with the hostage models in the map or with bomb targets in to the DE maps ? Then how to detect the AWP maps and FY maps? Is there a way to read the name of the map and if the name start with cs_ then to set the bots to play for CS maps. And how I must do that? Maybe a code exsamples with a good explain will help.

Pierre-Marie Baty 01-07-2005 17:11

Re: Best way to detect the maps types ?
 
For me, hooking the entities spawning is the best way. If you find a func_hostage_rescue then it's a hostage map, if you find a func_bomb_target or info_bomb_target then it's a bomb map. If you have a func_vip_safetyzone, then it's an AS map, if you have a func_escapezone then it's an escape map, etc... If you have nothing of these, then -> deathmatch.

Try to make it so that a map can have several types at once.

The Storm 01-07-2005 18:16

Re: Best way to detect the maps types ?
 
Thanks PMB but do you have a idea how to detect FY maps and AWP maps ?

Can you tell me is this way is good :
Code:

strcpy(filename, STRING(gpGlobals->mapname));
  if (filename[0] == 'a') {
          if (filename[1] == 's')
                g_iMapType = MAP_AS;
          else if (filename[1] == 'w')
                g_iMapType = MAP_AWP;
          else if (filename[1] == 'i')
                g_iMapType = MAP_AIM;
  } else if (filename[0] == 'c')
          g_iMapType = MAP_CS;
  else if (filename[0] == 'd')
          g_iMapType = MAP_DE;
  else if (filename[0] == 'e')
          g_iMapType = MAP_ES;
  else if (filename[0] == 'f')
          g_iMapType = MAP_FY;

The map type is detected by the map name. But I think that still is not correct detected the CS maps. If you can help me.

Pierre-Marie Baty 01-07-2005 19:52

Re: Best way to detect the maps types ?
 
Some maps do not even start with xx_mapname. If I were you, I'd scan until the first underscore. And what if someone named a map "awesome_map" ? That wouldn't make it an AWP map.

Lazy 02-07-2005 06:49

Re: Best way to detect the maps types ?
 
Theres a few ways you could do this...

1. Read config files for every map, goto 2 if not found
2. Compare the first 3 letters of the mapname with a table that lists the prefix ( ie. "de_" ) and it's type ( ie. GTYPE_DE )
3. As said by PMB, if all else fails assume deathmatch >:)

The Storm 02-07-2005 07:54

Re: Best way to detect the maps types ?
 
Ok I will make two checks. First for func_bomb_target (for DE maps) after that for func_hostage_rescue (CS maps), func_vip_safetyzone(for AS maps) as PMB says. If that fail I will make the checking with the file name of the map. And if that fail then deathmatch. I think that this checks will be enogh for detecting the correct map type.

Thanks a lot guys. :)

Lazy 02-07-2005 07:57

Re: Best way to detect the maps types ?
 
Another thing you could check for is if they have say, both a func_hostage_rescue and func_bomb_target.

Zacker 02-07-2005 14:29

Re: Best way to detect the maps types ?
 
In SoW2 we do gameplay mode detection in maps solely with entity finding. It works great.


All times are GMT +2. The time now is 02:32.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.