I'm workin' on a racing mod for UT and was wondering if anyone had any ideas on how to keep track of what place the player is in. I'm mostly just looking for concepts, but if anyone was able to post any pseudo/sample code, they would be my hero.
Announcement
Collapse
No announcement yet.
Race Placement
Collapse
X
-
I think Thanos was looking more at position in the race, 1st, 2nd etc. I'm also thinking about something similar but haven't found any suitable way to do it yet, lots of workman like ways to do it, but nothing elegant and reliable so far.
You could always d/load Unreal Speed, decompile it, and look how they do it. I've not started work on the project yet so have only been idly wondering how to solve this problem.
Hope that helps.
Comment
-
A more accurate way would be to measure their distance to the next checkpoint that no one has reached. Then you just place checkpoints at any major turns in the track. You'd still have to make sure they've reached all the checkpoints leading up to the target checkpoint to make sure someone doesn't get ranked higher due to course layout. If you are doing laps you'd have to make sure they've hit the checkpoints 'X' number of times as well to make sure they are on the lead lap.
Comment
-
That sounds like a pretty good idea. I'd imagine it could be done something like:
Code:int i(0); int distances[10]; foreach AllActors( class'Racer', tempRacer) { distances[i] = nextCheckPoint.Location- tempRacer.Location i++; } foreach AllActors( class'Racer', tempRacer2) { tempRacer2.place = SomeDistanceSortingandPlaceReturningFunction(); }
Comment
-
UnWheel does this by something similar to the above-mentioned solution - we measure each player's distance to the end of the lap they're on (from checkpoint-to-checkpoint all around the track), and how many laps they still need to complete, then assign places based on who has the shortest race distance remaining.
Comment
-
Maybe the following entry in my Dev Journal would interest you:
http://wiki.beyondunreal.com/wiki/El..._Journal#0.4.1
When I was working on UnrealKart I ofcourse also had to solve that problem. And the above writeup where my thoughts about the subject.
Note that my ideas are just one way to solve the issue.
Comment
Comment