Search found 137 matches

by gcmartijn
Fri Dec 25, 2020 10:43 am
Forum: Support and Development
Topic: [Solved] jumper big maps want to optimise it using 'sectors'
Replies: 9
Views: 5020

Re: jumper big maps want to optimise it using 'sectors'

uuuh what do you mean with this ? -- after the for loop x2 = x2 - x1 + 1 y2 = y2 - y1 + 1 x1 = 1 y1 = 1 After for y = y1, y2 do end ? I don't use that variables anymore only the targetX/Y and currentX/Y the full code is this -- targetX -- targetY -- currentX -- currentY -- mapWidth = 4000 -- mapHeig...
by gcmartijn
Fri Dec 25, 2020 10:20 am
Forum: Support and Development
Topic: [Solved] jumper big maps want to optimise it using 'sectors'
Replies: 9
Views: 5020

Re: jumper big maps want to optimise it using 'sectors'

That gives me another error, the map is correct but the location is was not found [310, 437]. but the location is inside the given rect. local x1 = 75 local y1 = 400 local x2 = 590 local y2 = 720 local mapY, mapX = 1, 1 for y = y1, y2 do map[mapY] = {} for x = x1, x2 do -- if collision(x, y) then --...
by gcmartijn
Fri Dec 25, 2020 8:56 am
Forum: Support and Development
Topic: [Solved] jumper big maps want to optimise it using 'sectors'
Replies: 9
Views: 5020

[Solved] jumper big maps want to optimise it using 'sectors'

Hi I'm trying to optimise the pathfinding code because it is to slow now. Jumper needs only to search inside a x1,y1,x2,y2 rect. My first though was this. -- some variables -- targetX -- targetY -- currentX -- currentY -- mapWidth = 4000 -- mapHeight = 768 -- this is for example the 'window/rect' wh...
by gcmartijn
Wed Dec 02, 2020 4:30 pm
Forum: Support and Development
Topic: astar to slow to work with... doing it wrong I guess
Replies: 5
Views: 3846

Re: astar to slow to work with... doing it wrong I guess

I found one other astar script, maybe he know the answer because it is drawing lines very fast, only not correct...
So I asked the question there: https://github.com/xiejiangzhi/astar/issues/1
by gcmartijn
Tue Dec 01, 2020 7:39 pm
Forum: Support and Development
Topic: astar to slow to work with... doing it wrong I guess
Replies: 5
Views: 3846

Re: astar to slow to work with... doing it wrong I guess

I did give it a try, but it is too big and a little complicated (for me) to understand/merge with my own code. Maybe if everything was inside one class and I can add the map data into it, then it is more user friendly. I put this on hold for now. function Player:createMap(targetX, targetY) local wid...
by gcmartijn
Mon Nov 30, 2020 6:54 am
Forum: Support and Development
Topic: astar to slow to work with... doing it wrong I guess
Replies: 5
Views: 3846

Re: astar to slow to work with... doing it wrong I guess

It looks like you're giving Astar:find() the wrong value for the positionIsOpenFunc argument. It's supposed to be a function - not a table ('self' in this case). Unless you modified the library to correctly handle that? Impossible to tell if you don't share the code. That is a quick modification so...
by gcmartijn
Sun Nov 29, 2020 6:30 pm
Forum: Support and Development
Topic: astar to slow to work with... doing it wrong I guess
Replies: 5
Views: 3846

astar to slow to work with... doing it wrong I guess

Hi, After several weekends I give up, and need some advice for next weekend. I want that a player can walk around a rectangle if he is clicking above/below/right/left so the player would walk around it automaticly (if needed). I have several functions like willCollide(x,y) The world only have rectan...
by gcmartijn
Sun Nov 22, 2020 12:55 pm
Forum: Support and Development
Topic: How to know if a object is [top|bottom|left|right] using another object?
Replies: 5
Views: 3898

Re: How to know if a object is [top|bottom|left|right] using another object?

Thanks, I see now that this is not a ideal situation for a problem I try to solve. I will try to avoid this and re-thing about another solution. Maybe at some point I need to have the same function like https://2dengine.com/?p=intersections#Point_inside_rectangle so a point can have with multiple ou...
by gcmartijn
Sun Nov 22, 2020 11:29 am
Forum: Support and Development
Topic: How to know if a object is [top|bottom|left|right] using another object?
Replies: 5
Views: 3898

Re: How to know if a object is [top|bottom|left|right] using another object?

Good point, need to explain it better. BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB A output: left side BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB A output: left side You can say this maybe: draw virtual 2 horizontal lines and 2 vertical lines around the rect. And then check on which side the x,y point is. --|-----...
by gcmartijn
Sun Nov 22, 2020 9:56 am
Forum: Support and Development
Topic: How to know if a object is [top|bottom|left|right] using another object?
Replies: 5
Views: 3898

How to know if a object is [top|bottom|left|right] using another object?

H! I thought it was easy, and I guess I will figure it out but maybe someone already made this? function something(x,y, x1,y1, x2, y2) -- here I can simply check that x > then x1 and x2 -- here I can simply check that x < then x1 and x2 -- here I can simply check that y > then y1 and y2 -- here I ca...