HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Tinker - Warcraft 3 HostBot

06-29-2008, 04:39 AM#1
Strilanc
Tinker is a bot capable of hosting warcraft 3 games, and related tasks. It is written in vb.net. It currently requires .net 4.0 (release candidate as of this writing).

Future Plans
- Hosting saved games
- Support for MMD
- Relay games: forward joiners to games not hosted by the bot

Notes
- If you can't host, the bot can't host (when run from your computer). Did you try portforward.com ?
- The bot requires a valid cd key to work. You can't login at the same time as the bot using the same cd key.
- Blizzard has a public anti-third-party-tools stance, but their actions don't seem hostile towards hosting bots.

Usage
Download the attached zip, extract it, run the installer, and read the usage manual that was extracted beside the installer. Devs can get the source code from http://github.com/Strilanc. The map info grabber is only needed if you can't host and want to upload a map to the bot through wc3 when you can't host.

Example
Host a game of castle fight, with slots pre-setup for 4v4 and the top slot reserved for you:
Code:
!host name=<Castle Fight!!> map=castle*1.14b -t=4v4 -r

Breakdown of the command:
- host is the name of the command. It is used for easily creating a game server and advertising the game on battle.net.
- name=<Castle Fight!!> specifies the name that shows up in the games list. The <> are needed because this argument contains a space, and the name= part is required to avoid confusing it with the map argument.
- map=castle*1.14b is a search term used to find the castle fight map via the filename. It means "match any filename that includes 'castle' followed by anything followed by '1.14b'".
- [b]-t=4v4[b] is an optional argument and a shorthand for -teams=4v4. It means team 1 and team 2 will initially have 4 open slots for players.
- -r is an optional argument and a shorthand for -reserve=your_name, which reserves the first available slot for you [or anyone name spoofing you, I guess].

History
Hidden information:

February 10, 2010
- Implemented Replay saving via -replay host option
- Fixed -nodl's effect being shown as a disconnect-due-to-error
- Fixed 'ding' noise when entering commands
- Fixed issues with CKL
- Fixed fake players showing up in !Ping
- Added Replay Build Number setting
- Fixed game lobby layout issue on custom melee maps (and some others)
- Added missing !race game command
- Many code fixes and tweaks (as always) (see the repository for full details)

February 4, 2010
- Fixed several small bugs
- Added unit tests for almost all packets sent and received by the bot.
- Fixed reservations not working when the game had no non-player slots left
- Fixed game lock command inverting the meaning of -full
- Made most classes dependent on an IClock in order to make their timeouts and etc testable
- Added lots of unit tests
- Added duplicate logged exception detection in order to avoid double-logging
- Tweaks to some messages here and there
- Identified more game actions (empty game cache syncs)
- Identified several unknown packet values (shared peer data, map transfer key, GameCacheSyncUnit stuff, etc)
- Added rudimentary support for 'async lag'
- Fixed saved logging cutting off midstream when games errored out
- Completely rewrote map transfer functionality
- Added much more detail to map transfer info shown in game screen/!ping command
- Added some missing ProgramAuthentication key error codes
- Added packet id and source to 'parsed data' messages
- Fixed flood of unexpected exceptions coming from player sockets after disconnect

