| 07-20-2009, 02:45 AM | #1 | |
Suppose you have a map league, where bots host your map and keep track of stats. But the map has modes and you want to force a particular mode in league games (eg. random pick or hard difficulty) without having a separate league version of the map. There is no good way to do this, so you use HCL to pass a short mode in. This library allows the bot to communicate with your map by encoding characters into players' handicaps (idea by Varlock). Warcraft 3 normally only allows 6 possible handicaps, but bots can specify 256 different values. By encoding the original handicap inside the larger handicap, and only performing the encoding just before the map starts, players don't even realize their handicap was temporarily mutilated. There is a limit of 1 character per player (empty slots don't count, but computers do), and the characters are limited to the set "abcdefghijklmnopqrstuvwxyz0123456789 -=,.". So don't expect someone to be entering long strings this way. Make the automated modes as short as they need to be. To read the mode entered by the bot, just call HCL_GetCommandString(). If it returns the empty string, there was no mode entered. It's probably a good idea to include this in popular maps, even if they don't use it. If a bot tries to enter modes on a map without this library, the player handicaps will be absolutely ruined. History
JASS://///////////////////////////////////////// /// HostBot Command Library /// Last Modified: September 14, 2009 /// Authors: Strilanc, /// v1.01 /////////////////////////////////////////// /// Reads a command string transparently encoded into player handicaps by hostbots. /// Allows at most one character from "abcdefghijklmnopqrstuvwxyz0123456789 -=,." per player. /// Empty slots don't count towards the player count, but computers do. /////////////////////////////////////////// library HCL initializer init globals private string command = "" endglobals public function GetCommandString takes nothing returns string return command endfunction private function init takes nothing returns nothing local integer i local integer j local integer h local integer v local string chars = "abcdefghijklmnopqrstuvwxyz0123456789 -=,." local integer array map local boolean array blocked //precompute mapping [have to avoid invalid and normal handicaps] set blocked[0] = true set blocked[50] = true set blocked[60] = true set blocked[70] = true set blocked[80] = true set blocked[90] = true set blocked[100] = true set i = 0 set j = 0 loop if blocked[j] then set j = j + 1 endif exitwhen j >= 256 set map[j] = i set i = i + 1 set j = j + 1 endloop //Extract command string from player handicaps set i = 0 loop exitwhen i >= 12 set h = R2I(100*GetPlayerHandicap(Player(i)) + 0.5) if not blocked[h] then set h = map[h] set v = h/6 set h = h-v*6 call SetPlayerHandicap(Player(i), 0.5 + h/10.0) set command = command + SubString(chars, v, v+1) endif set i = i + 1 endloop endfunction endlibrary |
| 09-04-2009, 10:47 AM | #2 |
Why isn't this approved yet? Every map with different modes should support this. The next Dota version will be the first famous map to do so. |
| 09-04-2009, 01:24 PM | #3 |
Probably because a lot of people have no way to truly test it, eg: No bot, map doesn't have modes, etc. Also, what if a mode is something like -emardaelbaejgfadoobedooda? (DotA, anyone?), but only one character per player? How does that work then? (Do you use multiple players to piece the string together? |
| 09-04-2009, 03:16 PM | #4 |
It means that if your game is only going to have two players players, you can only enter an extremely small mode (2 characters). Dota will be able to put in 10 in standard games. The limitations are there because this is the only way we've managed to get any input into the game from the bot without introducing fake players or technically desyncing someone. The shortness means you probably shouldn't just use the same long commands as inside your map. In power towers I abbreviated every command into a character and use that (there's also a way to see and use them in game instead of normal commands). eg. --nm is -noob -lastman. The HCL string doesn't even need the --. |
| 09-05-2009, 02:40 AM | #5 |
well after all you don't have to use codes that make "sense" ingame (e.g. you can just give any possible gamemode combination a number encode it into that charset and pass it to the map this way there would be a limit of a wooping 41^12 (22 563 490 300 366 184 000) (for 12 players) possible gamemode combinations) i don't think anybody will ever realy use that much (well bill gates said that too - so whatever) but for just passing gamemodes 2 players should be more than enough (41^2 => 1 681 diffrent settings) |
| 09-05-2009, 12:54 PM | #6 |
This doesn't really have any usefulness on its own. It requires a bot to be useful. Therefore I think it should probably be in with the bot's thread in the tools section, maybe, rather than the scripts section? I'm not sure. |
| 09-05-2009, 06:42 PM | #7 | ||
Quote:
That sounds like a lot, except that the possible number of mode combinations is also huge. Plus there is inefficiency due to usability requirements. The player has to specify the mode, because the bot doesn't know how the map interprets modes. If you just number the possibles modes, you end up with crazy commands like " f-e=,," that players can't remember. Quote:
Chances are one of your players uses a hosting bot. It doesn't belong in my bot's thread because this system is not specific to my bot. GHost uses it. |
| 09-13-2009, 10:42 AM | #8 |
Battle Tanks does also support this system now. |
| 09-15-2009, 01:20 AM | #9 |
v1.01 - Fixed a potential rounding issue when reading the handicap - Fixed a floating point precision issue when assigning the handicap |
| 10-12-2009, 08:04 PM | #10 |
Whatever. This isn't a script in the sense that it can just be shoved into a map's code and have it be happy. Because it can be used by many different bots, though, it can't just go in your bot's page. I do see it as being useful, though. I am going to approve this as a Sample, because of how much an oddball it is and that it doesn't really fit anywhere else. EDIT: Do me a favor and attach a screenshot or something of the BNet lobby or something, since this will be in Samples. I'll approve it when you do so. |
| 10-13-2009, 07:32 AM | #11 |
Am I the only one who thinks this is kind of useless? There already is a banlist, and I highly doubt this is a good idea at all. |
| 10-13-2009, 01:43 PM | #12 | ||
Quote:
I'm having a hard time formulating a reply to your question. I can't figure out what you must think this system does, or what you must think banlist does. Quote:
I'll attach an icon. |
| 10-13-2009, 01:55 PM | #13 | |
Quote:
|
| 10-13-2009, 02:01 PM | #14 |
You'd be surprised at how extensive a segment of the community uses GHost or other bots adhering to this standard. Approved. |
| 10-13-2009, 02:12 PM | #15 |
Hmm,.. Seems like that. Never found out whats so good at having stuff like GHost,.. but it seems like its used nowadays. I guess I will have to check it out, so I am getting to know what this really does. |
