I don't have the time computer with me to test anything right now. But if you care, I did make an irc bot using twisted once, that supports mods that run, so a lot of your functions could simply be mods. I can't recall how far we made it on the project, but we did run it during pyweek once and worked fairly well :)
http://code.google.com/p/compobot/ <http://code.google.com/p/compobot/>In reference to your chat log, what I did was use an online "get_my_hostname" site and parsed the data, then you could simply test whether your host binds to that port or not... sock = socket.socket(...) try: sock.bind(...) print "we're good to go!" except: print "dang, we can't do it" On Wed, Sep 22, 2010 at 2:03 AM, Thiago Chaves <[email protected]> wrote: > Short update: > > I'm posting a first draft version of "Pyttlebot" and I would just like to > post it here before I scrap the thing. Thanks to RB[0] I was able to give > consideration to the possibility of one not being able to host a game though > I'm on the workings of finding out what to do about it. I'm leaving it > running on irc.freenode.net #pyttle.net for the following 12 hours or so, > with possible interruptions if problems occur. > > As the next thing I'm gonna do is use a Pygame GUI library to create a > minimalist IRC client that automatically connects to irc.freenode.net and > joys #pyttle.net and supports some basic functionalities such as chatting > and private messages. I'll worry about the bot and protocol again once that > is done. > > What needs to change in the bot: > * Instead of the user informing the bot "I can host" or "I can't host", the > bot itself should attempt connection to the user's machine and verify if the > user can host, unless the user specifies a lack of desire for hosting a > game. > * Its code should look prettier than it looks now, seriously. If there's > any hope for me to get people using it for their own games. > * It should respond to channel messages directed at it, rather than having > the person wondering on how to use it. > * Accept registering of dedicated servers. The bot has registered dedicated > servers, then it doesn't need to wait for a hosting-capable user to show up, > but it should ask the dedicated server if there's a free game slot available > before announcing the game to the players. > > Alex, if you're interested in building the bot, could you check the code > (or visit it and test its behavior) and get a new one in the workings? You > can change the grammar / syntax of the bot, but make it easy to parse by the > client. > > I would say that if the bot accomplishes this much, and the client is able > to make these requests to the bot and react to a match announcement by > launching a game, then Milestone 1 has been achieved. =) > > If anyone is interested in trying it out the bot is on #pyttle.net at > irc.freenode.org. To get instructions from it, you need to enter a private > conversation and say something random. > > -Thiago > > PS: In case anyone is wondering why trying a connection is necessary, I'm > also posting a log from a conversation I had in #twisted. > > > On Mon, Sep 20, 2010 at 9:07 PM, RB[0] <[email protected]> wrote: > >> Everything except the actual code and the "RB[0]'s design docs" wiki page >> on here is outdated, but: >> >> http://code.google.com/p/galaxymageredux/ >> >> Cheers, and good luck :) >> >> >> On Mon, Sep 20, 2010 at 1:02 PM, Thiago Chaves <[email protected]>wrote: >> >>> Can you provide a link to your library, RB[0]? I googled Galaxymage but I >>> keep bumping into galaxymage.org, and the address is cybersquatted from >>> here. >>> >>> I understand what you said about the routing issues, and that's quite >>> true and I run into that problem quite often and shamefully enough, I >>> haven't considered that. >>> >>> I'm pushing on anyways and finishing a first draft of the first bot (to >>> which I won't give that much more thought if someone else is willing to take >>> the job) and then I'll get a minimalist client and network game going. But >>> thanks a lot for the input. =) >>> >>> -Thiago >>> >>> >>> On Mon, Sep 20, 2010 at 7:41 PM, RB[0] <[email protected]> wrote: >>> >>>> Hmm, perhaps I should explain better. >>>> The users/hosts wouldn't interact on the master server, except to >>>> connect to game servers, start servers and possibly chat. >>>> The game servers would be programmed by the games using them, so either >>>> one server = one game, or like in GMR, one game server hosts multiple >>>> games... >>>> >>>> >>>> On Mon, Sep 20, 2010 at 11:39 AM, RB[0] <[email protected]> wrote: >>>> >>>>> Well, this is something we had an issue with in GMR. >>>>> Not everyone can "host" a game, if you have a router like mine is it is >>>>> quite nearly impossible to create a server that others can connect to. >>>>> The way we planned to do it in GMR, was to have people create their own >>>>> server, and register it with the master server. >>>>> The master server in turn would check to ensure the game server was >>>>> really visible, then load up it's data (game, version, max users/games, >>>>> password, etc.) and provide that to people wanting to use the service. >>>>> >>>>> You could do this via irc, but I think a simple PB solution would be >>>>> simpler and more extensible. But if you make this up and it takes off >>>>> we'll >>>>> definitely at least support it in GMR :) >>>>> >>>>> >>>>> On Mon, Sep 20, 2010 at 12:37 AM, Thiago Chaves >>>>> <[email protected]>wrote: >>>>> >>>>>> Missing end of sentence here: a default bot could/should exist for use >>>>>> by developers with no interest in customizing it for their own game, or >>>>>> to >>>>>> be extended by developers who want to add other features specific to >>>>>> their >>>>>> game. >>>>>> >>>>>> >>>>>> On Mon, Sep 20, 2010 at 8:11 AM, Thiago Chaves >>>>>> <[email protected]>wrote: >>>>>> >>>>>>> It's very cool to hear about two other people so soon after the >>>>>>> initial post interested in getting this going. =) >>>>>>> >>>>>>> For purposes of not commenting about how much I'd like to get a >>>>>>> better name for the thing everytime I mention it, I'm gonna use >>>>>>> "Pyttle.net" >>>>>>> on the email, but leave here stated that I'm not suggesting this as a >>>>>>> name >>>>>>> for the system. =P >>>>>>> >>>>>>> So, things I was thinking of: >>>>>>> >>>>>>> 0. Users have a collection of more than zero games that support >>>>>>> getting started by Pyttle.net / having matches started by. >>>>>>> 1. Chatting between users, emoting actions, registering and >>>>>>> confirming of usernames is handled by the chosen protocol and the chosen >>>>>>> protocol's servers. >>>>>>> 2. The client connects automatically to the chat server(s) and joins >>>>>>> channels according to the collection of Pyttle.net-capable games >>>>>>> present in >>>>>>> the user's machine. #fog-of-war-chess, #galaxymage, #ssof, for instance. >>>>>>> 3. Each game/channel has it's own bot running in there, which deals >>>>>>> with negotiation of matches, scorekeeping (if there's any interest in >>>>>>> the >>>>>>> game for that), messages-of-the-day, etc. A default bot could/should. >>>>>>> 4. Once a match has been arranged, the bot informs all involved >>>>>>> clients that the match is gonna start, who are the players and in which >>>>>>> IP's >>>>>>> they can be found. >>>>>>> 5. Once a client has been informed of a match, it takes care of >>>>>>> launching the game and it deals with the network connections and data >>>>>>> on its >>>>>>> own accord. >>>>>>> 6. Once a match is over, if there's interest by the developers to >>>>>>> have some scoreboard, the clients inform the results back to the bot, >>>>>>> who >>>>>>> logs it and whatever. >>>>>>> >>>>>>> I'm totally open to negotiating/discarding/changing any/all of these. >>>>>>> I want something like a game-agnostic "battle.net" to happen. =) >>>>>>> >>>>>>> Opinions? What is missing? What could be added? What is poorly >>>>>>> explained? >>>>>>> >>>>>>> -Thiago >>>>>>> >>>>>>> >>>>>>> On Sun, Sep 19, 2010 at 9:25 PM, Alex Nordlund < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> On Sun, Sep 19, 2010 at 7:22 PM, RB[0] <[email protected]> wrote: >>>>>>>> > I've been reading Twisted documentation and this sounds like a >>>>>>>> > less-than-guru-level thing to build on top of the IRC protocol. >>>>>>>> >>>>>>>> I'd like to contribute to this project! >>>>>>>> >>>>>>>> I enjoy IRC and have been building bots that play games over IRC for >>>>>>>> a while. >>>>>>>> >>>>>>>> --- >>>>>>>> //Alex >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >
