Planimeter / game-engine-2d

Planimeter Game Engine 2D - LÖVE-based game engine for Lua
https://github.com/Planimeter/game-engine-2d/wiki
MIT License
737 stars 74 forks source link

Pathing hogs system resources while it calculates. #11

Closed imthatgin closed 9 years ago

imthatgin commented 9 years ago

Just leaving this here briefly.

Could A* be a better alternative by any chance?

andrewmcwatters commented 9 years ago

Unless I'm somehow naively mistaken and the implementation is wrong, what the path interface uses is an A* algorithm.

Can you tell me how the interface hogs resources so I can try to optimize it?

imthatgin commented 9 years ago

I am unsure of exactly which point in the algorithm the issue may lie, but if I for instance run a server in debug, and a client in debug at once, and then initiate a pathfinding using rightclick via the client, the client tends to freeze for an extended period of time until the calculations are done, I believe.

andrewmcwatters commented 9 years ago

Okay, that shouldn't happen, thanks for the heads up. I'll make sure to look into this.

andrewmcwatters commented 9 years ago

If you're feeling brave, we have a very basic profiling interface that can be used to see what the issue might be, otherwise, I'll have this schedule for review. #9 is currently in priority.

imthatgin commented 9 years ago

Resource hog would appear to originate from cl_payload_show_receive being set to 1, as having it set to 0 does not have the same impact on the client.

imthatgin commented 9 years ago

(It's most likely due to the quick succession of the prints)

andrewmcwatters commented 9 years ago

Ah yes, this is definitely an issue with cl_payload_show_receive 1. Any print heavy ops are expensive just because of the incurred buffering in cmd as well as the in-game console. though I believe it should be defaulted off as of a few builds back.

andrewmcwatters commented 9 years ago

If you can confirm that, I'll mark this invalid if you'd like.

imthatgin commented 9 years ago

I can confirm. It's not a hog while the convar is set to 0.

andrewmcwatters commented 9 years ago

:+1: