fgenesis / tinypile

Assorted small one-or-two-file libs. C/C++. Public domain. Cross-platform. No deps.
The Unlicense
85 stars 14 forks source link

Skip parameter #2

Open szamq opened 5 years ago

szamq commented 5 years ago

Hi, I'm excited to see that you created JPS v2 which is even faster than previous version. Actually I used the skip argument as my grid is very dense. Would like to have it back. Let me know if that's possibile.

fgenesis commented 5 years ago

Actually, before i go back to actually re-implement this, do you have any numbers? Because i never had any maps that really warranted using skip, so this wasn't well tested and never actually benchmarked, iirc. So i guessed it's fair to cut this, less source of problems and confusion, etc etc.

So in case you have a map that you could share that shows perf benefits in action, or even just some numbers with skip==1 and skip>1, that would be super helpful. (ok to use the older JPS for checking this).

Alternatively, how big is your map? As you've been using skip you're probably aware of the problems it could cause; if all of your walls are thick enough to work with skip>1 without problems, maybe your map is too high-res and could do with less resolution?

szamq commented 5 years ago

I was doing benchmark once. From my head, the time was divided by skip number, so: skip= 0 time of execution ~ X skip = 10 time of execution ~ X/10 So it worked nicely. I have grid which is 8192x8192, you can think of it as bitmap terrain like in worms but top down. So I don't mind really when enemy player sometimes squeezes through one or two pixel wide line. I'm using skip = 5 which gives me 5 times performance boost and it behaves almost the same. 2-3 pixel wide walls are very rare in my case. Old vid of the map https://gfycat.com/welcomelimitedflatfish