A* path finding?

Blitz3D Forums/Blitz3D Beginners Area/A* path finding?

Guy Fawkes(Posted 2012) [#1]
Hi all, can someone point me to a 2D version of basically what these 2 commands do?



PointEntity myenemy, myplayer



Moveentity myentity, 0, 0, enemyspeed#



Also, if there's a collision, the enemy avoids walls, and anything with collision?



Does anyone have a simple example where it shows this happening for multiple enemies? There can even be an oval for a player, and square rects for enemies if that's easier. :) Then when the player stops, the enemy catches up.



Thanks! :)


Guy Fawkes(Posted 2012) [#2]
Better yet, can someone add multiple enemies to THIS example, and make them A* and make it so if the player gets away, they go back to their set waypoints, and then start roaming around again? :)







Thanks to all that help! :)


Guy Fawkes(Posted 2012) [#3]
I TRIED to add a shooting state, where if the distance of the player and the enemy is GREATER than the roaming distance + 3, or just > 23, then the enemy goes into shoot mode until the player is 35 units away from the enemy, then he goes back into random mode.



Here's the code:



**OUTDATED!**






EDIT: TRIED to make it go to a defined waypoint (Would be BETTER for each enemy, if it used the Data command), but so far shooting, and go back to waypoint aren't working for some reason. Can someone PLEASE help fix this?



**NEW!**







Also, can someone make it so the enemy can't go "inside" the player? the enemy stops moving, yet keeps attacking until the player gets away, or kills the enemy.



Thanks! :)

Last edited 2012


Guy Fawkes(Posted 2012) [#4]
Thanks guys, I really appreciate this! :)


LineOf7s(Posted 2012) [#5]
Better yet, can someone add multiple enemies to THIS example, and make them A* and make it so if the player gets away, they go back to their set waypoints, and then start roaming around again? :)

That has GOT to be parody. Surely. Tell me you're being funny.


Guy Fawkes(Posted 2012) [#6]
No, but I'm gonna ignore you, because you're not gonna get me banned again. NO SIR. NOT THIS time! :)


