Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / CreateVector3 incredibly CPU and memory intensive for pathfinding function.. tips?

Author
Message
Golelorn
8
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 22nd Jul 2017 13:01 Edited at: 22nd Jul 2017 15:11
I am attempting to create a pathfinding function using createvector3. I have seen videos of this done with Unity, and it does not run near as slow for them.

I was trying to store this wrldPt = CreateVector3( spx#+(x*nde_dia#+nde_rad#), 0, spz#+(z*nde_dia#+nde_rad#) ) in an array 40,000 times for a 100X100 grid(2 nodes per x,z). Even on my laptop it took over 3 minutes to store everything, and the memory on my game shot up to 90MB from 35MB.

I then tried to run it real time in a 20X20 grid. Brought my computer to its knees trying to process that every frame, so that is not an option.

I decided to try and store the x, z, and walk status in separate arrays, which seems incredibly inefficient. It took 17 seconds to fill 3 arrays 40,000 times, whereas it took 3 minutes for createvector3 to fill 1 multidemisional array 40,000 times. Plus createvector3 used 30 more MB.

I am now thinking of scrapping this and coming up with another solution. My main problem is my doors are kinda small, and I know its going to be a pain to try to walk through them on a mobile phone. Heck, its already annoying even on a big screen.

Has anyone tried to use a grid based movement system? I was attempting A*, but I don't see how its worth the extra memory size. Even without createvector3 the memory shot way up.

Really a moot point, because it took 30 seconds on my phone to fill a 125*125 area with 2 nodes per coordinate. Not the best phone, but also not junk.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Jul 2017 13:29 Edited at: 22nd Jul 2017 13:31
i have some code from blitz max. it create a gradient from a to b. its similar water flow from up to down.
" Var" means by reference in agk it is ref
left & right mouse button set a or b, middle mouse set obstacles.
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)

Attachments

Login to view attachments
Golelorn
8
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 22nd Jul 2017 13:38
Thank you, Markus. I will play with this.
Golelorn
8
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 22nd Jul 2017 19:31
Aha, I found it was not the fault of createvector it was the physics check to see if I was hitting anything. I will have to approach it differently. Once I took that out it took milliseconds to complete the loops.

Login to post a reply

Server time is: 2024-11-24 11:41:33
Your offset time is: 2024-11-24 11:41:33