LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

High score ranking system

Solved!
Go to solution

Hi all,

I am currently working on a project in LabVIEW, we are developing a game and the project needs us to create a top ten high-score ranking system for the game. The questions I want to ask are:

1. How do I program such that when a new high score is achieved, it will replace an existing high score correctly (out of the top ten values) For example, if the highscores in the top ten are 10 to 1, a player plays the game and achieved a score of 7.5, the '7.5' will be saved into the top ten and '1' will be eliminated from the top ten 

2. Is there a way to show this 'high score system' on NI Dashboard?

0 Kudos
Message 1 of 12
(5,675 Views)

Hi Sonata,

 

1. You should use an array of cluster of [score, name]. Append a new score/name cluster to your array, then sort the array: it will be sorted by the first element of your cluster, which is the score. Reverse the array, keep the first 10 elements of the array…

2. Never work with Dashboard, someone else might help…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 12
(5,673 Views)

 Hi GerdW,

Appreciate your reply! Attached is my vi and I left the cluster/array outside of the loop. Is what I am doing the correct way? If not, how do I modify it?

 

With thanks,

Sonata

0 Kudos
Message 3 of 12
(5,664 Views)

Hi Sonata,

 

there is no cluster in your VI. There is no array of cluster in your array. Right now you don't do anything similar to what I suggested…

 

Do you really need ExpressVIs for simple "greater or equal" comparisons? Really?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 12
(5,640 Views)
Solution
Accepted by topic author Sonataaaaaaa

  N Represents the Maximum Counts to display.

MOC_SortingScore.png

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Message 5 of 12
(5,623 Views)

Hi GerdW,

Thanks for the guidance! I have tried running the vi you have provided and it's working alright, however, if I were to implement this highscore system to a game and receive the score from the game, which part should I modify?

 

With thanks,

Sonata

0 Kudos
Message 6 of 12
(5,561 Views)

Hi Palanive,

Thanks for your reply! I have realised that your controls & indicators have square brackets inside. As i'm still kind of new to LabVIEW I can only manage to create the normal control & indicator, would you kindly explain how do I create the control and indicator similar to yours?

 

With thanks,

Sonata

0 Kudos
Message 7 of 12
(5,556 Views)

Hi Sonata,

 

if you even don't know the difference between "normal" and "bracketed" controls you REALLY should take the free beginner courses offered by NI on their website!

 

-  Palanive gave you a snippet - you can drag&drop it into your blockdiagram (BD) to get the code…

-  "bracketed" controls indicate arrays - the same applies to the wires connected to them!

- you should have noticed this in my VI example too - you need to look more carefully at example we give you!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 12
(5,553 Views)

Hi GerdW,

Appreciate your reply, did not know the snippet could be dragged, thanks for the heads up!

Have tried working around with the programs you guys have provided and managed to get the hang of it. However, I could not open the file Palanive have gave because the version of my LabVIEW is older, hope you dont mind me asking questions.

 

With thanks,

Sonata

 

0 Kudos
Message 9 of 12
(5,545 Views)

Hi GerdW,

According to your program that you gave me, it was based on random numbers generated, if I were to replace the random number function to the score that I have achieved in a game, I would just have to bundle the score that I got together with the name, is that right?

 

With thanks,

Sonata

0 Kudos
Message 10 of 12
(5,532 Views)