Check the position into a race

Discussions about Coding and Scripting
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Check the position into a race

Post by PrinceOfFunky »

Few days ago I started the Race gametype and I put all essential stuff, except with events like when someone dies and when position changes.
I was wondering, do you know a way to set positions in a Race game?
"Your stuff is known to be buggy and unfinished/not properly tested"
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Check the position into a race

Post by JackGriffin »

SetPostion. :P

Elaborate more, I don't think that answers you really.
So long, and thanks for all the fish
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Check the position into a race

Post by PrinceOfFunky »

JackGriffin wrote:SetPostion. :P

Elaborate more, I don't think that answers you really.
XD, that's the name of a function maybe but, I wanted to know if you knew how to check which position is the player in :/
"Your stuff is known to be buggy and unfinished/not properly tested"
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Check the position into a race

Post by JackGriffin »

Do you mean position as in first, second, etc or absolute position as in X,Y,Z?
So long, and thanks for all the fish
User avatar
EvilGrins
Godlike
Posts: 9698
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA
Contact:

Re: Check the position into a race

Post by EvilGrins »

If you die you should have to go all the way back to the starting line... especially as if the race involves a vehicle pickup then the racers probably can only get that WAY BACK there.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Check the position into a race

Post by PrinceOfFunky »

JackGriffin wrote:Do you mean position as in first, second, etc or absolute position as in X,Y,Z?
No lol, any actor has the "Location" variable.
I meant, the position like first, second, etc...
EvilGrins wrote:If you die you should have to go all the way back to the starting line... especially as if the race involves a vehicle pickup then the racers probably can only get that WAY BACK there.
Already did it on the worst case, on the lucky case it will be respawned to the last checkpoint, that are set every 3 or whatever seconds.
But anyway, this doesn't answer my question .o.
"Your stuff is known to be buggy and unfinished/not properly tested"
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Check the position into a race

Post by JackGriffin »

It's hard to do since you'll need to account for maps and such. I see two ways to do it, one easy but not good and one hard but very good.

1- Just use the lap times. First is obviously the first person to lap. They retain that position until the next lap and the positions are re-ordered.

2- Subdivide the track into sections (A, B, C, D for example) and add checkpoints. Use those to compute position.
So long, and thanks for all the fish
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Check the position into a race

Post by PrinceOfFunky »

JackGriffin wrote:It's hard to do since you'll need to account for maps and such. I see two ways to do it, one easy but not good and one hard but very good.

1- Just use the lap times. First is obviously the first person to lap. They retain that position until the next lap and the positions are re-ordered.

2- Subdivide the track into sections (A, B, C, D for example) and add checkpoints. Use those to compute position.
Already tought about both options, but no any of them can be working.

1- What happens if someone gets over someone else after they both lapped?

2- What happens if more than one players are between 2 sections?

:/ I think I will avoid to use positions.
"Your stuff is known to be buggy and unfinished/not properly tested"
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Check the position into a race

Post by JackGriffin »

You can't really avoid the scenarios. In a larger sense if you have a race between any two things the only way to determine who is the winner is either make them both relative to a place (a finish line for instance) or relative to each other (who gets to point 'A' first). If you have a race with laps then you will need to treat the circuit as a whole and count laps relative to an external clock timer or further divide the circuit into smaller segments but still make them relative to that external clock.
So long, and thanks for all the fish
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Check the position into a race

Post by PrinceOfFunky »

JackGriffin wrote:You can't really avoid the scenarios. In a larger sense if you have a race between any two things the only way to determine who is the winner is either make them both relative to a place (a finish line for instance) or relative to each other (who gets to point 'A' first). If you have a race with laps then you will need to treat the circuit as a whole and count laps relative to an external clock timer or further divide the circuit into smaller segments but still make them relative to that external clock.
Can't do it, because I want the race system to work with zones, and mappers cannot make too many zones just to let racers know their position :/
"Your stuff is known to be buggy and unfinished/not properly tested"
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Check the position into a race

Post by JackGriffin »

How will you track a winner then? Just curious.
So long, and thanks for all the fish
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Check the position into a race

Post by PrinceOfFunky »

JackGriffin wrote:How will you track a winner then? Just curious.
The Lap is a Zone and any zone calls "ZoneChanged()" function on actors and the computer is procedural, so only one racer can lap at time. The first one that will lap "maxLaps" times, will win.
"Your stuff is known to be buggy and unfinished/not properly tested"
ShaiHulud
Adept
Posts: 459
Joined: Sat Dec 22, 2012 6:37 am

Re: Check the position into a race

Post by ShaiHulud »

Again, knowing nothing about the subject could bot paths be utilised somehow? Do they have "waypoints" along the course of the path that you could use as checkpoints or proximity markers?
User avatar
papercoffee
Godlike
Posts: 10447
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: Check the position into a race

Post by papercoffee »

PrinceOfFunky wrote:
JackGriffin wrote:How will you track a winner then? Just curious.
The Lap is a Zone and any zone calls "ZoneChanged()" function on actors and the computer is procedural, so only one racer can lap at time. The first one that will lap "maxLaps" times, will win.
You explained somewhere that this single zone is necessary to check if one racer is leaving the track ...but what about to reverse this mechanic? make the outside of the track a zone witch detect if some racer is entering it. That way could you use the inside of the track for the checkpoint zones.
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Check the position into a race

Post by PrinceOfFunky »

ShaiHulud wrote:Again, knowing nothing about the subject could bot paths be utilised somehow? Do they have "waypoints" along the course of the path that you could use as checkpoints or proximity markers?
papercoffee wrote:
PrinceOfFunky wrote:
JackGriffin wrote:How will you track a winner then? Just curious.
The Lap is a Zone and any zone calls "ZoneChanged()" function on actors and the computer is procedural, so only one racer can lap at time. The first one that will lap "maxLaps" times, will win.
You explained somewhere that this single zone is necessary to check if one racer is leaving the track ...but what about to reverse this mechanic? make the outside of the track a zone witch detect if some racer is entering it. That way could you use the inside of the track for the checkpoint zones.
Men, I'll just write down a post with the beta.
"Your stuff is known to be buggy and unfinished/not properly tested"
Post Reply