God I wish I knew why this was happening..

Published September 11, 2020
Advertisement

The Good

So as we can see, quite a lot has improved. For one thing I've found that my Windows install didn't have enough virtual memory. Normally Windows is able to handle this dynamically, but in this case it was doing so poorly. I added a swap partition = 1.5x physical memory (~23 gb) and removed the 4gb it was using on C:\. This has made my machine almost feel like new. I also ordered a SATAIII m.2 SSD which should work with this ASUS RoG laptop. If it doesn't, I'm giving up on this SSD business until my next computer.

But onto Valkyrie itself. It is a quirk of Xamarin.Forms that the UI thread and anything directly interacting with the UI such as buttons and renders have to stay on the same thread. There are weird reasons for this I don't fully understand, however I've discovered that I can multithread the collision checks. When I did this, I saw an instant framerate improvement during motion.

Then I refined the algorithm itself. Using LINQ I now select only the obstacles in memory which are in the direction of travel, and sort them according to distance from the actor being evaluated.

Then I only have to check the nearest one in the direction of travel for collision-detection. I'm not sure what the time complexity of a LINQ query acting on a List<T> is, I suppose worst case scenario the time complexity of any list must be linear. There are Binary search functions for List<T>. But I think if I get collision checks moving right working and still see performance this good I'll leave the algorithm alone.

It's almost not fair how cool that worked out. As you can see the Android VM, which is described as usually quite slow and cranky is cranking out 42 fps. (I am throttling the gamespeed at 42ish so who knows it might even be able to do better).

The Bad

But it was not a total victory. I've still got this annoying bug where collision check works, but when I release the button Bob seems to accelerate again, and then decelerate as if there were no obstacle in the way. I'm not sure what's causing that to happen, my brain is a bit fried at the moment.

That'll do, Bob. That'll do.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement