Cralant: @Demon666: that is what I did with the first method but the points need to be less then .25m close to each other for the ssmaller items to register and on large items this makes hundreds of checks per item which causes a ton of lag.

Demon666: @Cralant: what i would to is i would plot points across the line and make the points vary very close to eachother and of any of tose points are within a box then the box lights up.

zardOz2: @Cralant: every once in awhile I try to figure out a non5ile method with bbox and angles... it reamins to complex for me to see the solution

Cralant: Yeah I needed to find all the tiles that a line segment intersects, If uses a pretty crude method that only worked for certain orientations and angles:

this:draw_line(left.x,left.y,right.x,right.y,.05)
if left.x < right.x then
if left.y < right.y then
lx, ly = left.x, left.y
rx, ry = right.x, right.y
else
lx, ly = left.x, right.y
rx, ry = right.x, left.y
end
else
if left.y < right.y then
lx, ly = right.x, left.y
rx, ry = left.x, right.y
else
lx, ly = right.x, right.y
rx, ry = left.x, left.y
end
end

for j = lx, rx, 1/100 do
k = ly + ((ry-ly)*((j-lx)/(rx-lx)))
walls[math.ceil(j)][math.ceil(k)] = true
end

Basically the left and right tables have x and y values in them that are the beginning and end of the line. I just need to work out what the line intersects and make whatever it intersects the value: walls[x][y] = true. You can see my way was just basically following the line in 1cm segments and checking what tile it was in, this is incredibly inefficient and doesn't work in certain orientations and angles. If you get something working then thank you so much.

Demon666: @Cralant: also you asked for my and Z's help with some algoritam for drawing lines over tiles a while ago. i dont remember what it was but i might have some solutions for it now if you can remember what it was you asked me lol.

Demon666: @Cralant: yeah but this is going to be a smart way point drone not a labyrinth solving drone lol. im not sure how to make check for dead ends either my solution is if it cant find a gap in then it will keep moving alongside the obstacles untill it does find a way out. eventually it will choose gaps based on which one it closer to the way point its set for.

Cralant: Great job d6, this is originally what I had in mind when making my auto solving hovercraft but couldn't work out the behavior for what happens if it reaches a corner or a dead end should it back up on itself. Really love the visuals though, hopefully you will have something working way before I work out how to optimize the detection process.

sdac: and as always - the more impressive entry, the less the "rules" matter

sdac: @Demon666: interaction is of course allowed as long as the vehicle has some way of handling/detecting/avoiding the obstacles automatically

Demon666: @sdac: i got a question about the contest tho... is the vehicle supposed to cross the obstacle course with out any user interaction at all? or is minimal user interaction allowed?

Demon666: @zardOz: i can very easily set to 360 as it is right now. as it is the angle will count up to 0.5 for 180 but i can just set it to 1 for 360. there's just no reason to.

sdac: @Demon666: cool, sounds like something for the obstacle contest :)

Demon666: @zardOz: i can but i don't plan to.... my idea is for the craft to only detect objects infront of it and then move through the gaps and of there's no gaps then it will move around the group of objects until it finds a gap.....

zardOz2: interesting, you planning on 360 version?

## Discuss this level

this:draw_line(left.x,left.y,right.x,right.y,.05)

if left.x < right.x then

if left.y < right.y then

lx, ly = left.x, left.y

rx, ry = right.x, right.y

else

lx, ly = left.x, right.y

rx, ry = right.x, left.y

end

else

if left.y < right.y then

lx, ly = right.x, left.y

rx, ry = left.x, right.y

else

lx, ly = right.x, right.y

rx, ry = left.x, left.y

end

end

for j = lx, rx, 1/100 do

k = ly + ((ry-ly)*((j-lx)/(rx-lx)))

walls[math.ceil(j)][math.ceil(k)] = true

end

Basically the left and right tables have x and y values in them that are the beginning and end of the line. I just need to work out what the line intersects and make whatever it intersects the value: walls[x][y] = true. You can see my way was just basically following the line in 1cm segments and checking what tile it was in, this is incredibly inefficient and doesn't work in certain orientations and angles. If you get something working then thank you so much.