I managed to find the bugs in the highscore pairing.


Last night I managed to find the bugs (there were 3) in the Placement/higscore code, it was located in the GameManager.cs, where I had used a bubblesort, which i unfortunately had implemented as a sort from lowest score to highest, at the time that made most sense. However, along the way I decided to cut some complexity short in the switchcase with fall through, where it would "break;" and thus stop the rest of the normal algorithms that frame and then go directly to the win condition statements. However, in doing so, I thought it smart to collect on the knowledge I had of who the winner is. Since I get this information as enums in a list related to a specific script instance or singleton, related to that player, I thus also inherited another issue! Then checking whos' score belongs to who, and I digress: I currently don't know what happens if two players have the same score, but it ought to be the player with the highest player number who "wins", although I'm uncertain about this, (I haven't actually checked that is). Though the reversed order meant some really hard to spot bugs, including getting the winners score to 0 some times(ofc. this was the lowest score), the last bug was in the pairing bit of the code where I mistakenly used the variable from my loop as index for the unsorted array, which the index was the order itself, which was correct, but I then also happened to use it on the sorted array, which was a mistake! You see the ordered array I know should be constant for each loop; I should only be checking for THAT ONE position every itteration, i.e. a constant. In the fix I made it so that expansion to 10 players, will still work without having to add  lot more code, and it can be done identically, and perhaps with some auto page flicking, but just to find the top 4, it requires a bit work not much.  Although it has some other issues somewhere else in the code, which I will I need to address, when that time comes. Furthermore I spend the time after understanding my own code and mistakes, to properly comment the GameManager.cs file, so it should be easy to pick up on later.

The current Alpha Build on the page does not have these fixes patches, an upcomming upload in the near future will address them :), the video doesn't show it work but its' fixed in that version.

Lastly I discovered another issue with 4 pickups having rigidbodies, which means they are falling through the map at the beginning of the game in the available Alpha version, so if they seem few in numbers on levels 2, 3 and 4 this is why :)


Files

GoldenGun Alpha.zip 66 MB
Aug 08, 2019

Get 6olden4un

Comments

Log in with itch.io to leave a comment.

As always you can follow the comments in the commits if you view the source code :) for more frequent updates.