.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
v.absmin and v.absmax
Old
  (#1)
BAStumm
Member
 
BAStumm's Avatar
 
Status: Offline
Posts: 138
Join Date: Jan 2004
Location: Spokane, WA USA
Default v.absmin and v.absmax - 13-01-2004

So PM you and I had this convo on botmans forum:

Quote:
--------------------------------------------------
03/27/03 at 20:06:59 Reply by: PM (pm@racc-ai.com)
--------------------------------------------------
Normal, I'd say.
The BSP slicer aligns its slices taking the whole map bounding box as a reference. Thus, the center of the bitmap
will always correspond to the center of the map. But not to the center of the world !
Many maps are not centred around (0,0,0) actually.
--------------------------------------------------
03/27/03 at 21:03:35 Reply by: BAStumm (bs@bs-linux.com)
--------------------------------------------------
right so how might I attempt to guess at where the center is or what kind of offset to use or whatever. Must be a way, valve uses
an overlay (bmp file) in game for that one overview spectator mode.
--------------------------------------------------
03/27/03 at 21:47:09 Reply by: PM (pm@racc-ai.com)
--------------------------------------------------
Of course, all you have to do is to substract the coordinates of the center of the map's bounding box to the coordinates of your player.
The map (worldspawn) is model #0 in the BSP data, and entity #0 in the game.
v_relative_coords = v_absolute_coords - (INDEXENT (0)->v.absmin + INDEXENT (0)->v.absmax) / 2;
you get the idea...
But I am getting -1 for INDEXENT(0)->v.absmin.x and +1 for v.absmax.x and same for the Y versions of these values... Any ideas?







Last edited by BAStumm; 13-01-2004 at 03:32..
  
Reply With Quote
Re: v.absmin and v.absmax
Old
  (#2)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: v.absmin and v.absmax - 13-01-2004

I was wrong in this discussion, worldspawn is not bindable as an entity. You can't do INDEXENT (0), it will give you an invalid edict pointer.

In order to know the map's bounding box, you have to read the BSP file and extract it yourself. It's simple :
Code:
   // load the bsp file and get its actual size (can't fail to do this, the map already booted)
   sprintf (bsp_file_path, "maps/%s.bsp", STRING (gpGlobals->mapname)); // build BSP file path
   mfile = (char *) LOAD_FILE_FOR_ME (bsp_file_path, &bsp_file_size); // load bsp file
 
   // read the MODELS lump of the BSP file
   memcpy (bsp_file.dmodels, mfile + ((dheader_t *) mfile)->lumps[LUMP_MODELS].fileofs, ((dheader_t *) mfile)->lumps[LUMP_MODELS].filelen);

   FREE_FILE (mfile); // everything is loaded, free the BSP file
 
   // get access to the world's bounding box
   v_worldmins = bsp_file.dmodels[0].mins;
   v_worldmaxs = bsp_file.dmodels[0].maxs;
Look in the racc.h file of my bot source code for the right #define's and struct stuff.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: v.absmin and v.absmax
Old
  (#3)
BAStumm
Member
 
BAStumm's Avatar
 
Status: Offline
Posts: 138
Join Date: Jan 2004
Location: Spokane, WA USA
Default Re: v.absmin and v.absmax - 13-01-2004

thanks!






  
Reply With Quote
Re: v.absmin and v.absmax
Old
  (#4)
BAStumm
Member
 
BAStumm's Avatar
 
Status: Offline
Posts: 138
Join Date: Jan 2004
Location: Spokane, WA USA
Default Re: v.absmin and v.absmax - 13-01-2004

Looks correct to me.

From your code in my mm plugin
Code:
[root@Dragon root]# hlcmd -g dod -e 27016 watch |grep ABSMIN
** ABSMIN-X: -1152.000000 ABSMAX-X:2000.000000 **
** ABSMIN-Y: -2432.000000 ABSMAX-Y:2752.000000 **
From overviews/dod_avalanche.txt

Code:
 
// overview description file for dod_avalanche.bsp
global
{
		ZOOM	1.58
		ORIGIN 424	 160	 -609
		ROTATED 0
}
layer
{
		IMAGE "overviews/dod_avalanche.bmp"
		HEIGHT -609
}
Math seems right to me...

Still need to use this new data to pre-offset the output coords but it fixes a big problem I've had with the code for my hlwebtv and phpua projects.

oh and I had messaged you once about this PM, but in the end I finally broke down and forced myself to figure out metamod coding. It was a lot easier than I thought. My botman code dropped right in after I figured out the sudtle differences and what not.







Last edited by BAStumm; 13-01-2004 at 07:25..
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com