Greedy Walker

Time for the next installment of “Hosler’s Wacky Walkers” Hellz yeah!

I would like you all to meet the “Greedy Walker”:
[php]
// The walker
if (created||playerenters) {
// Initialize the attributes
showcharacter;
setcharprop #3,head0.png;
setcharprop #C0,orange;
setcharprop #C1,white;
setcharprop #C2,blue;
setcharprop #C3,red;
setcharprop #C4,black;
setcharprop #2,shield1.gif;
shieldpower = 1;
dir = 1;
setcharani walk,;
this.xoffset=1.5;
this.yoffset=2;
this.tile = 1760;
this.speed = .5;
this.weight = 0;
this.bestweight = 0;
this.moving = 0;
timeout = .05;
}
if (timeout) {
if (this.bestweight > 0) {
x=x+vecx(dir)*this.speed;
y=y+vecy(dir)*this.speed;
this.bestweight-=this.speed;
}
else {
this.x = x+this.xoffset;
this.y = y+this.yoffset;
this.bestweight = 1000;
this.reverse = (dir+2)%4;
this.bestdir = this.reverse;
for (this.i=0;this.i<4;this.i++) {
this.weight = 0;
this.ntile = tiles[this.x+vecx(this.i),this.y+vecy(this.i)];
this.ldir = (this.i+1)%4;
this.rdir = (this.i+3)%4;
this.ltile = 0;
this.rtile = 0;
while (this.ntile == this.tile && this.rtile!=this.tile && this.ltile!=this.tile) {
this.weight++;
this.ntile = tiles[this.x+vecx(this.i)*this.weight,this.y+vecy(this.i)*this.weight];
this.rtile = tiles[vecx(this.rdir)+this.x+vecx(this.i)*this.weight,vecy(this.rdir)+this.y+vecy(this.i)*this.weight];
this.ltile = tiles[vecx(this.ldir)+this.x+vecx(this.i)*this.weight,vecy(this.ldir)+this.y+vecy(this.i)*this.weight];
}
if (this.i == this.reverse) {
this.lastresortweight = this.weight;
this.lastresortdir = this.i;
}
if (this.weight<this.bestweight && this.weight!=0 && this.i!=this.reverse) {

    this.bestweight = this.weight;
    this.bestdir = this.i;
  }
}
if (this.bestweight == 1000)
  {
  this.bestweight = this.lastresortweight;
  this.bestdir = this.lastresortdir;
}
  dir = this.bestdir;

setcharprop #c,[#v(this.bestweight)] [#v(this.bestdir)];
}
timeout = .05;
}
[/php]

I named this guy Fatty McFatfuck. Fatty is on a mission to find more cupcakes, and since he is in a hurry to stuff his fat face, Fatty will always choose the shortest path he sees at any given intersection. Fatty is also retarded. He can’t remember where he has been and never realizes that there are no fucking cupcakes. However, he does know to not go backwards unless he absolutely has to.
Gawd fatty ur so fat. It’s OK. I made a track that will allow him to walk forever. That should slim him up.

The level attached shows Fatty’s adventure.

I like this little miniseries. Fatty is a loveable character. I’ll be sure to buy the blurays when the anime comes out.

What about a Walker that goes from point A to B?

i never learned how to properly use gs1 arrays. so i dunno. seems silly, but gs1 is fucked.

VW set me straight on arrays. this is gonna get crazy.

Th…this cannot be! This is too early… the prophecy foretold this same event would happen, but that was for in 2 years! We could be dealing with a monster here.

Just kidding.

this.coords = {x1,y1,x2,y2};
this.coords[index]

this.coords = {0,1,2,3,…,n};
this.coords[index]

wow thanks spoon

It’s interesting to see he follows a path. As for something that goes from a to b, tricxta already made something doing it. I hacked it to make a path generator.

Well I kinda wanted to give hosler more ideas to play with if he was planning to continue. I dunno what tric really does (sry tric), so I didn’t know about that before you said it.

What I do: I’m a software engineer, I just code stuff

What I made in respect to what 2ndwolf is talking about: I implemented the A star path finding algorithm a while back

Also… in respect to arrays, I prefer string lists over arrays as you get everything arrays offer plus a bunch of methods for support and because they’re strings you can do really hackish things to address them which is fantastic given there’s a limit to a script’s size for it to work online.

is software engineer your daily job/study subject?
If so, I always wonder: What’s the part of a software engineer in a project?

Is the script size for individual scripts or total scriptsize for the entire level? If it’s individual just use multiple scripts seeing as level strings cover the entire level anyway.

I’m keeping the tiled path so I don’t have to search the entire board. Should make it fast too. Gonna use dijkras since that’s the only one I can remember off the top of my head.

Level size doesn’t appear to be capped, so only script-size per npc. Also sure, I’ve done similar things where I’ve used a npc-weapon as a database purely for lengthy strings and then another npc-weapon calls it to retrieve and process them. Having to rely on such things often leads to alot of bugs though as you have to account for latency and what not.

I’m set to graduate at the end of this year, however software engineers usually take care of planning architectures as well as implementation from what I’ve seen in my work experience. However, I suppose it could all be varied.

waste of a good brain

Beholder is a waste of a good brain.

I’ve always wondered what he does for a living
just a curiosity thing. It’s not like I’m stalking anyone on here or anything!!! :nervous:

Someone initiate the beholder summoning ritual because I’m curious too

Pretty sure he’s full time employed as a NEET