Mini Project: Companions/Bots

05/24/2010 23:25 pro4never#16
Quote:
Originally Posted by Korvacs View Post
What sort of AI will you be using? Im still working on my monster AI, and at the moment it works quite well, although its difficult to test without implementing the majority of the monster system.
I'm toying with the idea of trying a neural network to have the bot 'make decisions' with but i'm kinda drawing a blank on how that would actually apply to some things.


Right now i'm just using datetimes and ints to control how often actions CAN occur and random chance combined with bot behavior types and difficulty to determine how often they DO occur... then actual actions have random chance and all that stuff in them and try to determine the best course of action (such as running through a few tries to determine which way to walk to get closer to their target coords).

Haven't done any high level ai yet though so they are still quite basic. Using a main bot thread to run all my checks and then splitting off into behavior types which splits off into types of actions (move/atk/etc)

Duelist bot isn't quite like a person but if you bump up the difficulty it puts up a hell of a fight.

I'm rewriting almost everything and taking it over to my hellmouth source (which could use a ton of cleaning) so if i get things working there i'll prob just release it as an entire source cause it really tends to run into every area of code... trying to keep it more self contained this time though.

ps. Yes, duelist bot is working now quite well.

What's your oppinion on the best way to do ai korv? I hate using sooo many if statements just to do something simple but something tells me any more advanced system will cause more problems... i do like the idea of a connectionalist structure though.. give weight to diff actions and have it spit out a choice based on the result/history of the network
05/25/2010 07:06 BlueFlame11#17
Nice Idea it looks bad ass =P
05/25/2010 20:06 pro4never#18

Note: WATCH THE HQ VERSION. If not none of the text will be readable really. next time I'll do a proper one with annotations and w/e.


I'll record a much shorter video showing the companion bot later. This one is so long because I was writing about the upgrades I made and showing off the different difficulty levels.

Also ignore me not hitting anything, it was laggy due to recording and I wasn't really caring to try.
05/25/2010 21:01 xScott#19
I realy wanna try this, looks fun.
Shame my coding skills are not that great :)
05/25/2010 21:52 pro4never#20
Quote:
Originally Posted by xScott View Post
I realy wanna try this, looks fun.
Shame my coding skills are not that great :)
Welll once i recode it into the hellmouth source and fix some of the problems i left in that version i may put a test server online. One of my friends still has his dedi server in europe that i can use. 1 gig unmetered connection ftw
05/25/2010 22:04 xScott#21
Quote:
Originally Posted by pro4never View Post
Welll once i recode it into the hellmouth source and fix some of the problems i left in that version i may put a test server online. One of my friends still has his dedi server in europe that i can use. 1 gig unmetered connection ftw
awesome, definitely would like to try it!
05/26/2010 20:10 MonstersAbroad#22
Heres abit of code for impulses source 5165
well I used a hashtable and added this into GameState.cs
Code:
 public void DuelistTest()
        {
            Game.Entity duelist = new Game.Entity(Game.EntityFlag.Bot);
            duelist.MapObjType = Game.MapObjectType.Bot;
            this.BotOwner = Entity;
            BotOwner = Entity;
            duelist.Name = Entity.Name + "[BOT]";
            duelist.X = Entity.X += 1;
            duelist.Y = Entity.Y += 1;
            duelist.Dodge = Entity.Dodge *= 2;
            duelist.Defence = Entity.Defence *= 2;
            duelist.MapID = Entity.MapID;
            duelist.Body = Entity.Body;
            duelist.Hitpoints = Entity.MaxHitpoints;
            duelist.Level = Entity.Level;
            duelist.Stamina = 250;
            duelist.Face = Entity.Face;
            duelist.Facing = Entity.Facing;
            duelist.HairColor = Entity.HairColor;
            duelist.HairStyle = Entity.HairStyle;
            duelist.Strength = 750;
            duelist.Agility = 750;
            duelist.Spirit = 750;
            duelist.Vitality = 750;
            duelist.Spouse = "TheServer";
            duelist.MinAttack = 500;
            duelist.MaxAttack = 3000;
            duelist.BaseMinAttack = 500;
            duelist.BaseMaxAttack = 3000;
            duelist.BaseMagicDefence = 300;
            duelist.BaseMagicAttack = 5000;
            duelist.Class = Entity.Class;
            duelist.ItemBless = Entity.ItemBless;
            duelist.ItemHP = Entity.ItemHP;
            duelist.ItemMP = Entity.ItemMP;
            duelist.PKMode = Game.Enums.PKMode.PK;
            // entity.UID = 400001;
            duelist.UID = (uint)ServerBase.Kernel.Random.Next(400000, 500000);
            ServerBase.Kernel.Bots.Add(duelist.UID, this);
            duelist.SendSpawn(this);
        }
        public void DuelistTestMove()
        {
            if (DateTime.Now > LastBotMove.AddMilliseconds(250))
            {
                LastBotMove = DateTime.Now;
                if (Game.Attacking.Calculate.PointDistance(BotOwner.X, BotOwner.Y, Entity.X, Entity.Y) >= 4)
                {
                    DuelistJumpAround();
                }
            }
        }
        void DuelistJumpAround()
        {
            BotOwner.X = (ushort)(Entity.X + ServerBase.Kernel.Random.Next(7) - ServerBase.Kernel.Random.Next(7));
            BotOwner.Y = (ushort)(Entity.Y + ServerBase.Kernel.Random.Next(7) - ServerBase.Kernel.Random.Next(7));
            BotOwner.Action = Game.Enums.ConquerAction.Jump;
        }
and these
Code:
        public static DateTime LastBotMove = DateTime.Now;
        public static DateTime LastBotAttack = DateTime.Now;
        public static bool BotInUse = false;
        public Game.Entity BotOwner;
in kernel.cs I made the top look like
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
and then added
Code:
public static Hashtable Bots = new Hashtable();
In program.cs I adde
Code:
        static void BotThread_Execute()
        {
           
        }
and I added
Code:
ServerBase.Thread BotThread = new ServerBase.Thread(10);
                BotThread.Execute += new Action(BotThread_Execute);
and the
Code:
GC.KeepAlive(CharacterThread); GC.KeepAlive(FloorItems); GC.KeepAlive(StatusFlagChange);
I made look like
Code:
GC.KeepAlive(CharacterThread); GC.KeepAlive(FloorItems); GC.KeepAlive(StatusFlagChange); GC.KeepAlive(BotThread);
then added the command in packerhandler.cs
Code:
case "bot":
                                        {
                                            client.DuelistTest();
                                            break;
                                        }
About 25% done. OH I also find
Code:
public enum EntityFlag : byte
    {
and make it look like
Code:
        Player = 1,
        Monster = 2,
        Bot = 3
then find
Code:
 public enum MapObjectType
    {
and make it look like
Code:
    public enum MapObjectType
    {
        Npc, Item, Monster, Player, Nothing, InvalidCast, Bot
    }
again as I said 25% done.
05/26/2010 20:55 BlueFlame11#23
Thanks Moster

@ThreadStarter

Teheh i think it's kind of funny you lost to a bot =P or if you weren't trying rofl
05/26/2010 23:32 gerble93#24
Quote:
Originally Posted by BlueFlame11 View Post
Thanks Moster

@ThreadStarter

Teheh i think it's kind of funny you lost to a bot =P or if you weren't trying rofl
Can you beat a calculator at what it does best?
05/27/2010 00:03 pro4never#25
Quote:
Originally Posted by gerble93 View Post
Can you beat a calculator at what it does best?
Actually when i was properly fbing with it lastnigh i was winning up to difficulty 3.

In the vid i only threw out likke 3 fb's. Total and didn't try to hit due to recording lag and trying to show off the system.


@ monster: very nice looking progress. Does any of it work yet or still writing the groundwork?

@ progress: still not adding much more till i sort out exactly how i plan to do the logic server. After talking to korvaks i'm thinking named pipes are prob the way to go to get data back and forth between game and logic server and once that's running i'l work on the test version of the neural network to give proper ai. Also started making a list of new functions i'll need to write to import world stimuli to help make decisions. Planing is coming along nicely but not a ton of hard code to show for it yet. That will be a few days at least. Glad to see all the interest on the subject.
05/27/2010 00:15 BlueFlame11#26
Quote:
Originally Posted by gerble93 View Post
Can you beat a calculator at what it does best?
Hey i just thought it was funny =P
05/27/2010 01:36 pro4never#27
Quote:
Originally Posted by BlueFlame11 View Post
Hey i just thought it was funny =P
I should have recorded the first version lol..

It would only fb when the coords chosen would hit and I forgot to reset the lastSkill datetime so it would SPAM it..


I got hit 100x per second. Lots of fun.
05/27/2010 03:53 ImFlamedCOD#28
Quote:
Originally Posted by pro4never View Post
I should have recorded the first version lol..

It would only fb when the coords chosen would hit and I forgot to reset the lastSkill datetime so it would SPAM it..


I got hit 100x per second. Lots of fun.
So he was basically aim boting that noob ai using aimbots :) Good luck man .
05/27/2010 12:08 ImmuneOne#29
Quote:
Originally Posted by pro4never View Post
Actually when i was properly fbing with it lastnigh i was winning up to difficulty 3.

In the vid i only threw out likke 3 fb's. Total and didn't try to hit due to recording lag and trying to show off the system.


@ monster: very nice looking progress. Does any of it work yet or still writing the groundwork?

@ progress: still not adding much more till i sort out exactly how i plan to do the logic server. After talking to korvaks i'm thinking named pipes are prob the way to go to get data back and forth between game and logic server and once that's running i'l work on the test version of the neural network to give proper ai. Also started making a list of new functions i'll need to write to import world stimuli to help make decisions. Planing is coming along nicely but not a ton of hard code to show for it yet. That will be a few days at least. Glad to see all the interest on the subject.
Automated interfaces are all based upon incoming data, also you should do a bit of a fair system for skill-wise attacks. I shall give you some examples if you come online on friday.
05/27/2010 17:13 MonstersAbroad#30
Pro4Never - can you PM me ur msn please ?