Page 1 of 8 123 ... LastLast
Results 1 to 10 of 75

Thread: Twitch plays Hex

  1. #1

    Twitch plays Hex

    Some time ago, the idea arose of allowing Twitch viewers to play Hex draft without stream delay.
    Now, I would like to present to you UDraftBot, which allows this (to some extent limited by Hex API - it can only read data from Hex client, cannot post any data).

    About UDraftBot
    UDraftBot is stream bot that connects Hex client and stream chat. It is displaying in chat card list of current draft round and allows viewers to vote for card that they would like to pick - all of this without stream chat delay.
    udraft_preview.jpg
    Live testing by Cirouss
    Live testing by Alucard2004


    How does it work?
    When draft of streamer starts, UDraftBot send to chat message containing list of current cards possible to pick.
    List of current cards: 1. [Crackling Rot] 2. [Arena Regular] 3. [Zeedu]
    Then viewers can vote for cards by typing in chat command "!pick {index}" or "!pick {name}". Every person has 1 vote per cards list, but can change it freely.
    !pick 2
    UDraftBot displays number of all votes, votes per card and currently winning card - this allows streamer to choose card based on chat voting


    Download and setting up
    UDraft Bot 2.2.0 - 3.8 MB zip file (had to change to zip, because now it is containing additional files like images and html). Requires Java 1.7 or higher to run.

    To set up UDraftBot You have to
    1. create api.ini file (here is link with help how and where create api.ini file).
      Add in it new line:
      http://{url}:{port}|DraftPack|DraftCardPicked|SaveDeck|Co llection
      (NOTE: there should not be space in word "Collection", I don't know why this forum editor is inserting it there)

      {url} - url for computer that will be running UDraftBot
      {port} - any free port that UDraftBot will be listening at

      DraftPack - event needed to get cards list during draft
      DraftCardPicked - event needed to get information about card picked
      SaveDeck - event needed if you want to use "Test save deck Hex event"
      Collection - event needed for bot logic to get know when draft phase ended (it is not optimal, but rigth now it is the only way of getting informatin when it ended)

      E.g. if You run UDraftBot at the same computer as Hex client and have free 7777 port it would be:
      Code:
      http://localhost:7777|DraftPack|DraftCardPicked|SaveDeck|Collection
      If You have Your Hex client synchronized with hex.tcgbrowser.com and don't want to lose it, You can add both links in same api.ini file, each in new line.



    2. Run UDraftBot and insert connection data
      udraft_config.jpg
      Server hostname - hostname of stream chat (for Twitch insert "irc.twitch.tv")
      Server port - port of stream chat (for Twitch insert "6667")
      Bot name - name of bot sending information to stream chat
      Server password - oauth password to bot account (NOT stream channel password). You can get oauth password from this site.
      Channel - name of stream channel (Note: all Twitch channels are lowercase)
      Hex listener port - port that we inserted in Hex config.ini

      4 additional checkboxes are not needed to connect (and by default they are not selected):

      Does bot account have a mod? checkbox - change minimum delay between messages (1.5 second for not modded - which allows for displaying messages without problems).

      Use custom html draft panel checkbox - selecting checkbox will change hex draft panel view to custum "data/DraftPanel.html" HTML page. Bot will try to replace keywords inserted into html with proper values. This allows for creating fully custom way of displaying votes and currently winning card.

      Enable test draw command checkbox - enables command "!udraft test" which will display in stream chat test card list and will randomly put 100 votes (Recommended to run it set up stream overlay or show viewers how this is working)

      Enable test save deck Hex event checkbox - enables listening for Hex client save deck event. When event occures, bot will send to stream chat message "You just saved the deck {deck_name}" (Recommended to run it during first connection to check if bot is correcly connected with Hex client)


    NOTE: If You are using any other bots, You can try to connect both of them on same account, but there is a chance that they will be in conflict. Thats why I recommend creating separate account (modded in channel) for this bot.


    After pressing "Connect" button, if everything was inserted correctly, at the bottom should appear 2 green lines informing us about successful connecting
    udraft_connected.jpg
    Now only thing left is to press "Start listening to draft" button, start draft and results of viewers voting will be shown in second tab ("Hex draft").


    List of available commands
    Commands are not case sensitive.
    • !pick {index} - votes for card with specific index from current cards list
    • !pick {name} - votes for card with specific name from current cards list
    • !pick random - votes for random card from current cards list
    • !card {index} - displays in chat link to image of card with specific index from current cards list
    • !card {name} - displays in chat link to image of card with specific name, not only from current card list (name of card IS case sensitive)
    • !udraft help - displays in chat basic help message
    • !udraft about - displays in chat basic about message
    • !udraft commands - displays in chat list of available commands
    • !udraft test - displays in chat test list of cards (available only if "Enable test draw command checkbox" is selected)
    • !udraft test populate - displays in chat test list of cards and puts randomly 10 votes (available only if "Enable test draw command checkbox" is selected)



    List of available keywords in custom HTML5 draft panel view:
    • {number_of_votes} - number of all votes.
    • {currently_winning_card_name} - currently winning card name.
    • {currently_winning_card_src} - base64 image of currently winning card (or "images/load_failed.png" image in case of failed loading of image 3 times in row).
    • {card_N_visibility} (e.g. {card_1_visibility}) - state "visible" if Nth card from list (sorted by votes previously) is existing and have more then 0 votes, state "hidden" otherwise.
    • {card_N_name} (e.g. {card_1_name}) - name of Nth card from list (sorted by votes previously).
    • {card_N_number_of_votes} (e.g. {card_1_number_of_votes}) - number of Nth card's votes from list (sorted by votes previously).
    • {card_N_votes_bar_width} (e.g. {card_1_votes_bar_width}) - percentage width of Nth card's bar from list (sorted by votes previously), quotient of Nth card's votes and most votes per single card.



    UDraft Bot 1.9.3 changes - list of changes in 1.9.3 version of bot.
    UDraft Bot 1.9.4 changes - list of changes in 1.9.4 version of bot.
    UDraft Bot 2.0.2 changes - list of changes in 2.0.2 version of bot.
    UDraft Bot 2.0.3 changes - list of changes in 2.0.3 version of bot.



    If you have any questions or feedback, please feel free to share it
    In case of any errors UDraftBot should create "udraftbot.log" file in same folder as bot, if You send it to me, I'll try to fix error as soon as possible


    For anyone curious or uncertain of download file: source code of UDraftBot is available here.
    Attached Images Attached Images
    Last edited by Risterral; 01-10-2016 at 05:42 PM.

  2. #2
    This is amazing
    In Game Name: Halko

  3. #3

  4. #4
    This is amazing
    IGN: Magic

    Member of The Unnamed Council- the Hex TCG PvE Guild

  5. #5
    Master Theorycrafter
    Join Date
    May 2013
    Location
    Toronto, Canada
    Posts
    516
    This is amazing

  6. #6
    Amazing, this is.
    IGN - Victory
    Guild Master Backer:
    http://i.imgur.com/W8LAtLe.png

  7. #7
    <_<
    >_>
    <_<
    C-c-c-... No, actually this is pretty damn amazing.
    Xenavire, proud guild leader for The Lions Share.
    http://i307.photobucket.com/albums/n...erlinsmall.png

  8. #8

  9. #9

  10. #10
    Quote Originally Posted by Kami View Post
    Apple pie. (For the uninitiated, that means this is amazing.)
    Stop giving me cravings! *cries*
    Xenavire, proud guild leader for The Lions Share.
    http://i307.photobucket.com/albums/n...erlinsmall.png

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •