Code request?
Displaying 1-8 of 8 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
BlueStar

Hmm... I was wondering if anyone would take a function request . I'd like to use it, and I'm sure there are others that would too, so it would obviously be public domain. But it would really be useful and I don't know how to do it at all.


Here's the gist:

void MoveToEntity(int mover, int movee, int tolerance)

Basically it'll move the mover to the movee, while taking into consideration if the mover obeys obstruction. If so, tolerance comes into play. look at this chart:

.
---------
o


the o is the mover. the . is the movee. the ---'s are a wall. If I call MoveToEntity(o, i, 0); the entity will probably stop because he can't reach the movee since there's a wall blocking him. But if I set the tolerance to 8, he might go right or left to move around the wall.

Basically, I miss the old V1 entitychase. If anyone remembers it, it was just as I described. Although, with V3, I'm not sure if there would have to be a sidekick-function to go in a HookRetrace, so that it constantly checks for entities that are being MovedToEntity.

Please reply! :)

Posted on 2004-10-25 17:56:31

basil

There are enough pathfinding scripts floating around that this seems quite feasible...easy in fact should you find somebody to coax into it.

Posted on 2004-10-25 19:24:00

blues_zodiakos

It's not what you want, exactly, but it's a place to start.

http://www.verge-rpg.com/files/detail.php?id=425

Posted on 2004-10-25 20:29:46

Sungam

I have some interest in a function like this, myself... I figured that A* was what was required, but I'm still a little uncertain as to exactly how to do it (I guess I could figure it out if I tested a bit, maybe, but rather waste others' time than my own, right? ;) )...
Specifically, wouldn't there be a huge speed hit from calling a pathfinding algorithm over and over? Assuming that the one being followed was moving around unpredictably (the player, for instance), I assume you'd have to recalculate the path almost constantly, so as to avoid having the follower run around in the same pattern as the followed walked (which would appear somewhat dumb). But looking at the time it takes for that algorith to run even once (entirely acceptable in many cases, of course), it seems it'd be overkill if done more than once per second - and while my computer isn't exactly a Tiny God, it's far from the slowest in the community.

My purpose: Having enemies on the map stalk the player within a certain range, ala practically any RPG that doesn't have random encounters.

Posted on 2004-10-25 21:09:39

Feyr

Yeah, it'd be fairly trivial to have it only call the pathfinding algorithm every second or more. In fact, I wrote an event scheduler to do just that sort of thing. Combine that with the A* algorithm and you're more than halfway there already. Unfortunately my free time is at negative levels right now, so I don't really have time to write and debug it. =(

Posted on 2004-10-25 22:32:51

mcgrue

What's the license on the Eventscheduler, btw?

Posted on 2004-10-26 03:56:05

BlueStar

license to POOP ... ooooo

Posted on 2004-10-26 06:37:37

Feyr

What's the license on the Eventscheduler, btw?
I was actually thinking about that earlier today in connection with ClassBuilder, since it represented a fair amount of effort. I briefly considered the LGPL, but ended up deciding on the 'don't be a jerk' license, which is a bit less restrictive, and anyone who's likely to obey the licensing requirements for a free piece of software would follow it automatically anyway. Mostly it consists of not claiming to have written the source code if you happen to redistribute it.

As for the event scheduler, I don't really care. I didn't spend more than an afternoon writing it, and any other halfway decent programmer could've done the same without too much trouble. So I'll just call it 'public domain' and leave it at that. Anyone can feel free to use it for whatever. Credit is always appreciated, but not required.

Posted on 2004-10-26 09:07:23


Displaying 1-8 of 8 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.