January 13, 2010
- Branded the bot as 'Tinker'
- Added automatic reconnection
- Added better support for named and optional command arguments
- Added simple validation of cd keys as they are entered into settings
- Changed a lot of command syntax
- Removed several settings (they are computed automatically)
- Removed listen port setting from profiles (port pool is used instead)
- Added Exception Log
- No longer starts 'real' game countdowns (if cancelled they trapped and confused players)
- Added up/down command history to command boxes (hit up get previous command's text)
- Added minimize to tray button (program no longer goes to tray by default)
- Added 'unbuffer' button to logs (when lines are being buffered)
- Admin game is no longer coupled to a lan advertiser
- Tons of architecture/programming changes (see Git repository for dev details)

September 13, 2009
- Requires .net 4.0 beta.
- Added -mode=X host option, which passes text into maps using HCL. Do not use on non-compatible maps!
- Source code now uses features from VB10 (from visual studio 2010, which is currently in public beta).
- Profiled the code and optimized the hot paths.
- All threaded call queues changed to thread pooled call queues.
- Call queues are now lock free.
- Improved parsing. Parsed data now gives readable info for enum fields (flags and IDs) and ip addresses.
- CKL server now has commands to add and remove keys, starts with 0 keys, and can use the port pool.
- Refactor, refactor, refactor. Tinkering is the only way to keep the code base in line.
- Fixed up cruddy 'game type' code.
- Fixed a bug which caused all players to disc when all slots contained a player.
- Fixed a bug which caused using observers to cause a never-ending stream of errors.
- Idle sockets will now timeout and disconnect (fixes bot looking connected to bnet when it was disced).
- Fixed a bug where any password worked for !elevate in games.
- Significantly simplified under-the-hood logging implementation.
- Significantly simplified under-the-hood transfer scheduler (for DLs).
- Fixed a bug reading the strings file to get map names.
- Significantly improved bot's upload speed, and download scheduling.
- Experimenting with Code Contracts, especially static verification.
- Fixed some desync bugs with -LoadInGame.
- Fixed a compression-detection bug in the mpq library.
- Fixed a very old bug involving disposing controls.
- Added semi-workable 'host' command to lan advertiser
- Renamed game command 'SetComputer' to 'CPU' and made difficulty level optional
- Split general functions and mpq functions into libraries
- Added parsing for game actions
- Fixed a parsing heisen bug
- Removed custom warden handler and added BNLS warden handler
- Added game action parsing and logging
- Added sha1 checksum to CreateGame3 bnet packet to mimic wc3 more closely

May 24, 2009
- Compatible with 1.23 checksums
- Compatible with warden (a DLL is included and required, keep in mind warden is *actually run*, not emulated)
- Added more information to server display (eg. checksums)
- Added -LoadInGame [-lig] option to !host. Players wait for loaders in the game (try it out!).
- Added -grab option to !host. The bot will download the map from joining players.
- Added -Admin=name [-a] option to !host. Automatically gives admin to that player when they join. Omit the '=name' part to match yourself.
- Added a port pool, used to allocate ports when needed (eg. to download a map)
- Added the ability to host a lobby without the map file (for downloading the map to bot, won't work if game is started)
- Some commands are now only available based on the current state, eg. so that you don't 'say' while logging in and get temp-banned.
- Created a repository at GitHub: http://github.com/Strilanc
- Massive code base changes. Lots of minor changes have been forgotten. Oh God there are going to be bugs.

March 15, 2009
- Vastly improved help for commands with lots of sub options like -host
- Added some more shorthands (-perm for -host, etc)
- Renamed Lan Admin commands, and some others as well
- All players in games now have access to limited commands
- Admin password is now entered using the -elevate command
- Added -HostElevate command, which can be whispered to the bot to become admin
- Added -Leave command to game, for when countdown is aborted and you're stuck
- Fixed melee teams not changing easily
- Fixed neutral players causing slots to not show up
- Used neutral player trick to hide slots in admin game
- Regression: Stats plugin not working, old one not compatible
- Architecture changes all over the place
- Map search patterns improved so you can include a folder

February 5, 2009
- Improved UI of settings form.
- Apparently fixed a bug that was dropping players. No idea why, but it seems to have stopped.
- Improved xoro checksum calculation and mpq support [war3map.j now covers scripts/war3map.j, uses second entry in hash table when a file has a double-entry]
- In-game name is now customizable and defaults to |cFFFF0000Hobo, my unofficial name for my bot.
- Improved player info shown in instance UI
- Lan admin games now uses a fake map instead of plunder isle
- Reworked behind-the-scenes of how clients/servers/lan-advertisers interact.
- Removed 'Lan Admin Game' option on profiles (at least for now). Use CreateLanAdmin command instead.
- Removed -AdminClient command from game instances
- Renamed -AdminBot command in game instances to -Bot, and command is now only visible from admin game
- Renamed -KillLanAdmin to -KillLanAd [ad is short for advertiser]
- Removed FindMap command [use -FindMaps]
- Added -permanent option to --host and --createserver. Permanent servers create new instances when old ones die, and
- Added shorthands -r and -reserve for "reserve slot for me"
- Added -instances=X / -i=X for setting initial number of instances on server. Use =0 for unlimited instances.
- Added shorthands -as for -autostart, -mo for -multiobs, -o for -obs, -od for -obsondefeat, -ref for -referees
- Added server options -randomhero / -rh, -randomrace / -rr, -unlockteams, -teamsapart, -fullshare, -vis=all/explored/none, -speed=medium/slow
- Added -add and -remove commands to lan advertisers
- Added -AdLink and -AdUnlink commands to client, which synchronizes the games advertised by multiple clients.
- Created a very simple plugin for tracking player stats (statsplugin.dll)

January 7, 2009
- Fixed several issues with dls
- Fixed a bug where 2 players lagging at the same time could drop everyone
- Added shorthands to -host options: -r=, -t= for -reserve=, -teams=
- Fixed the hostbot player leaving the game when there were some closed slots, no open slots, and a player tried to join

January 1, 2009
- Added logging to disk and improved logging efficiency
- Fixed a desync at start due to possible different random seeds
- Fixed severe latency problems (it was the logging code spawning lots of threads)
- Added p2p downloads. Players who can host will download/upload from/to other players if the bot is busy.
- Added -noul option to -host command, disables uploading from bot [dls must come from other players]
- Fixed bot users not being removed when deleted via the settings form
- Added support for PkWare compression in MPQ files
- Fixed an issue with map sizes being loaded into a too-small type [thanks Etinin]
- Fixed a bug where booting a player would cause all players to disconnect
- Plenty of other little fixes and tweaks I just don't remember

November 16, 2008
- Fixed lag allowing a too-large packet to be sent, discing all players
- Fixed some CKL problems
- Fixed some socket problems
- Improved errors being caught for sending/receiving data
- Added 'del' button for removing profiles
- Fixed listen port reseting to 5951
- Fixed 'dont close server' option to not close instances
- Fixed self-queueing loop when players disconnected
- Other little tweaks and fixes

November 15, 2008
- Added logging to lan advertiser
- Improved protected MPQ support; hash table items validated only when accessed
- Fixed DLs failing in full games
- Fixed admin game failing if Lost Temple not in maps folder
- Improved "Failed to create game" error message
- Added option to disable auto-closing game servers

November 14, 2008
- Fixed an issue with player ids being issued twice, discing everyone
- Renamed -promoteuser to -promote, -demoteuser to -demote
- Added LAN advertising, games advertised by the client can be advertised on LAN
- Added LAN admin-ing, admin game with specified password can be used to control bot

November 11, 2008
- lots of tweaking, watch out for new bugs
- fixed and re-enabled downloads from bot
- enabled observers in games
- added -nodl, -obs, -obsondefeat, and -referees options to the -host command
- added experimental -multiobs option which allows more than one observer to enter a slot
- added -ping command
- worked on fixing the unpredictable 'InvalidInvoke' errors
- increased allowed range for lag settings
- added -admincode command to client [repeats admin code if you hosted]
- instance commands now only respond to issuer

November 6, 2008
- Added close confirmation dialog
- Added tray icon and hide-on-minimize
- Added Key Lending server
- Added instance -setteams #v# command
- Added -manualstart option to -host
- Added Bot Widget interface for things like CKL server
- Fixed lag screen flicker. Game waits for player to catch all the way up.
- Text logs now buffer messages when cursor isn't at end, instead of flickering focus
- Added support for ?trigger
- Replaced -ListMaps with -FindMaps
- Added support for alternative directory separators
- HostBot player no longer shows in a slot

November 5-2, 2008
- disabled [abc] syntax from -findmap, -host, etc, due to usability issues
- added -instance command to client. Use it to whisper command into game if bot can't hear you.
- fixed -SetHandicap not accepting any values
- fixed -SetTeam using first argument for new team instead of second argument
- fixed does-not-have-map bug
- fixed mpq library and map access so they actively close unused files
- fixed unknown users not being recognized for -cancelhost after they use -host

November 5, 2008
- added -CancelHost command
- added options to -host [-teams=#v#, -reserve=playername]
- renamed -superlock to -freeze
- added noargument options on -lock, -unlock, and -freeze for affecting all slots
- added -FindMap and -ListMaps to client [used to just be on bot]
- fixed 'red is blue' -swap bug
- fixed ally chat going to all players
- fixed clients falsely reporting do-not-have-map for maps directly in maps folder
- fixed -reserve players not displaying until next state change
- fixed help failing for commands with permissions

November 4, 2008
- Totally redesigned user interface and underlying engine
- Switched language to VB2008 [yay lambda expressions and type inference!]
- Commands *massively* improved under-the-hood. Plugins can add their own commands.
- Added support for rudimentary plugins
- Added support for multiple bnet client and game servers
- Added support for multiple setting profiles
- Games now controlled via admin code instead of name matching
- Added support for changing listen ports
- Added settings for changing tick rate and lag limit
- Improved MPQ implementation, can read heavily protected files not readable in other common libraries
- Instances and players within a server now all run on the same thread, reducing latency from thread-resumes

September 27, 2008
- In-game should be much more stable [still no guarantees]
- Identified very sneaky race condition for socket writes/reads
- There can never be enough small changes and little rewrites

September 14, 2008
- EXPERIMENTAL
- Added ability to host in-game [no stability guarantees!]
- More small architecture changes [it'll stabilize at some point]

September 9, 2008
- Small architecture changes here and there
- Shouldn't crash when players join now (har har)

September 7, 2008
- Added rudimentary detection of unexpected exceptions so bug reports are actually possible
- Reworked parsing, shouldn't kill it anymore, hopefully no new bugs introduced

September 6, 2008
- Parsing is done at a higher level, which allows printing very detailed packet information
- No more need to provide map 'hex keys', I figured out how to compute them [took a lot of work]
- More settings (exe version, exe info, command prefix)
- Tinkered with remote commands, should have much better help now
- Improved permission model


Source Code: http://github.com/Strilanc

Attachment Descriptions
-Tinker Setup: Installs tinker program and dependencies
-Wc3MapInfoGrabber: Tool to grab HostMapInfo packet data, which is needed for one of the steps involved in uploading a map to the bot via wc3 (when you can't host).
Attached Images
File type: pngTinker.png (3.2 KB)
Attached Files
File type: zipWc3MapInfoGrabber.zip (10.3 KB)
File type: zipTinker Setup - Feb 10, 2010 - uses .net 4 beta 2.zip (673.8 KB)
07-02-2008, 07:37 PM#2
Strilanc
No comments?

Has anyone perused the code? Is it understandable to you?
07-03-2008, 04:15 AM#3
BlacKDicK
Quote:
No comments?

Has anyone perused the code? Is it understandable to you?

I downloaded the src. It is understandable (well, at least to me).
I just did not have the time to play with it yet. I'm involved with Ion in developing some cool plugin system for Grimoire, to make things easier for .Net developers. Besides, this new patch messed up A LOT, so a lot of work will be needed before Grimoire starts working with 1.22.

Grats for this app. Pretty good BTW.
07-04-2008, 05:32 AM#4
PandaMine
If this could be ported for linux that would be aweasome, because there is currently a bug in wine where you cant host
07-04-2008, 05:53 AM#5
Av3n
So i guess this works for v1.22 as well...

-Av3n
07-04-2008, 06:36 AM#6
Strilanc
I'm actually not sure if it works with v1.22. It reports the wrong to battle.net, but the hashes will be correct (it kept working through the last patch). Assuming they didn't actually change any of the client-server interactions, it should still work.

It's written in VB, which unfortunately kills any change of porting to linux unless it works with mono.
07-04-2008, 06:51 AM#7
Rising_Dusk
There are a lot more abuses in hosting on BNet that you can play with, you should keep looking, it's fun. Blizzard still hasn't fixed the one that can shut BNet down on entire servers yet.

Additionally, did you know that you can host on all 4 servers at once? :)
07-04-2008, 09:50 AM#8
Strilanc
Quote:
Originally Posted by Rising_Dusk
There are a lot more abuses in hosting on BNet that you can play with, you should keep looking, it's fun. Blizzard still hasn't fixed the one that can shut BNet down on entire servers yet.

Additionally, did you know that you can host on all 4 servers at once? :)

I assume you're talking about having a bot join every game (with "DOTA" in name) at once again and again so they're all full of bots all the time. Denial of Service. But the fact that you say blizzard can fix it makes it sound like it may be something else, since they can't do anything about what I just described.

I didn't consider putting the game in all 4 lists at once... interesting idea. Mix people from different servers (since all bnet really does is advertise your ip address and port).
09-07-2008, 02:41 AM#9
Strilanc
I've updated the main post. New stuff is:
- Parsing is done at a higher level, which allows me to print off all the values in a packet. So it shows you exactly what it's sending and receiving from bnet. [Check out the new screenshot]. This also makes debugging comm problems MUCH easier.
- No more need for sniffing hex keys. It can compute that value now [thanks to way too much effort on my part].
- More settings.
- Remote commands have been tinkered with. It now has a reasonable permission model.

I can't test it a lot [no hosting here], so if you catch any bugs, let me know.
09-07-2008, 07:55 AM#10
Ammorth
It crashed when a player joined (the person had 255 download percent, so many a glitch from battle.net?)

Also, to host without being in the game, do you just kick the bot?
09-07-2008, 02:37 PM#11
Rising_Dusk
No, you just don't send BNet the packet saying that your host bot is in the game, so it doesn't think it is. This isn't a problem anyways, since the bot can't actually play the game.

You could actually have the bot in the game if you wanted running from the actual host's name. That's a bit trickier, but it allows you to properly render desynchs and so forth. (By giving you a place from which to do the checksums properly)
09-07-2008, 02:48 PM#12
Strilanc
Looks like a pretty serious bug . I can't test it until my "second" cd key isn't in use.

The 255 download percent means their download percent is unknown (question mark).

The bot doesn't use up a game slot. It essentially works the same way bnet does when hosting melee games. It's there, but not a player. The bot will auto-kick itself when the slot is needed.

My next project is getting it to work in-game, player to player downloads, and more fully separating the game lobby from the client [because you can have multiple clients advertising a single lobby on different servers].
09-07-2008, 04:05 PM#13
masda70
This is probably a minor but it doesn't work with accounts that are in a clan. Apparently it doesn't know what to do with the CLAN_INFO packet or something.
09-07-2008, 04:25 PM#14
Strilanc
Quote:
Originally Posted by masda70
This is probably a minor but it doesn't work with accounts that are in a clan. Apparently it doesn't know what to do with the CLAN_INFO packet or something.

Do you mean it shows a parse error (no parser for packet) when you get CLAN_INFO? That's normal. It ignores that packet, since it doesn't use that information.

(does it disconnect or crash when it happens? that would not be normal)
09-07-2008, 05:02 PM#15
Ammorth
It has crashed a couple times while using. Is there a way to run in debug mode?