How I Built a Working Online Poker Bot, Part 5: Deciphering Poker Stars and Full Tilt

Introduction

Since this series began, I’ve been asked one question over and over.

How do I build a poker bot for Poker Stars and/or Full Tilt? How do I extract text from the game chat window? How do I snoop on hand history and log files as they’re generated?

Today we’re going to answer that question.

As of this writing, Poker Stars is the most popular poker venue not only in the world, but in the history of poker. Online or brick-and-mortar, it doesn’t matter. There’s not currently, and there never has been, another card room in which so many people congregate so routinely to play poker for such sums of money. If you took one of the largest buildings in the world—for example, the Lockheed-Martin manufacturing plant in Fort Worth, Texas…

…and filled it with tables, stretching off into the distance, you’d have yourself a casino which could handle maybe 1% of Poker Stars traffic. Maybe 5% if you pack them like sardines.

With well over 120,000 players at peak hours, Poker Stars isn’t really a card room at all.

It’s a small city.

Controlled by a mysterious group of investors, operating behind the veil of privacy.

Nothing wrong with privacy; given the politics surrounding online poker, I positively understand it. But in the absence of hard information, rumors abound: Poker Stars is owned by a group of top poker players; a cadre of eccentric billionaires; foreign governments; you name it. I challenge anyone reading this (other than Poker Stars staff and other industry insiders) to answer the question:

Who owns Poker Stars? Who owns Rational Entertainment Enterprises, Ltd.?

Because that’s a tough nut to crack, when you’re on the outside looking in. And inquiring minds want to know.

Building a Monitor Bot for Poker Stars and Full Tilt

Anyway, we’re going to build a little application which is capable of extracting complete table and game information from the Poker Stars client. Hole cards, board cards, player actions, you name it.

We’ll call it the “MonitorBot” although it’s not technically a bot since this one (unlike last week’s FoldBot) doesn’t actually click any buttons. Here’s what it looks like. Nothing too snazzy as you can see…

Did I mention that one thing today’s bot will not do, is click any buttons on your behalf? It’s only purpose is to gather information. Because it doesn’t automate your play, use of this tool does not constitute a violation of typical online poker EULAs. In fact, all of the information retrieved by this tool can be extracted by publically available tools such as Spy++ and others.

But notice that we’re displaying game chat text (in real time) in the top right window, and notice that we’re displaying log file text (in real time) in the middle window. Getting access to this text cleanly can be a little tricky. 

The Techniques

Several techniques are demonstrated in today’s article. I’ve broken these out into separate posts.

Then in Part 8 (coming sooner than you think) we’ll take these techniques in a direction you might not have anticipated. It should be interesting. Stay tuned.

Running the Poker Stars MonitorBot

In order to run the above application, you’ll need to do two things:

  • Download and build the source code (and this time, no Boost libraries! And no NMAKE!)
  • Download and install Poker Stars (www.pokerstars.com) and/or Full Tilt (www.fulltiltpoker.com) and set up a play-money account.

Once you’ve downloaded and installed Poker Stars, you’ll need to set your dealer message verbosity to “Everything” as shown here: 

Repeat the above step on Full Tilt. Then follow these steps to see the MonitorBot in action:

  1. Launch the Monitor Bot executable (XPokerBot.EXE).
  2. Click the “Launch Poker Client” button and browse to the location of the main Poker Stars executable. On most systems, this will be in C:Program FilesPokerStarsPokerStars.exe. Alternately, browse to Full Tilt.
  3. You should see the Poker Stars client launch. Messages will start to appear in the MonitorBot user interface.
  4. Open one or more Poker Stars game tables. If the tables don’t appear in the MonitorBot UI, jiggle the table window by bringing the MonitorBot UI to the foreground, and then bringing the poker table window to the foreground, etc. This is due to a quirk in the underlying Window detection logic.
  5. (Optionally) open the Full Tilt client (FULLTILTPOKER.EXE) using the same “Launch Poker Client” button, and open some Full Tilt tables.

Limitations

The MonitorBot is a demonstrative application, not a working poker bot. As a result:

  • It only works with Texas Hold’em tables on Poker Stars, Full Tilt, and Poker Time.
  • It only works with Windows XP. It may or may not work on Windows Vista.
  • MonitorBot doesn’t display hole cards in the UI like the FoldBot did. Instead it demonstrates how to pluck these cards from the log file and/or game text windows.

It’s intended to show you techniques which you can use in your own applications, or to serve as a “starter kit” which you can embellish.

Hey! Where are the hole cards?

Different online poker clients emit different information into the game chat window. Some of them, such as Poker Time, display your hole cards in this window; others, like Poker Stars, don’t. But in that case they may emit hole cards into the log file (as on Poker Stars) or into the hand history file (as on most poker clients, although there are timing issues).

And in any case, there are other ways to go about getting the hole cards. The point of today’s post is to show you one way (out of several) to access the three basic types of text emitted by the client…

  • Game chat window text.
  • Log file text.
  • Hand history text.

Once you have access to that text, what you do with it is up to you.

Building the Source Code

This week’s project is much easier to build than the FoldBot we looked at last week.

  • No more Boost! By popular demand, clean regular expressions are gone in favor of low-level, error-prone, but considerably easier-to-build string manipulations.
  • No more NMAKE! This project uses the Detours library, but I’ve included separate Visual Studio projects for detours.dll and the Detours marker DLL.

So what are you waiting for? Download the MonitorBot source code (C++/Windows 157KB).

Conclusion—Where’s the AI?

As interesting as inter-application command and control techniques can be, I think you’ll find the A.I. aspects of bot-building even more interesting. We’ve been busy laying out the framework for the bot’s eyes (input) and hands (output) but we’ll return to the A.I—the brain—before too long.

For those of you who are new to poker botting, we’ll discuss how to build an A.I. from scratch, and we’ll talk about how to leverage existing commercial bots as programmatically callable components inside your “master” bot. And whether you’re new to poker botting or not, we’ll discuss hand evaluation and comparison, game theory and the nuts and bolts of ICM calculation, rules-based vs. heuristic approaches, the importance of table selection, and much more. And at some point we’ll say hello to some of the other communities and poker-programming sites that are out there, commercial or otherwise.

Until then, good luck in your poker and programming endeavors.

193 Responses to “How I Built a Working Online Poker Bot, Part 5: Deciphering Poker Stars and Full Tilt”

  1. ezio

    precise statement to the previous post: "I can be at BB position with several dealerPos numbers"… obviously standing always at the same seat… so that I really can’t understand the sense of this log entry

    Reply
  2. Anonymous

    Problems:
    1. No info shows in PStars chat window.
    2. It wouldn’t start PStars until I add full path to
    DetourCreateProcessWithDll( pokerClientPath, NULL, NULL, NULL, TRUE,
    CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED, NULL, NULL,
    &si, &pi, "H:\Tank\XMonitor\bin\detoured.dll",
    "H:\Tank\XMonitor\bin\XPokerBot.Hook.dll", NULL);

    Any suggestions?
    Also, is there a place, with latest versions of code – in case UI changes in apps you spy upon?

    Reply
  3. Anonymous

    More problems. When debugging the problem with "no info in chat window", I found, that InstallMonitors(); is never called.

    Reply
  4. ezio

    No author answers to the questions… is this site out?

    The Game chat text window of the program remains empty: when a upgrade of the code to display the chat text?

    Reply
  5. Poker of Aces

    Hi everyone,

    I would like to congratulate James Devlin because your web site is really amazing. From the technical point of view, it is 7 stars, not 5. It is outstanding.

    Right now, I would like to find someone to cooperate with me on a poker software project whose goal is to improve SNG table selection (Pokerstars). As James Devlin states, table selection is very, very important and I need to improve that area. What I am looking for is someone that is able to develop a software that retrieves the content of any listbox on Pokerstars. I have already developed all the software needed to evaluate if we should or should not register on each specific tournament taking into account some statistic criteria ….

    If you are interested, please post your email on a comment and I will contact you afterward.

    Reply
  6. James

    I would still like to know what Poker Rooms the technique works more effectively on? And how much testing have you done with [url=http://www.raketherake.com]Rakeback[/url] sites?

    Reply
  7. Taylor

    There is a marvelous amount of job in that. Reading the screen is now one part of it, creating the output, managing the different tables, writing good poker policies? Did you notice the rule editor he had programmed? [url=http://www.onlinecasinobluebook.net]online casino bluebook[/url]

    Reply
  8. David

    Hi, and thanks for a great article.
    I have tried the MonitorBot and the game chat text doesn’t work.
    From the log file snooping I find the hole cards, but the value of the flop etc. Can’t be found there.
    I have changed the dealer settings to verbose.
    Anyone else who have the same problem?

    Best Regards,
    David

    Reply
  9. Johnny Ferrell

    Poker bots are computer programs that play poker. In terms of ability to play online that can perform almost as an average player. This is because the game online is very different from the face to face version.

    Best Regards,
    [url=http://www.ixgames.com]Online gambling[/url]

    Reply
  10. Craps

    Hi,

    Don’t go all online casino craps. Play on safe and reliable Online Craps game sites. Follow our casino craps review, offers and bonuses to get real information on Real craps game online. To know more, log on to: http://www.mrcraps.com/

    Reply
  11. Gambling Master

    hi,

    Play [url=http://www.mrsportsbook.com/]casino[/url] game at Mrroulette.com. Enjoy playing this exciting game with Mrroulette.com, A place for most favorite online roulette game site. To know more, log on to: mrroulette.com

    Reply
  12. Poker

    Wow! nice and helpful. By the name of [url=http://www.pokerrakeback.com/]fulltilt rakeback[/url] I can remember that now a top rated poker site also offers such games. Just check out!

    Reply
  13. Mark

    Hi,
    I have read all of your post, in this way I found you have tremendous guts on online poker games. I want some tips from you to built a [url=http://www.rakebackpoker.com]rakeback poker[/url] gaming bot. Though I am already involved in a online poker site that offer good amount of [url=http://www.rakeback.co.uk]rakeback[/url] instant.

    Reply
  14. Mac

    Hey friend,
    You have good knowledge on online poker games. But I want to know that is your process applicable for [url=http://www.mrjackpot.com]casino jackpot[/url] games too? Actually I do webmaster for a renowned [url=http://www.mrcasinos.com]casino review[/url] site, but very eager to built a site like [url=http://www.mrjackpot.com]mrjackpot.com[/url]

    Hope will get some help from you.

    Reply
  15. Jenny

    Hi,
    Your post mostly technical. But I love your dedication to your work. And the most important thing is that you have discussed it with us, thank for that.

    [url=http://www.mrsvideopoker.com]Online Videopoker[/url] | [url=http://www.mrsvideopoker.com]Onlinebingo[/url]

    Reply
  16. Jenny

    Hi,
    Your post mostly technical. But I love your dedication to your work. And the most important thing is that you have discussed it with us, thank for that.

    [url=http://www.mrsvideopoker.com]Online Videopoker[/url] | [url=http://www.mrsbingo.com]Onlinebingo[/url]

    Reply
  17. Joseph

    Hi,
    I am very much intersted on your technique. As I do webmaster for a [url=http://www.hotcasinodeal.com/]online casino[/url] site, I know some thing about casino and poker games. Apart from this I am involved with a popular site, here people can url=http://www.bunnybingo.com/]play bingo[/url] games and get a chance to get many prizes. In personal life I have dreamt that can build a poker bot like you. Your post give me a boosting power. Thanks for sharing.

    Reply
  18. Munken

    Hi,

    First off… Thanks for a GREAT blog. I really look forward to trying this out myself.
    I have downloaded the sourcecode on this page but when I try to rebuild I get this error.
    xmonitorxpokerbotxpokerbot.hookstdafx.h(73) : fatal error C1083: Cannot open include file: ‘atlstr.h’: No such file or directory

    Dosn’t seem that anyone else has this error which is strange. I havn’t made any changes to the code. Just downloaded, opened in Visual C++ 2008 Express and tried to rebuild..

    Anybody got any cluess?

    regards,
    Christian.

    Reply
  19. karolis

    hi, it’s don’t work with pokerstars.. i get this

    “Shared memory create accept pyr_5543:
    CommServerConnectionPool: _COMM_MSGTYPE_PHYSICAL_CONNECT
    layout management disabled
    Auto-rebuy 0 (0,0 – 0,0)
    Auto-rebuy 1 (0,0 – 0,0)
    GUID 0607700C06030173020D77770D71030D
    SYSVOL 3464668A
    MAC 00208F116111
    soundOn
    catch ‘Assertion failed: , file d:work1guiPyrPoker.h, line 1317′ in AppModule::Start()
    – Exit( -1 ) –

    full tilt loads, but bot do nothing..

    Reply
  20. John Doe

    I am still seeing the hole cards… was there an update? Anybody else having this problem? If Poker Stars is making software changes based on this blog then… lol. Talk about picking your battles… and where’s our author? Sanity check: make sure you’re actually logged in and seated at a table….

    Reply
  21. CptWacko

    I wonder if its just me but both FoldBot and MonitorBot doesn’t work (even if all compiled w/o errors) which make me rethink the idea that screen scraping is your last option… I think its best to screen scrape, if you have to modify your bots everytime there’s a new version of the pokersite.

    Btw, both bots runs well but they never “leach” any info from the pokersites. Anyone have that happenned ?!?

    Thanks

    Reply
  22. inable

    that bots is used for what ? ;P lol, anyone can tellme in 20 minutes for what we use that bot ? :o

    Reply
  23. Anonymous

    am enjoying your post and having trouble getting anything (from full tilt) other than the Function calls to show up. any ideas on what i’m missing?

    Reply
  24. Flukey

    I’ve just got my bot up and running and its playing some fairly tight poker with a few holes in its strategy here and there.

    At the moment, I am trying to hook the bot up to operate with a HUD loaded, e.g. PokerEdge. My problem is that the HUD seems to trap the mouse event calls I am making. It works fine without the HUD but with the HUD, the messages simply don’t go through. Has any one come across this and found a solution?

    Thanks.

    Reply
    • Alief

      For Immediate ReleaseANNUAL JAMES DEAN FESTIVAL WEEKENDThe Actor’s Hometown of Fairmount Celebrates 57 Years Later The small town of Fairmount, Indiana will Commemorate the 57 year anniversary of the unmliety death of native son James Dean during the weekend of September 28-30 with it’s 37th annual “James Dean Festival”. The event includes a huge Custom and Hot Rod Car Show all weekend and The Grand Parade on Saturday at 2pm along with numerous other activities including Live Entertainment, Carnival Rides, Street Vendors, 1950’s Dance Contest, the James Dean Lookalike Contest, and screenings of the actor’s three major films. All activities are Free to the public and Fun for the whole family. James Dean was born in nearby Marion, Indiana in 1931 and was raised in Fairmount. He graduated from Fairmount High School in 1949 and went on to attend Santa Monica Community College and UCLA before heading to New York to pursue an acting career. He appeared in nearly 40 live television dramas and two Broadway plays before going back to Los Angeles where he starred in three major motion pictures, “East of Eden”, “Rebel Without a Cause”, and “Giant”. On September 30th, 1955 he was killed in a tragic automobile accident at just 24 years old. The annual Memorial Service for James Dean will take place at The Back Creek Friends Church in Fairmount on Sunday September 30th at 1pm, followed by a walking procession to nearby Park Cemetery where the actor is buried.Fairmount offers two museum exhibits dedicated to the famous Hoosier, “The James Dean Gallery” and “The Fairmount Historical Museum”.For further information contact:James Dean Gallery(765) 948-3326Fairmount Historical Museum(765) 948-4555James Dean Run Car Show(765) 948-3853Photos available upon request

      Reply
  25. Matt

    Hi, I’m trying to run the code provided, however PokerStars.exe reports Client failed to initialize when using the Launch Client button, but works perfectly fine running the .exe without “company”.

    Is there a known workaround? I’d love to try and create an M indicator, and a tightness/aggression/deception indicator, but… being a C#/WPF developer I’ve had very little to do with lower level stuff directly. I don’t know
    where to begin solving this problem :(

    Reply
  26. Shane

    I currently have a working winning Poker-Bot after months of work but it is scripted not a true AI .

    It would be nice to actually have a “thinking” “learning” bot instead of just a complex script.

    Reply
  27. ms

    I am getting many errors while compiling the application
    Pls reply me is there any any perticular procedure for running this
    Pls reply ASAP
    Its urgent

    Reply
  28. Nick

    I’ve got the XFileMonitor program running, but when I point it at full tilt, I can’t seem to identify any “writes” in real time or log files. Only thing I notice is when it “writes” to the HandHistory log file AFTER the hand is completed?

    Did FTP change their software so that this program no longer works?

    Any assistance or advice would be greatly appreciated!!

    Reply
  29. Bogdan

    Hi,

    I’ve been trying to get the text from the PokerStarsChatClass window using Delphi and the afxCodeHook library, but I’ve been unable to do so. I successfully hooked ExtTextOutW, TextOutW, DrawTextA, DrawTextW, DrawTextExA, DrawTextExW, SetWindowTextA, SetWindowTextW, and I do get a lot of text, but nothing from the chat window.

    I was thrilled when I found your article, however I’m still having problems. Although it compiled successfully, it doesn’t seem to get the text from the chat window either. I’m using client version 5.006, and most likely you tested with an older version, because I can’t find the settings for the dealer verbosity.

    Any ideas on what other functions I should hook or what should I do to get the text from the chat window? Did you test with the latest version of the PokerStars client? Any hints?

    Thanks a lot!

    Reply
  30. Customized Website

    This post have great knowledge an valuable information, the author presents this article in very unique and diiferent way i never read this article before this such a great artcile.

    Reply
  31. ghd rettetang

    ghd rettetang heat up really quick, and they leave your hair shiny and soft! Also your hair stays straight for ages! I loved them! They are the next best thing. Great ghd glattetang performers and even the next day your hair looks freshly straightened – and I’m talking about someone with really frizzy hair! Best billig ghd ever bought and I’ve had all the big named ones before I bought these ghd rettetang i norge!! I got ghd slettetang today. My girlfriend very like it. it make us very happy. thanks for the surprise gift. I love my ghd rettetang! It heats up very quickly and works well. My hair is annoyingly thick and poofy, but this works wonders!

    Reply
  32. Wreaths

    am enjoying your post and having trouble getting anything (from full tilt) other than the Function calls to show up. any ideas on what i’m missing

    Reply
  33. ラルフローレン

    クリントン米国務長官は4日、ミャンマーの国会補選実施などの民主化努力を評価し、同国に対する金融サービス投資禁止や政府高官の渡米禁止など一部制裁の緩和措置を取る用意があると発表した。また、駐ミャンマー米大使を近く指名すると明らかにした。
     民主化運動指導者アウンサンスーチー氏と同氏率いる国民民主連盟(NLD)が補選で圧勝したことを受け、制裁緩和に着手する姿勢を示すことで、一層の民主化を促すのが狙い。ただ、緩和の対象を限定し、全政治犯釈放や北朝鮮との軍事協力停止を含めた改革を推進するよう圧力を維持する方針も示した。

    Reply

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>