farflamex's Recent Forum Activity

  • I already seem to have dyslexia when it comes to C3 arrays. I have no problem with them in other languages, but they just seem painful in C3. Anyway, I typed in my values into the array editor, made an array of the exact same dimensions and loaded them in with Ajax, i.e 'Load from JSON string, AJAX.LastData'. I don't know why, but the x and y seem mixed up. I'm sure that's not true as somebody would have noticed and fixed it by now. But here are the images of my array in the editor and then in the debugger.

    I assume I'm just misunderstanding something about the way they're displayed. It just gives me a headache because I have to follow it through, line by line trying to work out whether it's checking columns or rows....

  • Thanks, it was an error(s) on my part I think. Basically I ripped it up and tried again and it's fine now, so at least I was understanding the pathfinding correctly. Must've made one or more mistakes elsewhere.

    Just in case it's of some use to anybody (not very likely because this was very vague), I had two mazes and I was trying to get the sprites to work out which maze they were traversing by first of all checking which maze they were overlapping. But I 'think' that C3 doesn't count overlapping as being inside the coordinates of the object, rather than actually colliding with it. And since the 'empty' squares of the maze had collisions off and the sprites were standing on empty squares, I don't think it registers as overlapping.

  • My pathfinding is working correctly at first but after a few moves, it stops working. I have 4 sprites pathfinding their way around a little maze (a tilemap). Two of them never move and the other two move a few times and then stop forever.

    Checking in the debugger, of the two that have moved, one has 'Has Path' set to true, but isn't moving anyway. All of the others don't have a path. I'm not changing the tilemap at all, so it's not a case of obstacles changing. There are no other objects that might be blocking the paths and they have custom obstacles set (just the tilemap maze). They're moving with 'Move To' once the path is found, so that they move PacMan style (i.e along the grid).

    They're all the same sprite with the same settings (i.e the cell size is set to 20 for all of them and the tilemap is 32x32 blocks). They're not blocking each other since they're not set as obstacles.

    What else could be causing them not to move?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Woot, move-to works perfectly. I didn't need to tell it to move from tile to tile, just told it to move along the path and it goes along the squares rather than around the edges :)

  • I know this has been discussed a lot, but I haven't seen a full explanation.

    I've set up pathfinding in my tilemap maze and it can find it's way from a to b. Problem is, it clips the corners, virtually passing through some of the walls. I've tried every combination of cell size and cell border and it either doesn't move at all, or it moves and clips the corners.

    I've seen people point out that that's all the pathfinding is really meant to do, i.e find the path. But is there a way to get to precisely follow the contours and never clip the walls? Say I have 32x32 cells, the 'player' is a 32x32 square and the walls are exactly 32x32 walls .... so the corridors are only 32x32 wide..... is it possible for the pathfinding to find it's way pixel-perfect down those corridors?

    Alternatively, would I need to do a custom pathfinder? I have an array set to the exact same shape as the tilemap already, so maybe pathfinding through the array would work?

  • Got this working in the end. Definitely needs a copy of the values to use during the loop and the rest was just fiddling around with C3 arrays, which are super-fiddling imo :)

    soccerstar.org.uk/c3test/index.html

  • Thanks. I think the full equations are unnecessarily complex for my needs. I think my method has two main issues, firstly, I need to take a snapshot of the grid before any calculations and use those values, as suggested. Secondly, averaging out the squares is probably why it eventually locks up, because outer squares pass values back inwards as those inner squares start to empty out. So I think it ends up in a kind of equilibrium. So it probably needs to be weighted somehow so that the source doesn't empty to the level of the destination, so that it should keep 'flowing' in that direction. I'll play around with it, thanks for the ideas.

  • I don't think that's the issue with the edge squares, because with C3, if there is nothing on a condition, it just skips the condition. So my code first counts any squares which have a lower amount than 'this' square, then averages them out. That works the same on an edge square.

    But yes, it does look like it requires some kind of entire-map calculation and my method probably isn't going to work, even if I 'correct' it. I'll take a look at the ideas you suggested and some pre-existing code. Thanks.

  • I'm trying to simulate fluid / gas mechanics in an array. The centre of the array has a large value, topped up to max constantly and I want it to spread out from that point.

    My first attempt was to run through the array and on each square, test the 4 neighbouring squares to see if they're lower. If they are, the final value of the square + lower neighbours is averaged out, so e.g If this square has 1000 fluid, one neighbouring square has zero (others are higher so ignored), then this square and the lower neighbour now have 500 each.

    This sort of works and does have the advantage that the values 'flow' through the array and around objects. But it also has 2 problems.

    Firstly, if I just run through the array with a foreach, it goes top-to-bottom/left-to-right and there's an obvious bias in certain directions.

    Secondly, and more fatally, some of the outside edges never receive anything, even if I use standard values with lots of decimal places. They don't even receive a tiny fraction. So somewhere along the way, the math obviously balances out and the flow is no longer pushing 'forwards'.

    One solution that I can think of in my head is to even out every square that's connected, all at the same time. Problem is, working out which squares are connected would probably require some sort of searching algorithm and I don't know how that would work. Plus that would lose the 'flow' feel, which I like.

    Any ideas?

  • Excellent, had a chat with my host and they installed SSL on my site and it all works fine now, thanks for your help :)

  • Thanks, that's that part sorted.

    I'm getting an error because it's not https, so I need to sort that. I don't like the idea of securing my entire domain because I do lots of other stuff there and I don't wanna mess other stuff up. I'll have to read about it, pretty sure I have the option for free anyway though.

  • Doing some simple AJAX test stuff. It's just getting an error back and I think it's due to this access control issue. I remember this from aaaaaaages ago but I can't remember how to implement it.

    For now, I just have a one-line PHP file which just echo's 'Test' back. Where would I put the 'Access-Control-Allow-Origin: * ' in my PHP file?

farflamex's avatar

farflamex

Member since 7 Oct, 2012

Twitter
farflamex has 15 followers

Trophy Case

  • 12-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies