File: AntFarmREAL.swf-(93 KB, 700x500, Game)
[_] Ant Farm AI + code + source Anonymous 06/09/15(Tue)19:37:25 No.2808069
Ripped from http://www.zen-sign.com/extranet/antland/
I'm making my own creature AI stuff I'll post my update later tonight, but I found this a week
ago and it kind of inspired me. Super simple AI at work, I already decompiled the SWF and checked
the code - anyone wanna see?
Marked for deletion (old).
>> [_] Anonymous 06/09/15(Tue)19:41:51 No.2808073
class Ant extends MovieClip
{
var customName = "Name This Ant";
var warningOn = false;
var actionState = 0;
function Ant()
{
super();
this.age = 1;
this.appetite = 0;
this.decisionMod = 0.4;
this.moveDir = 5;
this.moveRate = 0.25;
this.maxAge = 1;
this.ageRate = 20000;
this.gender = 0;
this.digCapacity = 30;
this.antRestAmount = 1000;
this.xtile = 0;
this.ytile = 1;
this.tileW = 20;
this.tileH = 20;
this._x = this.xtile * this.tileW;
this._y = this.ytile * this.tileH;
this.growOlder();
this.getHungry();
this.doAI();
this.dying_sound = new Sound();
this.digging_sound = new Sound();
this.eating_sound = new Sound();
this.dying_sound.loadSound("sound/dying_voice.mp3",false);
this.digging_sound.loadSound("sound/digging.mp3",false);
this.eating_sound.loadSound("sound/eating2.mp3",false);
this.digging_sound.setVolume(75);
this.dying_sound.setVolume(30);
}
>> [_] Anonymous 06/09/15(Tue)19:47:04 No.2808080
>>2808073
function increaseAppetite()
{
if(!(this.appetite < 100))
{
if(!(this.actionState == 3) || !(this.actionState == 4))
{
this.actionState = 5;
clearInterval(this.hunger_intervalId);
this.die();
}
}
else if(!(this.appetite < 80))
{
this.appetite = this.appetite + 2;
if(this.warningOn == false)
{
if(!this._parent[this.myName].messageHolder.dyingWarning)
{
this.warningOn = true;
this._parent[this.myName].createEmptyMovieClip("messageHolder",this.getNextHighestDepth());
this._parent[this.myName].messageHolder.attachMovie("dyingWarning","dyingWarning",th
is.getNextHighestDepth());
this._parent[this.myName].messageHolder.dyingWarning._alpha = 0;
this.dyingWarningFadeIn = new mx.transitions.Tween(this._parent[this.myName].messageHolder.dy
ingWarning,"_alpha",mx.transitions.easing.Regular.easeOut,0,100,8,false);
}
else
{
this.warningOn = true;
this.dyingWarningFadeIn = new mx.transitions.Tween(this._parent[this.myName].messageHolder.dy
ingWarning,"_alpha",mx.transitions.easing.Regular.easeOut,0,100,8,false);
}
}
}
else if(this.warningOn == true)
{
this.dyingWarningFadeOut = new mx.transitions.Tween(this._parent[this.myName].messageHolder.dy
ingWarning,"_alpha",mx.transitions.easing.Regular.easeOut,100,0,8,false);
this.warningOn = false;
this.appetite = this.appetite + 2;
}
this.appetite = this.appetite + 2;
}
function reduceAppetite()
{
if(!(this.appetite < 6))
{
this.appetite = this.appetite - 6;
}
else
{
this.appetite = 0;
}
}
>> [_] Anonymous 06/09/15(Tue)19:48:17 No.2808084
>>2808080
function ageYear()
{
if(!(this.age < this.maxAge))
{
if(!(this.actionState == 3) || !(this.actionState == 4))
{
this.actionState = 5;
clearInterval(this.grow_intervalId);
this.die();
}
}
else
{
this.age = this.age + 1;
}
}
function getHungry()
{
if(!(this.hunger_intervalId == null))
{
clearInterval(this.hunger_intervalId);
}
this.hunger_intervalId = setInterval(this,"increaseAppetite",5000);
}
function growOlder()
{
if(!(this.grow_intervalId == null))
{
clearInterval(this.grow_intervalId);
}
this.grow_intervalId = setInterval(this,"ageYear",this.ageRate);
}
function die()
{
if(this.actionState == 5)
{
this.dying_sound.start();
delete this.onEnterFrame;
if(this.rest_intervalId)
{
clearInterval(this.rest_intervalId);
}
if(!(this.grow_intervalId == null))
{
clearInterval(this.grow_intervalId);
}
if(!(this.dig_intervalId == null))
{
clearInterval(this.dig_intervalId);
}
if(this["dyingWarning" + this])
{
this.removeMovieClip();
}
this._parent.totalAntsNo = this._parent.totalAntsNo - 1;
var _loc3_ = this._y;
var _loc2_ = this._y - 40;
this.gotoAndStop(9);
var _loc4_ = new mx.transitions.Tween(this,"_alpha",mx.transitions.easing.Regula
r.easeOut,100,0,30,false);
var _loc5_ = new mx.transitions.Tween(this,"_y",mx.transitions.easing.Regular.ea
seOut,_loc3_,_loc2_,30,false);
Aaaaand the and dies. There's about 500+ more lines of code, with character limit it will take
forever to paste this.
But you get the jist.
>> [_] Anonymous 06/09/15(Tue)19:59:26 No.2808100
you can only feed five times. wat
>> [_] Anonymous 06/09/15(Tue)20:02:59 No.2808106
these ants are rather stupid.....
the fuckers dug out the top 3 layers. thats it
>> [_] Anonymous 06/09/15(Tue)20:21:26 No.2808114
>>2808100
it recharges over time i noticed
>> [_] Anonymous 06/09/15(Tue)20:22:30 No.2808116
how do you even feed them
>> [_] Anonymous 06/09/15(Tue)20:23:42 No.2808119
>>2808100
how do you feed them ?
>> [_] Anonymous 06/09/15(Tue)20:24:46 No.2808120
>>2808084
You could have just linked a github post....
>> [_] Anonymous 06/09/15(Tue)20:34:52 No.2808133
>>2808100
>>2808119
>>2808116
There's a button at the bottom, if you move your cursor down there. Doesn't help much, as the
little tards piss and moan about starving even as they let all of their food rot, ignoring it
RIGHT FUCKING NEXT TO THEM...
Until OP/Creator figures out how to program an "Eat" subroutine when appetite drops below a
certain threshold, this "game" is fucked.
>> [_] Anonymous 06/09/15(Tue)20:50:31 No.2808155
Hunger continues to drain when tabbed, but they don't continue to dig
:l
>> [_] Anonymous 06/09/15(Tue)21:34:45 No.2808193
>>2808069
the fucking ants act so randomly it's not even fun to watch them. they'd rather starve to death
than move 1 square in the right direction to eat a meal.
shit idea
shit game
do something else with your time OP
>> [_] Anonymous 06/09/15(Tue)21:35:53 No.2808195
>>2808193
just like real ants.
>> [_] Anonymous 06/09/15(Tue)21:43:27 No.2808202
How do I make the ants have sex?
>> [_] Anonymous 06/09/15(Tue)21:45:25 No.2808204
How poor is your character? He can't feed two fucking ants holy shit.
>> [_] Anonymous 06/09/15(Tue)22:06:42 No.2808218
>>2808195
Actually, real ants are rather interesting, really. They all work as a highly coordinated team to
further their puny, futile existence. Their colonies can become massive with complex networks of
tunnels and chambers. Each colony has different types of ants. The most prominent are worker
ants. They're usually small, and can be seen traveling in a path with several of their fellow
workers. This path is a DNA trail left by a scout that found a food source, or other valuable
resources for the colony. Usually it's a food source. If you want a good example of this, leave
bread or sugar water outside. Soon you will see one of these trails of little black specs moving
back and forth like a two lane highway! Their are many more types of ants with interesting
duties, but I don't want to write for an hour.
>> [_] Anonymous 06/09/15(Tue)22:22:15 No.2808224
>>2808193
I didn't make it, lol. I'm developing other stuff.
Everyone is right though, the ants are retarded and don't really want to survive. Anyway, I'll
update my AI in a sec.
>> [_] Anonymous 06/09/15(Tue)22:23:22 No.2808226
>>2808069
Is there a new version of colorfull squares?