Ethan's Recent Forum Activity

  • R0J0hound, thanks i'll take a look.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi, they seem to be working fine for me. Any one else having problems?

  • I originally posted this in my projects devlog but since i need help i decided to post it here as well in the hope it gets more views.

    I coded a A * pathfinding engine in construct.

    <img src="https://dl.dropboxusercontent.com/u/159885981/myApath/myApathTest1.png" border="0">

    The only problem is that its slow at the moment. I hope some one can have a look at the source and suggest how i could speed it up.

    Heres the Demo. It will start working as soon as it loads. Give it a few seconds to find the path.

    And here is the Source.

  • These are great. Really takes me back to my childhood.

  • Okay so i had no luck with the inbuilt pathfinding. The cost seems to based on distance so if you're only moving a few squares it will always cut through a high costing square, even if the surrounding squares have a lower cost. The distance may be longer going around the but the total combined cost of the journey would be less.

    Therefore i wen ahead and coded my own A*pathfinding engine in construct.

    <img src="https://dl.dropboxusercontent.com/u/159885981/myApath/myApathTest1.png" border="0">

    The only problem is that its quite slow at the moment. I hope some one can have a look at the source and suggest how i could speed it up.

    Heres the Demo. It will start working as soon as it loads. Give it a few seconds to find the path.

    And here is the Source.

  • Thanks Manley.

    Unfortunately i have no way around the bug. It's a 3rd party object and i don't think 00Rez updates.

    The only other option is to recode the game with the official inbuilt pathfinding behaviour. I've had a play around with it today and have it working on a grid but i can't understand how it handles costing. For it to have any effect i have to set it to a value of around 100 or else it just seems to ignore it completely, which presents a problem at the moment.

  • The bug is more serious then i thought. I did a number of tests and my code checks out ok.

    It seems to be a problem with Astar Pathfinder which i'm using thats ignoring cell costs on occasions.

    Heres an example.

    <img src="https://dl.dropboxusercontent.com/u/159885981/AWtest3/awtest3Bug2.png" border="0" />

    The path above is correct. The tank unit has a cost of 100 for moving over woods and mountains. It only has a cost on 1 for moving over grass and hills. There for it has picked the quickest route available.

    <img src="https://dl.dropboxusercontent.com/u/159885981/AWtest3/awtest3Bug1.png" border="0" />

    Yet the square below has generated a false path. I checked the cost of squares from aStar pathfinding expressions so i know they are indeed a cost of 100, yet for some reason it has chosen a route with a total cost of 104.

    I'm afraid with this bug i might not be able to continue.

  • Nice work. Really enjoyed it.

  • Oops, just noticed a bug where the arrow path sometimes ignores the terrain costs. I'll look at that.

  • Added the ability to choose a path and view the route before you ok it.

    <img src="https://dl.dropboxusercontent.com/u/159885981/AWtest3/awtest3Animation.gif" border="0">

    Test 3 here.

    It was a little bit more tricky than i first thought because i have to manually work out the angles and also insert the corner sprite images based on the angle of the current point in the path and the last point in the path.

    Next up moving the unit.

  • Wow this looks great. Any chance we can see a video?

  • Thanks for the replies guys.

    Heres a quick updated test 2.

    <img src="https://dl.dropboxusercontent.com/u/159885981/AWtest2/awtest2Animation.gif" border="0">

    Each unit now has a cost to fire.

    The yellow path area shows where the unit can move to but can't fire.

    The green path shows the area where the unit can move and still fire. So you can move further but sacrifice the ability to attack or move less and attack.

    Also Each unit now has 1 terrain type where they will get an attack and defence bonus whilst on that square. This for the moment is represented by the circle. For example soldiers can hide in woods for a defence bonus or attack in woods where theres cover. Tanks get an attack and defence bonus on hills.

Ethan's avatar

Ethan

Member since 20 Jun, 2007

None one is following Ethan yet!

Trophy Case

  • Coach One of your tutorials has over 1,000 readers

Progress

17/44
How to earn trophies