GPS Style Map Routes

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I've come to another wall in my MMF project and I'm not even sure if there's a solution to this one as I wouldn't know where to begin.

    My game contains a map which the player can view. I'd like for the player to be able to click two points on the map and a path to be drawn between them. Ideally, I would like a way of measuring the length of this path also.

    Here is an example of what I'd like the player to achieve (red crosses mark points selected by the player):
    Please login to see this attachment.Please login to see this attachment.

    Unfortunately, I have to add that I'm unable to use third party extensions within my project.

    Any pointers in the right direction would be greatly appreciated. If this is incredibly complex to implement then I may decide to just take the feature out of my game.


    Thanks in advance!

  • Seems like a job for a pathfinding tool XD

    You can't use extensions - it means it needs to be exported,
    or it's anyway a "windows only" project?

    Just asking because there is a number of (extensionless) pathfinding solutions out there
    but some are not cross platform.

    a selection of my Fusion examples can be found Please login to see this link.

  • You can look up the A* Pathfinding algorithm and try to implement it with events, but you'll probably need to be a Fusion adept to pull it off :)

    Please login to see this link. (Indie games and Fusion resources)
    For freelance inquiries please email admin at ultimatewalrus.com

  • Just an idea...
    You need a grid system
    Find direction/angle
    divide directions into quadrants, so you can go left/right/up/down.
    put detectors in each intersection
    make a direction decision at the intersection
    make sure there are no dead ends

    I think I have seen something like that somewhere.

    Check out my game!
    Please login to see this link.

  • schrodinger: It's a graded project and we're generally told not to use extensions probably to avoid incompatibility and other issues that may arise when being graded. Tbh, I don't fully know why we can't use extensions, this is just what I've always assumed...

    UltimateWalrus: Yeah I'm not quite at that level I don't believe, and sadly I don't have that much time to spend on it :(

    amiman99: That was my initial thinking, I'm just not sure I have the time to implement all that; accounting for errors and bugs during implementation... I might give it a go today anyway and see what I come up with. At worst, I'll fake it and create manual paths between nodes or something along those lines.

  • I've decided to rework this feature for convenience. Now, the player clicks a point on the map and creates a pin, clicking another point on the map will create another pin with a line drawn between the two, and a third pin would continue the line and so on.

    I've found out how to draw a line between objects using an Active Object and the Clickteam Movement Controller using these events and expressions:

    Code
    + User clicks on Map
    
    
    - Create: Pin at mouse pointer
    - Create: Line at Pin
    - Line: Set angle to AngleObjects( "Clickteam Movement Controller", Fixed( "Pin" ), Fixed( "Pin" ) )
    - Line: Set X scale to DistObjects( "Clickteam Movement Controller", Fixed( "Pin" ), Fixed( "Pin" ) )

    My problem here is that I need to differentiate instances of pins. The first pin reference in each of the last two lines should refer to the previously placed pin, whilst the second reference should refer to the newly placed pin. I understand using spread values and loop index (foreach now?) allows you to cycle through instances but I'm not sure how to apply this into one expression.

  • Here's a very simple "draw line" example,
    you don't need additional objects:

    Please login to see this attachment.

    draw line clicking with left button,
    stop drawing clicking right button
    you can customize line thickness in "thickness" value
    and change color simply changing "dot" animation color

    Anyway, if you will need,
    pathfinding can be done, it's a bit less trivial
    but there are good user-created extensionless tools
    (beside the win-only pathfinding extension)
    that would allow for your first post request

    a selection of my Fusion examples can be found Please login to see this link.

  • I just realized I used the String Parser 2 object, which lets me break down strings into multiple sections. Even though this extension works for every exporter type, you said you couldn't use third party extensions. I think this is a third party extension, it's been so long since I've had it in my extension list. Try using Sketchy's pathfinding example. It uses all default extensions, arrays and lists mainly.

    -----

    Thanks for showing interest in my video, I was the person that made that A* custom pathfinding example. I haven't touched that code in years, so I might be a bit rusty in evaluating the code that I wrote. I followed an online A* pathfinding tutorial here: Please login to see this link., so I suggest you read up on it to understand how the pathfinding engine works. There might even be a few bugs, I really can't remember if it's flawless or not. However I tried testing it a few times and it seemed to work fine. Let me know what you think of it, I made this about four years ago :) Hopefully I'm a better clicker now.

    I'm trying to look over the file now to refresh my memory. There's an active called "pathfinding values" that holds a ton of variables for the engine to work. Things like node width & height, map width & height, G horizontal & vertical step (how much each step costs so you can make diagonal moves cost more or less than horizontal/vertical directional moves). The other values are changed in game and saved/stored by the engine. I guess if you wanted to make this work with your game you would change the node width & height and map width & height. Then you could toggle the Fusion frame grid on to match those dimensions to see how the grid is laid out on your frame. Then you place invisible barrier blocks around the buildings of your game to indicate to the engine that you can't walk through those walls. Or if you want to make it more compact, add multiple wall types to a qualifier and test against that qualifier.

    I'd also suggest Sketchy's pathfinding examples from The Daily Click. In my opinion his example is better than mine and more compact, so I would recommend checking his example out as well. He uses an array to load the obstacles beforehand then writes the cost values of moving to adjacent nodes and compares them to figure out the path. If you want to use his example, you would need to upload an array file that mimics your map file and where the obstacles are you would insert a high number (in his example walls = 99). Since the path takes the lowest path cost into account, it would try to look for empty 0 cost nodes for the path and ignore the walls. Interestingly enough he has secondary obstacles which are costed at 3 so they're slower than the regular path, but still viable as a route option. You could use that idea for slow moving terrain like mud or water. I attached both my example and his example with this post. Good luck!

    I tried creating a really confusing maze to test the engine and it seemed to work fine, haha. Let's hope there's no bugs. If anyone does find any bugs I would appreciate hearing about them.

    Please login to see this attachment.

  • schrodinger: I'm tinkering with it a little to suit my needs, but this is pretty much exactly what I was going for, thank you very much! :)

    Sumo: Thanks for sharing! Even if this doesn't get implemented into my final project, I'll certainly be having a look at it. AI and pathfinding is something I really need to brush up on and your video was pretty impressive. So yeah, your help is very much appreciated! :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!