Loading
  Password:
  Lost password?  
LogoutLOGOUT
Join as a MemberJoin as a Member
 
FlashMove Live Support



Go Back   FlashMove Forums > Commune > Members Cafe

ReplyREPLY THREAD
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-29-2006, 01:28 PM
puppy's Avatar
puppy puppy is offline
Guide
 
Join Date: Dec 2002
Posts: 2,866
puppy is on a distinguished road
Cyborg Say folks, how about some AI wanking?

There was lengthy discussion at kirupa's battle place for quite a few monthes already, which can be summarized by first senocular reply:
Quote:
Originally Posted by senocular
We tried this a few years ago with robot battles (actually I think it was a different forum). It seemed like a cool idea, but it was hard to implement and never really happened.
So I re-opened this here, this time with something up and running. So far, the only reply was that it didn't work. I checked twice, and it works for me. What about you? (btw, if you like the idea, post me some scripts, or URLs to scripts @ your site, so I could link to it for othher people reference).
__________________
  #2  
Old 10-29-2006, 04:12 PM
thenovice thenovice is offline
Registered User
 
Join Date: Oct 2006
Posts: 22
thenovice is on a distinguished road
i looked at the code.
i was wondering what i need to do to get it to work
i.e mc btn or should it run on it,s own.
sorry total n00b and gaming is the area that i wish to get into.
  #3  
Old 10-29-2006, 07:13 PM
niq niq is offline
Registered User
 
Join Date: Sep 2002
Posts: 268
niq is on a distinguished road
looks like a nice idea. i looked at it, works perfectly. but i don't really have an idea about how the whole thing works. you got some more explanation about what inColors, inDistances means and about how the engine wrks in general?

niq
  #4  
Old 10-30-2006, 12:05 AM
thenovice thenovice is offline
Registered User
 
Join Date: Oct 2006
Posts: 22
thenovice is on a distinguished road
how did you get it to niq
  #5  
Old 10-30-2006, 07:44 AM
puppy's Avatar
puppy puppy is offline
Guide
 
Join Date: Dec 2002
Posts: 2,866
puppy is on a distinguished road
well if niq didn't get it, I must have been in real rush

well there are 36 directions (angles) that the bot can "see" in. inColors is supposed to be array of "colors" visible in every direction. "colors" are represented by numbers according to "color map" (click "info" button); using inColors you can determine what's there (pickable bullet, enemy, wall, or flying bullet). inDistances are simply distances to things in every direction.

whole thing works by polling javascript function from onEnterFrame to exchange in/out data.

EDIT: I just thought I'd put sample code here for people to not have to click too much, here it goes:
Code:
if (!this.inHasBullet) {
    // no bullet, let's get it
    var bulletAt = -1;
    for (var i=0; i< this.inColors.length; i++) {
        if (this.inColors[i] == 2) {
            bulletAt = i; break;
        }
    }
    // go up until we see it
    this.outMoveAngle = (bulletAt < 0) ? 27 : bulletAt;
    this.outMoveSpeed = this.inMaxSpeed;
} else {
    // look around for enemy
    var enemyAt = -1;
    for (var i=0; i< this.inColors.length; i++) {
        if (this.inColors[i] == 1) {
            enemyAt = i; break;
        }
    }
    if (enemyAt > -1) {
        // throw the bullet
        this.outThrowBullet = true;
        this.outThrowAngle = enemyAt;
 this.trace("Throwing @" + enemyAt);
    }
    // up we go
    this.outMoveAngle = 27;
    this.outMoveSpeed = this.inMaxSpeed;
}
__________________
  #6  
Old 10-30-2006, 08:30 PM
niq niq is offline
Registered User
 
Join Date: Sep 2002
Posts: 268
niq is on a distinguished road
ok, thanks, i think i'm getting there how it works. i'll spend some time in deep meditation to finally understand your and generate my own script. sth like that thingy should become the contest for flashmove's next anniversary.

@thenovice: just copy and paste puppy's script into the bot's behaviour, then press "fight!"

good night - good fight,

niq
  #7  
Old 11-06-2006, 11:58 AM
puppy's Avatar
puppy puppy is offline
Guide
 
Join Date: Dec 2002
Posts: 2,866
puppy is on a distinguished road
so, niq, still contemplating the meaning of life?
__________________
  #8  
Old 11-15-2006, 12:18 PM
puppy's Avatar
puppy puppy is offline
Guide
 
Join Date: Dec 2002
Posts: 2,866
puppy is on a distinguished road
just to keep track of things, and also to bump this thread, here is first and only script so far.
__________________
  #9  
Old 11-26-2006, 05:38 PM
scooby56 scooby56 is offline
Registered User
 
Join Date: Nov 2006
Posts: 3
scooby56 is on a distinguished road
second bot...

Hi board, my first post here...

I love the idea of the AI battleground, so much so that coding this little dude has eaten up most my Sunday :O)

This is my first attempt at AI and i don’t claim to be a great coder so please don't laugh. the code is elsewhere so if i update it, u guys always get the most recent.

So…

here 'he' is complete with evasive routines etc…
My bot

Only other bot

Battleground

Cheers.

BTW make sure you paste the code in the right box. (most in the top one- backward i know...)
  #10  
Old 11-26-2006, 09:29 PM
puppy's Avatar
puppy puppy is offline
Guide
 
Join Date: Dec 2002
Posts: 2,866
puppy is on a distinguished road
hello all, just wanned to say it's nice to see interested people. since you are actually using it, I took my time and added reset button (as promised). also, there is a breaking change: you can pick up only 1 bullet. basically, that was the idea; the "feature" that you could pick more bullets was actually a bug. so, add this.inHasBullet check. also, I noticed that sometimes it is possible to walk through walls, but I don't feel like fixing it now thanks scooby for your time, and sorry to break your script, again
__________________
  #11  
Old 11-27-2006, 12:03 AM
scooby56 scooby56 is offline
Registered User
 
Join Date: Nov 2006
Posts: 3
scooby56 is on a distinguished road
np puppy,

I'll take a look at this tomorrow and fix it.

I look forward to additional feature and maybe improved visuals. Say... if you need any assistace with developing this give me a shout, I think it has real potential & id be happy to help, im not bad with drawing in flash either...

I read comments on some other board you had posted about how people might not be participating because they don’t see this as a challenge. The thing is… these boards have visitors and member who have a wide range of skill so the AI battle must appeal to some. Being my first AI attempt, I thoroughly enjoyed the conception of my little ‘creature’, watching him make his own decisions in battle etc . Anyway id like to see an advanced coder set the standard with a ‘difficult to beat’ droid but this is no good if any amatur can come along, make a few tweaks, not really understanding the code, and claim it their own work.

At this stage we need only a small number of people interested enough to create their own script. Interest and competition will soon grow

I hope you're open to suggestiong because I have some thoughts.

One neat feature would be to have the ability to link to script that is hidden somehow. Maybe a link to a compliled swf (not sure how this would be done...) Once you have the ultimate droid you wouldn't want people stealing your best bits

keep up the good work
  #12  
Old 11-27-2006, 08:08 AM
puppy's Avatar
puppy puppy is offline
Guide
 
Join Date: Dec 2002
Posts: 2,866
puppy is on a distinguished road
actually that was some quick and poor code there. I'm not sure if this is good idea to develop it further; maybe it's better to re-write it from scratch. I mean I can give you fla, no prob, if you want to, but it's just not worth of it, really.

as for hidden scripts... why would you care if someone steal them? there's no money here, after all. you can run your script through some sort of javascript obfuscator, but, I say if you do not want to share you script, then do not post it on the Internet, that's simple. on the other hand, those little tweaks could be fruitfull on their own, like giving you an idea you would never come up with on your own, etc.
__________________
  #13  
Old 01-03-2007, 01:43 AM
hohoho hohoho is offline
Registered User
 
Join Date: Jan 2007
Posts: 3
hohoho is on a distinguished road
Hey, that's cool

I just found this AI game. it's really addictive! I made a script that canes all those other scripts too! Mainly because it avoids bullets pretty well. But, you, whoever made it - scooby??, should get it more organised into a competition, with randomly generated mazes or startpoints so it doesn't always play out the same. It'd be cool to see how intelligent they can become.

Anyway here's my amazing bot. Tho it gets stuck sometimes if the opponent isn't around. I was putting in some randomizing to stop it getting stuck, when I accidently refreshed the page and lost it!! Aarh! But it still wastes all the other scripts I've found on here most of the time.



this.outMoveSpeed = this.inMaxSpeed;
this.outThrowBullet = false;

// Find a bullet
closestbullet = 1000;
if(!this.inHasBullet){
for(lookang=0;lookang<36;lookang++){
if (this.inColors[lookang] == 2){
if(this.inDistances[lookang] < closestbullet){
bestangle = lookang;
closestbullet = this.inDistances[lookang];
}
}
}
}
// Find open spaces
if (closestbullet == 1000){
maxdist = 0;
for(theta=-9;theta<=9;theta++){
lookang = this.outMoveAngle + theta;
if (lookang > 35) lookang = lookang - 36;
if (lookang < 0) lookang = 36 + lookang;
if ((this.inDistances[lookang] > maxdist) && (this.inColors[lookang] == 0)){
maxdist = this.inDistances[lookang];
bestangle = lookang;
}
if(maxdist < 15){
bestangle = bestangle - 18;
if(bestangle < 0) bestangle = bestangle + 36;
}
}
}


// Find enemy
if (this.inHasBullet){
foundenemy = false;
for(lookang=0;lookang<36;lookang++){
if (this.inColors[lookang] == 1){
bestangle = lookang;
this.outThrowAngle = lookang;
foundenemy = true;
}
}
}

// Dodge bullets
if(!dodging && this.inMaxSpeed >= 3){
for(lookang=0; lookang<36; lookang++){
if(this.inColors[lookang] == 3){
dodging = true;
theta = lookang + 11;
if (theta > 35) theta = theta - 36;
maxdist = this.inDistances[theta];
bestangle = lookang - 11;
if (bestangle < 0) bestangle = bestangle + 36;
if(this.inDistances[bestangle] < maxdist) bestangle = theta;
this.outMoveAngle = bestangle;
}
}
}

// Finish dodging bullets
if(this.inMaxSpeed >= 3){
dodging = false;
for(lookang=0; lookang<36; lookang++){
if(this.inColors[lookang] == 3)
dodging = true;
}
}
else dodging = false;
if (!dodging) this.outMoveAngle = bestangle;
if (foundenemy && (this.inDistances[this.outMoveAngle] < 80)) this.outThrowBullet = true;
  #14  
Old 01-05-2007, 02:00 PM
puppy's Avatar
puppy puppy is offline
Guide
 
Join Date: Dec 2002
Posts: 2,866
puppy is on a distinguished road
hey ho, if you divide the number of people who have made their scripts (4) by the number of people who knew about this thing (758 views for this thread only), you would end up with less than 1% there is no free way to "get it more organised into a competition", and I do not feel like spending neither tons of money for prizes and ads campaign nor hours of time perfecting the code.
__________________
  #15  
Old 01-05-2007, 03:15 PM
hohoho hohoho is offline
Registered User
 
Join Date: Jan 2007
Posts: 3
hohoho is on a distinguished road
People play football without prize money or advertising. I'd almost offer to take it off your hands have the same problem with not feeling like it :P
ReplyREPLY THREAD


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free hosting for skilled folks aerobus Work/Job Opportunities 0 08-05-2002 04:36 PM
Folks check this out...:) Sidomatic Site Check 2 09-12-2000 03:29 PM



All times are GMT. The time now is 01:43 PM.




Powered by vBulletin version 3.5