User Control Panel
Advertisements

HELP US, HELP YOU!

Game bot help

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Getting Started
View unanswered posts
Author Message
dreallink
Newbie
Newbie


Joined: 20 Jun 2006
Posts: 2


PostPosted: Tue Jun 20, 2006 9:01 pm    Post subject: Game bot help Reply with quote

I just went through a tutorial on this site here, on making a regular chat bot and how to edit and change everything.

Now, I'm wondering if there are any tutorials or if anyone can tell me how to go about making a game bot?

More specifically, I'm wanting to make a trivia bot. It's for a group chat (aim, msn, or yahoo..or all 3), and I want it to be able to keep scores, record a winner, and stop after a set score has been reached.

Any help/info on where I can find out how to do this, or how to do this is appreciated. Thanks.
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Tue Jun 20, 2006 9:09 pm    Post subject: Reply with quote

Thats a pretty bold first undertaking. there was realy only 1 good trivia bot ever (run by Thomas). While it is an excellent goal and will be good programming experience I would recommend you start smaller...much much smaller! Like perhaps small enough that you can ask us a simple question, we can give you a simple answer, and then we can continue from there.

There are no tutorials for more advanced gaming that i know of because they start to branch out rather quickly. The first thing you will definitly need is a way to store users data across sessions (where sessions are defined as a users visit, so accross sessions would be still remembering his name tommarrow after you reboot the bot), and a command system. These normaly go well together because to test session data you will need commands! "!set name = Eric"

That might not sound like it has anything to do with games, but it will get you along the way.

To make a trivia game you need:

  1. Trivia!
  2. to ask a question and wait X seconds before revealing the answer
  3. to listen to guesses and score them if they are inside the right time period
  4. to store users info and stats
  5. to retrieve and display stats
  6. ots more trivia!
  7. ways to handle cheaters/flooders/idiots/jerks/girls

So pick items on the list and tackle them as pieces, it will make your life easier and give you specific problems to ask for help accomplishing!

P.S. I would start with simple games like tictactoe, blackjack, rock paper scissors, dice games, or the like.

_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Tue Jun 20, 2006 9:31 pm    Post subject: Reply with quote

A while back I wrote a useful module for handling multiplayer games--called Games::Multiplayer::Manager.

You can get it from http://search.cpan.org/perldoc?Games::Multiplayer::Manager - right-click the "Source" link at the top, and save it as "C:/Perl/site/lib/Games/Multiplayer/Manager.pm"

There's an example of its use under the Synopsis on that manpage. One thing I should note, though: in the Synopsis, it says "$self->{msg}" but it should be "$self->{message}" as it is later on in the manpage.

This should help you out with the basic framework for your bot. You'll still need to read and write user data to files so that they can be remembered if you shutdown your bot and bring it back online, but this module can manage things for you while your bot is online.

Here's some more example code with it:

Code:
# This would be in your Juggernaut.pl file
# with the other "use" statements (I assume
# you're using Juggernaut since that's what that
# tutorial was for, but anyway it'd be in
# the main bot file)
use Games::Multiplayer::Manager;
our $games = new Games::Multiplayer::Manager;

# Set up a broadcast handler.
$games->setHandler (broadcast => sub {
   my $self = shift;

   # I assume you're only using the MSN
   # interface for juggernaut so that makes
   # things easier here. If not, you'll have to
   # differentiate between AIM and MSN by
   # whether "$self->{to}" has an @ symbol

   # Find out which MSN name is "hosting" this
   # user (look at the addPlayer event below for
   # where we're setting this)
   my $host = $games->{_games}->{trivia}->{ $self->{to} };

   # Have this MSN bot send the message.
   $chaos->{$host}->{client}->call ($self->{to}, $self->{message});
});

# Create the trivia game.
$games->create (
   id => 'trivia',
   name => 'The Trivia Game',
);

####################
####################

# Here'd be the command code for your trivia game
sub trivia {
   my ($self,$client,$listener,$msg) = @_;

   # See if they're in the game.
   my $playing = $games->queryPlayer ('trivia',$client);
   if ($playing) {
      # if they want to quit
      if ($msg eq 'quit') {
         # remove them from the game
         $games->dropPlayer ('trivia',$client);

         # broadcast it
         $games->broadcast ('trivia',"$client has quit the game");
         return "You have successfully quit the game.";
      }

      # do something with their message
   }
   else {
      # find out which MSN bot they're talking to
      my $handle = $self->{Msn}->{Handle};

      # add them to the game
      $games->addPlayer ('trivia',
         name => $client,
         host => $handle, # this sets their host
      );

      # tell everyone this player arrived
      $games->broadcast ('trivia', "$client has joined the game.");
      return '<noreply>';
   }
}
{
   Category => 'Multiplayer Games',
   Description => 'The Trivia Game',
   Usage => '!trivia',
   Listener => 'MSN',
};


This code would assume that everybody would chat with your bot in their own conversation windows, and that the bot would relay messages to everybody else's windows (which is what $games->broadcast does). If you want the users to literally exist in the same conversation, that's a little more work.

However, I should also note that it's impossible to moderate MSN chats (or group conversations). So if you wanted the approach where everybody literally exists in the same convo, you won't be able to do anything about spammers or other annoying people. With this, the bot can simply choose to stop relaying their messages and "block" them from the game.

That should get you started. Smile

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
ERijkee
Newbie
Newbie


Joined: 05 Jul 2004
Posts: 31
Location: Almere, The Netherlands
Reputation: 35.4Reputation: 35.4Reputation: 35.4Reputation: 35.4

PostPosted: Tue Jun 20, 2006 9:38 pm    Post subject: Reply with quote

I have made a multiplayer game bot with a jumble game Smile
Trivia is very similar in the way it works, the only difference is that jumble gives you scrambled words and trivia asks other questions.
If you want to use multiple IM networks you will have to use a simulated chat, or just have seperate rooms for each network.

But i too recommend to start with something simpler(unlike me Razz)

_________________
3D chat program I'm making Smile
Back to top
dreallink
Newbie
Newbie


Joined: 20 Jun 2006
Posts: 2


PostPosted: Tue Jun 20, 2006 11:03 pm    Post subject: Reply with quote

Cool, thank you all... I have another question...

what language is the implementation in?? ...is it perl, and what I mean by that, is perl also it's own language?? or is it java, or something else?

At the moment, the only advanced language I know is C++, so I understand some of the implementation in the coding.

like the # are obviously comments, there looks to be classes, but instead 'sub'...

Thanks again.

edit: yes, I am using juggernaut
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Wed Jun 21, 2006 1:03 am    Post subject: Reply with quote

Yeah, Perl is its own language. It's kind of like a programming language and a scripting language... in that, it's as powerful as a programming language (albeit a little slower since it's interpreted at run-time), but can be executed on the fly without compilation.

Anyway, if you don't already have Perl installed, you can get it for Windows from www.activeperl.com

A sub in Perl is like a (function?) in C++, except for unlike C++, subroutines don't have to declare what they return (i.e. there's no "int" or "void") because Perl is a lot more flexible on data types than C++ is.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Getting Started All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group