Raised This Month: $32 Target: $400
 8% 

Get map size (width and length) and player positions


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-04-2022 , 15:43   Re: Get map size (width and length) and player positions
Reply With Quote #11

If players are showing up in the wrong spot on your overview in-game, maybe the overview for that map is not configured correctl? Are you testing with one of the default maps?

I've seen some custom maps that have some sort of glitch in them causing the overview to not show properly on the screen but that is only one or two specific Day of Defeat map that I play.

It would be quite hard for BSPViewer to give the wrong coordinates since it's such a simple concept, IMO. I actually wrote a plugin that allows me to point with my gun and get the coordinates of the location my crosshair is pointing at and I've actually used that to create entities on the map where I needed them.

@deprale, the origin is not always at the center of the map so you can't just assume that.
__________________
fysiks is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 12-04-2022 , 19:44   Re: Get map size (width and length) and player positions
Reply With Quote #12

Quote:
Originally Posted by fysiks View Post

@deprale, the origin is not always at the center of the map so you can't just assume that.
Yes we can't just assume that but we can pretend it is, or at least I think so I'm not an expert regarding this, but if I had to approach this problem myself then I'd do it that way (pretend that 0,0,0 is the origin)

Another way we can tackle this problem is taking the 2 farthest corners and subtract them, to get the middle of the map this way we don't have to guess 0,0,0 is the origin of the map!
And then we can just do middle_of_the_map - player_origin to get the actual player position without relying on closest corners method.
__________________

Last edited by deprale; 12-04-2022 at 19:45.
deprale is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-04-2022 , 20:36   Re: Get map size (width and length) and player positions
Reply With Quote #13

Quote:
Originally Posted by deprale View Post
Yes we can't just assume that but we can pretend it is, or at least I think so I'm not an expert regarding this, but if I had to approach this problem myself then I'd do it that way (pretend that 0,0,0 is the origin)

Another way we can tackle this problem is taking the 2 farthest corners and subtract them, to get the middle of the map this way we don't have to guess 0,0,0 is the origin of the map!
And then we can just do middle_of_the_map - player_origin to get the actual player position without relying on closest corners method.
(0,0,0) is the definition of "origin". However, if you just arbitrarily assign it to the middle of the map, it will not match the values you get from a plugin. You must use the same coordinate system as the map if you want anything thing to work out.

So, no, you cannot "pretend" that the origin is anywhere other than the actual origin of the BSP file if you're using coordinates from a plugin that will only return values based o n the origin of the BSP. This is why there exists a configuration file for overviews, so that it can align properly with the map.

If you want to create another coordinate system for some strange reason, you would still need to translate between the actual coordinate system and the "pretend" coordinate system. To do this, you have to know the origin of the original coordinate system (the BSP).
__________________
fysiks is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 12-04-2022 , 22:38   Re: Get map size (width and length) and player positions
Reply With Quote #14

Thanks for your insight, appreciate it.
__________________
deprale is offline
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 12-11-2022 , 23:59   Re: Get map size (width and length) and player positions
Reply With Quote #15

OP, if you're still trying to do it:
https://forums.alliedmods.net/showthread.php?t=210029

I knew I had seen something like this done before, but I just couldn't remember where.
__________________
deprale is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-12-2022 , 12:42   Re: Get map size (width and length) and player positions
Reply With Quote #16

Make in mind for images the origin 0 0 0 means the TOP Left of the screen while 0 0 0 means the middle of the map.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 12-12-2022 at 12:42.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-12-2022 , 21:51   Re: Get map size (width and length) and player positions
Reply With Quote #17

Quote:
Originally Posted by Natsheh View Post
Make in mind for images the origin 0 0 0 means the TOP Left of the screen while 0 0 0 means the middle of the map.
If you're referring to the map coordinates and it's origin, you can't say that <0,0,0> is the middle of the map 1) because it's not always near the middle and 2) it's nearly impossible to define the "middle of the map" in a practical way.
__________________
fysiks is offline
ghostdlr
Senior Member
Join Date: Aug 2010
Old 12-13-2022 , 11:45   Re: Get map size (width and length) and player positions
Reply With Quote #18

Quote:
Originally Posted by deprale View Post
OP, if you're still trying to do it:
https://forums.alliedmods.net/showthread.php?t=210029

I knew I had seen something like this done before, but I just couldn't remember where.
The amx file is 613 kb and the source code is only 4kb. How can it be possible? Can it include some malicious code?


Also, it's not working
ghostdlr is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-13-2022 , 21:17   Re: Get map size (width and length) and player positions
Reply With Quote #19

Quote:
Originally Posted by ghostdlr View Post
The amx file is 613 kb and the source code is only 4kb. How can it be possible? Can it include some malicious code?


Also, it's not working
That's what happens when the compilation fails so you're not getting a valid plugin. This plugin won't compile with the default compiler because it requires custom includes and must be compiled locally with the proper include files.
__________________
fysiks is offline
ghostdlr
Senior Member
Join Date: Aug 2010
Old 12-14-2022 , 04:16   Re: Get map size (width and length) and player positions
Reply With Quote #20

I downloaded the plugin from this post, that was already compiled:
https://forums.alliedmods.net/showthread.php?t=210029

Also, it said plugin failed to load (when I type amx_plugins) and hlds.exe was using 400mb ram after. Usually it uses around 75mb.

It seemed kinda weird.

I'm gonna write my own code though. It's good to know you can get accurate positions of the players relative to the map overview.

Last edited by ghostdlr; 12-14-2022 at 04:18.
ghostdlr is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:59.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode