Search found 50 matches

by gcmartijn
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: 2566

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...
by gcmartijn
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: 2566

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...
by gcmartijn
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: 2566

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...
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: 2566

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: 2566

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: 2566

[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: 2361

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: 2361

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: 2361

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: 2361

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