Race Ranking

Get help using Construct 2

Post » Mon Sep 24, 2012 1:32 am

Hello,

I'm figuring out how is the best way to sort a Race ranking, but my code is huge and is not working properly, shuffling the results.

Do you can share your knowledge about it, if possible, with a simple CAPX?

The way I did it was, each checkpoint add a Score to the AI and Player. The player and AI can't miss any single checkpoint, if so, he will be teleported to the missing checkpoint to make sure the most accurate score.

So, the bigger score will be sorted to be the first place and them ahead. the problem is when 2 competitors have the same score, them, the second place show empty =\

I can't figure out how to implement a best way to achieve it =<

If you care to make a CAPX, please, try to deal with the challenge of 3 single squares running in line, earning points over the time and sorting their ranking.

Thank you in advance.
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,213
Reputation: 18,484

Post » Mon Sep 24, 2012 5:08 am

I'm on my phone so I can't check right now, but can't you use a For Each Ordered and sort them by their points variable? Add in a check to see if the current object's var is the same as the previous to handle that issue, and if they are, give them the same ranking.

The bigger issue I see is how to use the points set-up when the path isn't straight...
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Mon Sep 24, 2012 12:08 pm

Hi @SullyTheStrange, I'm stuck with it, because the treatment of same ranking issue.

Later I'll do a simple CAPX to make easy for Us study the code of this issue.

Thank you.
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,213
Reputation: 18,484

Post » Mon Sep 24, 2012 11:45 pm

Maybe @Ashley, @R0j0, Kyatric, or some of the Amazing programmers here can help with this issue, I'm not programmer, just a curious =(

Rules, use only events, no plugins please.

Here is the CAPX: https://dl.dropbox.com/u/47035927/Samples/ranking/ranking.capx

Here is the sample: https://dl.dropbox.com/u/47035927/Samples/ranking/index.html

Array sorting system (by @Yann): http://www.scirra.com/forum/forum_posts.asp?TID=49771&PID=313345&title=sorting-an-array#313345

The deal here is treat when two cars have the same score, how you deal with it? Who is the winner? Who have the best rank position? Who touched the line first! Right? but if they touch in the same tick. Oh my, headache =\

I think it was not a good idea, but how you can know what car is in the first position if you're not able to check pixel by pixel their track? I think using checkpoints was a good idea, but it's becoming a nightmare.TELLES08082012-09-25 02:40:19
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,213
Reputation: 18,484

Post » Tue Sep 25, 2012 6:22 am

Sully's solution will work, but give the score a bias so that the first car to pass the first checkpoint will have a score of 1.5, the second 1.4 and so forth. No two cars can now have the same score. Discard the decimal portion of the score every time you hit a checkpoint as it's only to indicate the order the checkpoint was hit. The formula looks like this:
set score to int(self.Score)+1+0.1*(5-Checkpoint.hit_count)

It shouldn't matter if two cars hit the finish line in the same tick, the winner will be whichever car is processed first and I don't think a player will even notice.

http://dl.dropbox.com/u/5426011/examples14/checkpoint.capx
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Wed Sep 26, 2012 10:23 pm

Amazing R0J0,

Thank you very much!
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,213
Reputation: 18,484


Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, Unconnected and 29 guests