Player Location
Player Location
Is there a way to get an accurate player location? I know I could divide the grid position by the arena's size, but then it needs to be hardcoded, unless you know of a way to get the REAL_ARENA_SIZE_FACTOR from within a script.
- AI-team
- Shutout Match Winner
- Posts: 1020
- Joined: Tue Jun 23, 2009 6:17 pm
- Location: Germany/Munich
- Contact:
Re: Player Location
http://www.crazy-tronners.com/wiki/inde ... ER_GRIDPOS
edit: nevermind, seems like this is ct+sty only
edit: nevermind, seems like this is ct+sty only
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
Re: Player Location
That's what I currently use, but it's not actually accurate for anything unless you divide it by the real arena size factor.AI-team wrote:http://www.crazy-tronners.com/wiki/inde ... ER_GRIDPOS
edit: nevermind, seems like this is ct+sty only
Re: Player Location
If you already have size_factor:
real_arena_size_factor = sqrt(2)^size_factor
Are you looking for this?
real_arena_size_factor = sqrt(2)^size_factor
Are you looking for this?
- AI-team
- Shutout Match Winner
- Posts: 1020
- Joined: Tue Jun 23, 2009 6:17 pm
- Location: Germany/Munich
- Contact:
Re: Player Location
Ah seems that I didn't read trough your post carefully enoughLight wrote:That's what I currently use, but it's not actually accurate for anything unless you divide it by the real arena size factor.
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
Re: Player Location
You can put a readout in the cockpit file, if you're on 0.3.0+.
http://wiki.armagetronad.org/index.php/Cockpit_Tutorial
http://wiki.armagetronad.org/index.php/Cockpit_Tutorial
current_pos_x | The position of the player in grid units, x- coordinate
current_pos_y | The position of the player in grid units, y- coordinate
- kyle
- Reverse Outside Corner Grinder
- Posts: 1876
- Joined: Thu Jun 08, 2006 3:33 pm
- Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
- Contact:
Re: Player Location
you want map based location, not the one based on real size factor? That is actually a todo of mine to update PLAYER_GRIDPOS based on map instead of arena, as SPAWN_ZONE now takes in map based points, allows scaling without changing the zones.
I'll try to move that up in my priority queue
I'll try to move that up in my priority queue
Re: Player Location
Would be cool, but not a huge deal. I was just curious if there was already a better way than hardcoding the arena size value and dividing to get the actual grid position.kyle wrote:you want map based location, not the one based on real size factor? That is actually a todo of mine to update PLAYER_GRIDPOS based on map instead of arena, as SPAWN_ZONE now takes in map based points, allows scaling without changing the zones.
I'll try to move that up in my priority queue
- kyle
- Reverse Outside Corner Grinder
- Posts: 1876
- Joined: Thu Jun 08, 2006 3:33 pm
- Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
- Contact:
Re: Player Location
what you get is the actual grid position, what you want is the grid position relitive to the map.
Re: Player Location
Code: Select all
$sizeMultiplier = '0.5f'; // map size multiplier
$size_factor = 0; // size factor of the map
// set sizeMultiplier (got straight off arma game code)
$sizeMultiplier = exponent($size_factor);
function exponent($i)
{
$abs = $i;
if ( $abs < 0 )
$abs = -$abs;
$ret = 1;
$fac = sqrt(2);
while ($abs > 0)
{
if ( 1 == ($abs & 1) )
$ret *= $fac;
$fac *= $fac;
$abs >>= 1;
}
if ($i < 0)
$ret = 1/$ret;
return $ret;
}
- delinquent
- Match Winner
- Posts: 760
- Joined: Sat Jul 07, 2012 3:07 am
Re: Player Location
I'm confused, isn't this just the same thing twice?Code: Select all
if ( 1 == ($abs & 1) ) $ret *= $fac; $fac *= $fac; $abs >>= 1;
- Jonathan
- A Brave Victim
- Posts: 3391
- Joined: Thu Feb 03, 2005 12:50 am
- Location: Not really lurking anymore
Re: Player Location
No, delinquent. Look again: different variables. It's exponentiation by squaring.
Oh, and pow(2,$x/2) will be just fine. If you want it to be bit-exact, you must emulate single-precision floating point as well.
Oh, and pow(2,$x/2) will be just fine. If you want it to be bit-exact, you must emulate single-precision floating point as well.
ˌɑrməˈɡɛˌtrɑn
Re: Player Location
That's what I use. See no real reason to do extra work.Jonathan wrote:pow(2,$x/2)
That still needs the hardcoded arena size though.