Excal's Recent Forum Activity

  • makotto, here you go: BoardGame.capx

  • TELLES0808, I think a big WHOOSH just happened.

    My first post explains how I cannot use the distance function to do this.

  • Here's the .capx if anyone has the time to take a look. The .capx as a whole is pretty complex, but the relevant part is shown in the screenshot above and most of the events are commented.

    BoardGame.capx

  • If you have your tiles saved in an array, you could work with that, identify adjacent tiles, add them to another array and check those adjacent tiles for objects.

    the other array could look like this:

    each x -> one tile

    y=0: x coordinate in tile-array

    y=1: y coordinate in tile-array

    y=2: status (0 = searched for object, 1 = searched for adjacent tiles)

    okay let's say you are at a junction at 5,5. You run your function.

    The function will return

    (4,5), (6,5), (5,4), (5,6). It didn't find an object, so it will look further. For each x in the array where at(curx,2) = 0 -> run the function again.

    The function should only add coordinates if they are not already in your array (to prevent from going back, searching fields twice). After every adjacent tile was checked for (4,5), its y2 is set to 1.

    The search/loops are stopped once an object was found or no new adjacent tile was added to the array. After that the array is cleaned up (set size to 1,1,1 I guess).

    This makes sense. I'm using a recursive function to do this, but I think I've created an endless loop, because the preview tends to crash.

    <img src="http://i.imgur.com/z31L2q1.png" border="0" />

    The values in the BoardSpaces array contain the UID of the grid tiles. It's -1 if it doesn't exist.

    <img src="http://i.imgur.com/rjuv2OV.png" border="0" />

    My goal is to have the function recursively loop through the squares until it finds a player object, in which case ComputerTarget is set to that UID and the function should stop running. However, in my testing I get an endless loop and the program crashes.

  • Can you elaborate a bit more on how I would use nodes?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is more of a general question.

    Suppose I have a grid with walls. I have several objects within the grid. What's the best way to find which object is closest to another object based on path and not distance? I can't use the distance function because the closest object (based on actual distance) may not be the closest object due to walls, and another object may actually be 'closer' based on path.

    Does anyone know of how I might accomplish this?

  • Bump. This is the problem I've been struggling with for a month or so now.

    The link above should be updated with the latest version.

    The pathfinding grid shows up whenever a pathfinding object appears, but the problem of diagonal pathfinding (even when diagonals are turned off) still appears.

    I'm starting to think I need a mathematical way to determine paths without using the pathfinding object. If anyone has the time to take a look at this somewhat complicated matter, that would be great.

  • You might be interested in my thread here then.

  • retrodude

    Thanks for the compliments on the game development so far. The AI is really the last portion I need done before it's in a playable demo state.

    I would be interested in working with you once you are free again. I have a gist of what I want for the AI already implemented - it's just a matter of working out small issues with it to make it work as intended. I am willing to spend up to $500 for this work, but for that rate I would want not just a fixing of the current AI implementation but also an implementation of combat (which is also partially implemented already).

  • The AI is semi-working, and I suppose I should clarify a bit for those who haven't been following the project.

    Here's what I want the AI to do:

    1. Find the closest player object that can be reached. I used pathfinding to determine this because the closest player object is not necessarily the closest one that can be reached due to holes in the grid that prevent movement.

    2. Move towards the closest player object that can be reached, and then deal damage.

    I've been using the pathfinding object for this. Right now I have a pathfinding object move from the computer object to the closest player object that can be moved to, and each grid tile the pathfinding object moves through gets 'tagged'. After the pathfinding object reaches the closest player object that can be pathed to, I highlight the grid of possible tiles the computer object can move, then create a second pathfinding object that starts from the furthest grid tile that is both tagged by the first pathfinding object and highlighted by the movement grid, and this object moves to the computer program and builds a list of squares for the computer object to move.

    Kind of complicated, but it's commented in the .capx. The main issue I'm having is skips in movement along with the pathfinding object moving diagonally even though I have diagonals turned off (not sure why this is happening).

  • Bump.

  • Darklinki, it's for my board game.

    I've tried to implement an AI system that utilizes the pathfinding behavior, but it's not quite working for me.

Excal's avatar

Excal

Member since 9 Mar, 2013

Twitter
Excal has 1 followers

Connect with Excal

Trophy Case

  • 11-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

13/44
How to earn trophies