How do I generate procedural path?

Get help using Construct 2

Post » Thu Jul 24, 2014 7:55 pm

Hello,

I'm experimenting with procedural generation, but can't figure out how to generate just one path, square grid based, from point A to point B, not straight, but with some turns and such, but also without any sideways, but can't figure out how i could get it done. Any suggestions folks?

Cheers
M
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Post » Fri Jul 25, 2014 3:16 am

A common way to do this is to create a 'walker' object, which will step forward once every loop, and will have a set of rules dictating when it's allowed to turn 90 degrees. These rules will depend on your implementation.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,699

Post » Fri Jul 25, 2014 9:39 am

sqiddster wrote:A common way to do this is to create a 'walker' object, which will step forward once every loop, and will have a set of rules dictating when it's allowed to turn 90 degrees. These rules will depend on your implementation.


Hey, yeah, Iv'e got that far XD Those rules are the problem, not sure how to build them in some nice way.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Post » Fri Jul 25, 2014 1:10 pm

megatronx wrote:
sqiddster wrote:A common way to do this is to create a 'walker' object, which will step forward once every loop, and will have a set of rules dictating when it's allowed to turn 90 degrees. These rules will depend on your implementation.


Hey, yeah, Iv'e got that far XD Those rules are the problem, not sure how to build them in some nice way.


You could try using the built-in pathfinding behaviour (or the Astar pathfinding plugin) and use the nodes from that to navigate paths around obstacles, then build corridors or whatever along that route. Take a look at this linear pathfinding example I posted a while ago, you might be able to fiddle with it to generate routes.

https://dl.dropboxusercontent.com/u/106 ... nding.capx
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Fri Jul 25, 2014 1:57 pm

lolpaca wrote:
megatronx wrote:
sqiddster wrote:A common way to do this is to create a 'walker' object, which will step forward once every loop, and will have a set of rules dictating when it's allowed to turn 90 degrees. These rules will depend on your implementation.


Hey, yeah, Iv'e got that far XD Those rules are the problem, not sure how to build them in some nice way.


You could try using the built-in pathfinding behaviour (or the Astar pathfinding plugin) and use the nodes from that to navigate paths around obstacles, then build corridors or whatever along that route. Take a look at this linear pathfinding example I posted a while ago, you might be able to fiddle with it to generate routes.

https://dl.dropboxusercontent.com/u/106 ... nding.capx



Cool stuff man :) Thanks. It's getting closer. Togenerate obstacles but making also sure that there always will be path, will just write a condition to not spawn any other obstacles within a grid range from current obstacle.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Post » Fri Jul 25, 2014 2:13 pm

No worries. My game uses procedural generation too (check devlog link in my sig :D) It's frustrating at times, but incredibly rewarding when you get it working right. Give me a shout if there's anything else I can help with!
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Fri Jul 25, 2014 2:54 pm

lolpaca wrote:No worries. My game uses procedural generation too (check devlog link in my sig :D) It's frustrating at times, but incredibly rewarding when you get it working right. Give me a shout if there's anything else I can help with!


Sweet man, will surely do. thanks a lot :)
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests