## Search found 51 matches

Fri Dec 25, 2020 6:14 pm
Forum: Support and Development
Topic: [Solved] jumper big maps want to optimise it using 'sectors'
Replies: 9
Views: 2653

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

Solved local function collision(x, y) .... end map = {} -- create a 'window' where to search 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 map[mapY][mapX] = 1 else map[mapY][mapX] = ...
Fri Dec 25, 2020 12:32 pm
Forum: Support and Development
Topic: [Solved] jumper big maps want to optimise it using 'sectors'
Replies: 9
Views: 2653

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

Oke working code, but not the final code, because I have to figure out how to do the math to convert the xy data I create 3 tables... Thanks for your help, I will mention it in the credits list :) map = {} -- create a 'window' where to search local x1 = 75 local y1 = 400 local x2 = 590 local y2 = 72...
Fri Dec 25, 2020 12:10 pm
Forum: Support and Development
Topic: [Solved] jumper big maps want to optimise it using 'sectors'
Replies: 9
Views: 2653

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

I think I understand it almost... Experimenting with this. local currentXn, currentYn local targetXn, targetYn local mapY, mapX = 1, 1 for y = y1, y2 do map[mapY] = {} if currentY == y then currentYn = mapY end if targetY == y then targetYn = mapY end for x = x1, x2 do if currentX == x then currentX...
Fri Dec 25, 2020 11:44 am
Forum: Support and Development
Topic: [Solved] jumper big maps want to optimise it using 'sectors'
Replies: 9
Views: 2653

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

Sorry I don't understand how... I saw something with a camera class that converts local to world coordinates and world to local. I guess you I have to change after the for loop those 4 coordinate but what is the formula to do that ? currentX = currentX - x2 currentY = currentY - y2 targetX = targetX...
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: 2653

### 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...
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: 2653

### 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 --...
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: 2653

### [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...
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: 2415

### 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
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: 2415

### 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...
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: 2415

### 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...