![]() |
![]() ![]() |
![]() |
Swoop |
![]()
Post
#1
|
![]() Newbie ![]() Group: Members Posts: 9 Joined: 22-March 06 From: Colorado Member No.: 702 ![]() |
Hi.
I had two questions about waypointing. 1. I have taken the commandmenu.txt file from Sven Coop and have added some functions for quickly adding waypoints, entering into "edit mode (authenticate, godmode, noclip, waypoints on...), etc, and was wondering how I either send a command to choose the menu items from the waypoint_menu OR actually send the command to perform the same function. For example, in command_menu.txt, I have a whole section on adding flasg to existing waypoints. I tried to say "waypoint_menu; 2; 1" and the waypoint menu fails to catch the keystroke to add a JUMP flag. What's the best way to do this? Is there a function I could replace all of that with, such as "addflag wl_jump"? 2. Second Question: I think it would be AWESOME if you could use the crosshair from your weapon to select and view individual waypoints in the vicinity, exactly the same way you would do it now by walking up to the waypoint, but you wouldn't have to ncessarily move around as much; just aim and seloect. ![]() So, how hard would it be to check what the crosshair is centered on and show the paths to that waypoint in focus? I would even try it myself if it isn't too much of a doozie to code. ![]() Thanks for your time, Swoop |
Cheeseh |
![]()
Post
#2
|
![]() Admin ![]() ![]() ![]() ![]() ![]() Group: Admin Posts: 3,066 Joined: 11-September 03 From: uk Member No.: 1 ![]() |
try "rcbot waypoint_menu; menuselect 2; menuselect <value>"
showng waypoint properties by looking at them wouldnt be too hard but because of the way its done you getta ass around with the client code to change the current waypoint to the one being looked at instead of nearby, or create some kind of command to override the waypoint your are looking at but you still gotta add some handling code for displaying the waypoint looked at neatly in conjunction with the other methods |
Swoop |
![]()
Post
#3
|
![]() Newbie ![]() Group: Members Posts: 9 Joined: 22-March 06 From: Colorado Member No.: 702 ![]() |
Hi Cheeseh.
Thanks for the reply. -menuselect was the ticket. That worked great! The only thing I needed to add was an extra 'menuselect' for the exit function of the menu, since it stayed open after choosing my commands (ie, "rcbot waypoint_menu; menuselect 2; menuselect 1" chooses the right options but the menu doesn't close afterwards.) So, thanks for the help there. I am still trying to read over everything to see how I could show waypoint info by simply facing it (under reticle/crosshair on screen), like in what the UTIL_FacingEnt function SEEMS to do, at first glance. It would be ideal if I could find where the code is for getting back the info on a player in view, which displays in green text in the lower left of the screen in multiplayer. This data shows the player name, score, health, and "friendly status." I am not sure if this is built into the engine or is available in the SDK as well. Any additional ideas? Thanks again for your help, Alan |
Cheeseh |
![]()
Post
#4
|
||||||
![]() Admin ![]() ![]() ![]() ![]() ![]() Group: Admin Posts: 3,066 Joined: 11-September 03 From: uk Member No.: 1 ![]() |
to get the facing waypoint you need to find the nearest waypoint where the player is looking, otherwise if you are looking through a line of waypoints you'll get confused as to what waypoint you want to manipulate. The method will become a little more complicated because I hash waypoints in another structure for fast retrival, so if you want to makeuse of that then this would be the best algorithm (LAST METHOD .. i think -- been thinking through all these) the first method uses the waypointLocations hash table, the other methods do simple looping through every single waypoint. //// hashing technique // go through several steps from facing vector // find nearest waypoint to facing vector at several stages // each stage is fStep units 1. generate facing vector i.e. UTIL_MakeVectors(pPlayer->v.v_angle) 2. create the source vector (where player is) and the destination vector (where player is looking) i.e. Vector v_src = pPlayer->v.origin+pPlayer->v.view_ofs; Vector v_dest = v_src + (gpGlobals->v_forward*8192); // far enough to possibly reach end of map 3. run a traceline to get the actual end point TraceResult tr; UTIL_TraceLine (v_src,v_dest, ......) Vector v_endpoint = tr.endPos; // something like that anyway float fEndDistance = (v_endpoint - v_src).Length(); // distance to stop this is the end vector to stop searching 4. start at say
advantages : uses hash table and priority queue (fast) disadvantages : worst case greater than version below if Step is too small (can solve by storing bit mask of all waypoints --(CBits class)and if they have been evaluated or not and take this into account in finding nearest waypoint in waypointlocations) fStep must be a value not too small, not too large uses a traceline naive method !! (see last method) ////////////////////// // angle technique run through each waypoint find angle between player and waypoint store waypoint with nearest angle and distance (overwrite best waypoint each time)
advantages: simple calculations more robust than other algorithm disadvantages: differentiation between distance difficult (not done here) runs though every single waypoint ------------- possible distance calculation method for the above
advantages: simple calculations more robust than other algorithm takes distance into account aswell disadvantages: runs though every single waypoint available |
||||||
Swoop |
![]()
Post
#5
|
![]() Newbie ![]() Group: Members Posts: 9 Joined: 22-March 06 From: Colorado Member No.: 702 ![]() |
These are great solutions to what I need. I am going to try and work with them today some. I also saw something in the SDK code somewhere, called GetGunPosition, and wondered if it might be useful as well? Maybe all it does is creates the vector from my position, just as you have listed above...
Thanks again for the helpful information. I have a lot to keep me busy for awhile. ![]() |
Cheeseh |
![]()
Post
#6
|
![]() Admin ![]() ![]() ![]() ![]() ![]() Group: Admin Posts: 3,066 Joined: 11-September 03 From: uk Member No.: 1 ![]() |
get gun position = same as v_src vector I made in the examples
|
Swoop |
![]()
Post
#7
|
||
![]() Newbie ![]() Group: Members Posts: 9 Joined: 22-March 06 From: Colorado Member No.: 702 ![]() |
Excellent. I have one question about the code in the final code example above: What does this line do? I don't see anything being returned or used by it, so could you explain what it does?
Thanks! -Swoop |
||
Cheeseh |
![]()
Post
#8
|
![]() Admin ![]() ![]() ![]() ![]() ![]() Group: Admin Posts: 3,066 Joined: 11-September 03 From: uk Member No.: 1 ![]() |
it updates gpGlobals->v_forward/v_right/v_up to vectors relative to the vector input, in this case the players view angles
(so we can then use gpGlobals->forward to add to the players position to get a vector in the world) |
Swoop |
![]()
Post
#9
|
![]() Newbie ![]() Group: Members Posts: 9 Joined: 22-March 06 From: Colorado Member No.: 702 ![]() |
Excellent! That makes complete sense now.
Thanks again, Swoop |
![]() ![]() |
![]() |
Lo-Fi Version | Time is now: 19th July 2025 - 10:08 PM |