Drak(Posted 2012) [#7]
I'll offer two tidbits of advice:

1. Work on one problem at a time until you get it working right, then move on and add your next step. You seem to be having multiple compounded problems without ever fixing the first one. One at a time = simpler.

2. Use other people's code only for reference. Sure, there's nothing wrong with using code from the site, but you'll learn WAY more by retyping it yourself so you can see how everything works.

Now for your question, there are no commands like those for 2d.

Also, what you're asking is the EXACT same thing I coded for you about a year ago in Blitz3D. You'll find it in the B3D tutorials under moving NPC's with types. 2D is a totally different set of programming functions because you don't actually have entities as you do in 3D. You'd get better answers asking in perhaps the BlitzMax or BlitzPlus forums.

Last edited 2012


Ross C(Posted 2012) [#8]
Better yet, can someone add multiple enemies to THIS example, and make them A* and make it so if the player gets away, they go back to their set waypoints, and then start roaming around again? :)


Is a HUGE task. That's not help. Actually, you'd probably pay someone for that kind of thing, for it to work in the manner you need it.

It's pointless Drak. There is no stopping the Rez. The biggest problem you have Rez (thundros) is your taking peoples code and glueing them together. You don't understand how either piece works. In fact. Nevermind. I'm getting bored of typing the same thing over and over again.


(tu) ENAY(Posted 2012) [#9]

Thanks guys, I really appreciate this!



Who are you thanking? Up till this point, all the posts are yours...


Guy Fawkes(Posted 2012) [#10]
I've already ignored u, Ross. So just forget it. I have an almost WORKING A* system... It just needs a bit of help.







It just needs 3 fixes. A shoot mode, where the "enemy" shoots an oval at the enemy. Then the oval "bullet" shoots in a straight line. 3rd, the enemy should return to its waypoint if the player's distance is greater than 23, or the player died. after the enemy goes back to his waypoint, he waits a few random seconds, and then starts roaming around until the player comes within the distance of the enemy.



Thanks for whoever helps! :)


stayne(Posted 2012) [#11]
That is nowhere close to A* bud. You have no entity/wall/obstacle/etc. avoidance. That is very basic waypoint code.


Ross C(Posted 2012) [#12]

So just forget it



Forget what? Trying to get you banned? I'm not trying to do that. I'm pointing out the sheer volume of work you are wanting someone to help you with? That's nowhere near A* pathfinding. Do you know what A* pathfinding is? You don't understand you are asking someone to build part of a game for you here.

It doesn't need 3 fixes, it needs additionaly functionality built into it. As in, in actual A* pathfinding routine.


3rd, the enemy should return to its waypoint if the player's distance is greater than 23




Guy Fawkes(Posted 2012) [#13]
Notice how I'm not posting back to u. Yea. that's called IGNORING u! :)


Ross C(Posted 2012) [#14]
That's what I call a smart ass comment, minus the smart part :). You just acknowleded me, because you just directly replied to me.

Seriously though, you need to learn what A* pathfinding is, or at least find an example of it. What you posted isn't it.


GitTech(Posted 2012) [#15]
http://www.policyalmanac.org/games/aStarTutorial.htm


Ginger Tea(Posted 2012) [#16]
wayback when, I belive it was Casey who said he was fed up with people with a pathfinding system calling it A* as it was little to nowhere near A* in it's inner workings, most just heard the name and thought "Hey that's cool, I'll use that name." even if it was nothing like it.
Like calling your lemonade drink Coke a cola cos coke is a well known name for a soft drink (soda) even if Lemonade is nowt like Coke bar the fizz and sugar.

He advocated some change their name to A*'s in their eyes among other witty (imo) alternatives.

So with that in mind, is your system a real A* in the works (very early stages if that) or did you just pick the name cos it's a well known name for path finding?

Last edited 2012


Yasha(Posted 2012) [#17]
If I may have a crack at this...

At least part of the reason people don't like you is because of how blatantly dishonest these threads of yours are. Every damn time they start out with something simple like an explanation of some functions... oh wait, what you really meant was "a complex example of them in use". Oh wait, what you really meant was a complex example of integrating them with someone else's code ("here's what I have so far" invariably meaning "here's someone else's code with their name still attached"). Oh wait, what you really meant was an example of your specific complex gameplay mechanics that have little to do with the principle you asked about. And of course what you really meant is not an example but just integratable-in-no-steps final version code.

Acting like this is not subtle. We can see from the first post exactly where the thread is going to go. "Thanking" people for their "help" in "fixing" things (i.e. "This is all the credit you will ever get" for "doing a huge piece of work" to "make someone else's unrelated code fit in my project") is just as obvious. Stop. Frakking. Doing it. This is exactly the same behaviour that pissed off everyone else the first time around (so incidentally, your protests that you have changed are also pretty ridiculous, when you are behaving identically except for the addition of a bunch of lines about how you aren't).

Believe it or not, wanting other people to write your program for you is perfectly OK. You say this, and they offer terms, and then you compensate them for their work and get a program out of it.

And just one more thing, Columbo: This (or more accurately, this) is why nobody will offer you help any more, even with the genuinely easy parts. Because as soon as anyone says anything it's a sudden latch-on-and-don't-let-go of them or their code archive entry until they've done all your work for you.



Go away and decide please, whether you would like other people to do the coding or whether you would like to do it yourself. If you choose the latter, learn to code, then actually do some (in that order: you obviously don't learn a damn thing "by doing", so stop insisting that you do and just study properly). If you choose the former, be open about it and people will be happy to do business with you.


Rob the Great(Posted 2012) [#18]
@Yasha
I was wondering if anyone else was following that conversation in the archives. I have to admit, it turned into a crazy situation.


Ross C(Posted 2012) [#19]
I had the exact same experience.


(tu) ENAY(Posted 2012) [#20]
Whilst there is a distinct difference between game designer and game programmer, (some people aren't cut out to be games programmers)
If Thundros wants to throw money at the problem then I think even I might help. But random posts, clearly without any effort being made on his part is just a waste of his and everyone's time basically. That Rob the Great thread makes very interesting and also depressing reading.


How can I tell if the Chu chu is on his right side?



This sort of problem should be instantly solvable by even the weakest programmer.


Rabies(Posted 2012) [#21]
It's been years since I posted here.
Anyway, I think Thundros should buy Game Programming for Teens .
It's a great book. :) It's helped me out a bunch.