Gamestudio Links
Zorro Links
Newest Posts
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (7th_zorro, Aku_Aku, henrybane, flink, 1 invisible), 739 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 5 1 2 3 4 5
Re: Tip of the Week #10: New Pathfinding Solution! [Re: WretchedSid] #435413
01/07/14 19:05
01/07/14 19:05
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Originally Posted By: JustSid
Originally Posted By: Rackscha
3) I am a Softwaredeveloper, and to avoid later complications, my boss likes to know before i publish something in my sparetime.

Your boss has NO say whatsoever over your free time and what you do with it, unless it involves selling company secrets to the competition.


That's not true. At least in Germany the boss can claim that, related to employee laws.

Re: Tip of the Week #10: New Pathfinding Solution! [Re: oliver2s] #435421
01/07/14 22:20
01/07/14 22:20
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
THEN MOVE TO ANOTHER COUNTRY, QUICK!


3333333333
Re: Tip of the Week #10: New Pathfinding Solution! [Re: Quad] #435572
01/09/14 09:49
01/09/14 09:49
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Updated the code, fixed some (partly major) bugs. Entities now leave regions much smoother and more natural, too. Just keep the region borders close to the outer path nodes.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Tip of the Week #10: New Pathfinding Solution! [Re: Superku] #435575
01/09/14 10:14
01/09/14 10:14
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hey Superku,

thanks for this contribution. It's great that still some people share their knowledge and code with the community though they're working on their own projects. Unfortunately I wasn't able to share some code for a while :-(

About 2 years ago I struggled with a code I wasn't able to solve the problem due to lack of time. As it was related to pathfinding I thought it might fit to this thread and could be resolved and build in with united forces:

In our Meteor Mess project we use WED paths and a A-star algorithm for moving the characters through the mansion. By clicking left on the screen we search for the nearest node and calculate the path from the current node to the target node. The issue we have is that we have to set quite a lot of nodes (and maintain them) to achieve a smooth movement.
Therefore I thought it might be good to have a code that makes it possible to let the player walk to a point between two nodes (still on the path, but not exactly to the calculated target node). This point would be the nearest point to the click point on the given path instead to the nearest node.
Some of the problems I ran into was that this point might be behind or before the nearest node and to exactly calculate this point (some vector math).
So sometimes the player has to just stop somewhat earlier and sometimes he has to move some further on.

Re: Tip of the Week #10: New Pathfinding Solution! [Re: pegamode] #435578
01/09/14 10:25
01/09/14 10:25
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Hm I'm not sure if I got your problem correctly. Have you tested my (preferably new) code? Does it have the same problem(s)?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Tip of the Week #10: New Pathfinding Solution! [Re: Superku] #435580
01/09/14 10:47
01/09/14 10:47
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Yes, I just tried.

The problem is that I want to tie the moving character onto the path. In your version the player first walks to the first node, then follows the calculated path and then walks to the clicked point by leaving the path.

Take a look at this picture:



The blue dot is the clicked point and the red dot is the target I want the player to move to as it's on the path between node 3 and 2.

Re: Tip of the Week #10: New Pathfinding Solution! [Re: pegamode] #435583
01/09/14 11:44
01/09/14 11:44
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I see. Find the/ some closest nodes (A,B) to the target which are connected via an edge. Then calculate the projection of node A to pos on the vector A->B. This is now your target position.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Tip of the Week #10: New Pathfinding Solution! [Re: Superku] #435585
01/09/14 11:52
01/09/14 11:52
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
Where can i find that updated code? The one in the Wiki is still the same.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: Tip of the Week #10: New Pathfinding Solution! [Re: Superku] #435587
01/09/14 11:55
01/09/14 11:55
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Yes, exactly. With that technique and a character tied to the path one can get rid of many, many nodes. Especially for adventure games this would be great to have.

Re: Tip of the Week #10: New Pathfinding Solution! [Re: pegamode] #435592
01/09/14 13:13
01/09/14 13:13
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline OP
Senior Expert
Superku  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
@alibaba: It is the new code on the wiki, I've just replaced the old zip file on my webspace with the new one. I forgot to link it here, though: http://www.superku.de/HPF.zip

@pegamode: Once you find the correct nodes the rest should not be difficult. I've posted such a vector projection some time ago on the forum or have a look at my one region function which calculates the projection onto the region bounding box.

EDIT: Btw. you can use my/ your pathfinding code for this and simply ignore the last node. When the entity reaches the second last node, calculate said projection, "abort" the regular pathfinding and move the entity to the newly calculated target.

Last edited by Superku; 01/09/14 13:47.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Page 2 of 5 1 2 3 4 5

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1