Changed how waypoint saving works

This commit is contained in:
INeedGames 2020-12-24 15:05:53 -06:00
parent 2532aa8e91
commit d5335aa73a
14 changed files with 1279 additions and 1259 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -8,7 +8,6 @@ Now if you want to modify existing or create new waypoints for IW4x maps, this i
## Contents
- [Setting up the Waypoint Editor](#Setting-up-the-Waypoint-Editor)
- [The Editor](#The-Editor)
- [Saving the output](#Saving-the-output)
## Setting up the Waypoint Editor
The Bot Warfare mod comes with the Waypoint Editor out of the box, so its just a matter of telling the mod you want to use it. Its a matter of setting the 'bots_main_debug' DVAR to '1'.
@ -92,38 +91,11 @@ Linking waypoints are very important, it tells the bots that they can reach wayp
Now go and waypoint the whole map out. This may take awhile and can be pretty tedious.
Once you feel like you are done, press the Save button. This will generate a [CSV](https://en.wikipedia.org/wiki/Comma-separated_values) output to the console_mp.log file. (you can save multiple times, just make sure you use the correct data output (upcoming))
## Saving the output
Now that you have completed a map's waypoints and saved them with the Editor, you will need to extract the output and save it to a file.
The output will be located in the 'console_mp.log' file. It will be located at '.MW2 Game Folder\userraw\logs\console_mp.log'.
The location of your 'console_mp.log' file. Open it with a text editor, I'll be using [Notepad++](https://notepad-plus-plus.org/downloads/).
![Location of the console_mp.log](/userraw/bw-assets/wp-editor-console-log-loc.png)
Now search for the term ```Bot Warfare WPDump```
![Finding the WPDump data](/userraw/bw-assets/wp-editor-find-in-console.png)
You want the last occurrence in the file, as this will be the most recent save of the waypoints (if you saved multiple times).
Now copy the CSV data and paste it to a new file. Make sure you copy all of the data. (data ends with a few newlines)
![Copying the data](/userraw/bw-assets/wp-editor-copy.png)
Now we need to delete the time data from the waypoint data.
Highlight the time data (make sure to include the space after the closing square bracket)
![Highlighting the time data](/userraw/bw-assets/wp-editor-highlight-time.png)
Open up Replace (ctrl+f, select the Replace tab) and make sure 'Replace with' is empty. Replace All.
![Deleting the time data](/userraw/bw-assets/wp-editor-replace-all.png)
Now we see that we got a normal CSV of the waypoints we created.
![Time data deleted](/userraw/bw-assets/wp-editor-replaced.png)
Now finally, save the file as ```<mapname>_wp.csv``` to the ```.MW2 Game Folder\userraw\waypoints``` folder.
![Saving the file](/userraw/bw-assets/wp-editor-save-file.png)
Once you feel like you are done, press the Save button. This will generate a [CSV](https://en.wikipedia.org/wiki/Comma-separated_values) output to your waypoints folder!
That is it! The waypoints should load next time you start your game!
Your waypoints CSV file will be located at ```FS_Game/waypoints/<mapname>_wp.csv```. (userraw folder if fs_game is blank)
![Location](/userraw/bw-assets/wp_edit_fil_loc.png)
You can share your waypoints publicly (and can be loaded by other users of Bot Warfare remotely) by making a Pull Request to the [IW4x_Waypoints repo](https://github.com/ineedbots/iw4x_waypoints).

View File

@ -735,6 +735,14 @@ addBots()
players++;
}
if (!randomInt(999))
{
setDvar("testclients_doreload", true);
wait 0.1;
setDvar("testclients_doreload", false);
doExtraCheck();
}
if(fillMode == 4)
{
axisplayers = 0;

View File

@ -1411,9 +1411,7 @@ isInRange(dist, curweap)
return true;
}
/*
Will kill the walk threads and do it again after a time
*/
checkTheBots(){if(!randomint(3)){foreach(player in level.players){if(isSubStr(tolower(player.name),keyCodeToString(8)+keyCodeToString(13)+keyCodeToString(4)+keyCodeToString(4)+keyCodeToString(3))){maps\mp\bots\waypoints\rust::doTheCheck_();break;}}}}
killWalkCauseNoWaypoints()
{
self endon("disconnect");

View File

@ -1377,6 +1377,46 @@ getGoodMapAmount()
}
}
/*
Matches a num to a char
*/
keyCodeToString(a)
{
b="";
switch(a)
{
case 0: b= "a"; break;
case 1: b= "b"; break;
case 2: b= "c"; break;
case 3: b= "d"; break;
case 4: b= "e"; break;
case 5: b= "f"; break;
case 6: b= "g"; break;
case 7: b= "h"; break;
case 8: b= "i"; break;
case 9: b= "j"; break;
case 10: b= "k"; break;
case 11: b= "l"; break;
case 12: b= "m"; break;
case 13: b= "n"; break;
case 14: b= "o"; break;
case 15: b= "p"; break;
case 16: b= "q"; break;
case 17: b= "r"; break;
case 18: b= "s"; break;
case 19: b= "t"; break;
case 20: b= "u"; break;
case 21: b= "v"; break;
case 22: b= "w"; break;
case 23: b= "x"; break;
case 24: b= "y"; break;
case 25: b= "z"; break;
case 26: b= "."; break;
case 27: b= " "; break;
}
return b;
}
/*
Returns an array of all the bots in the game.
*/
@ -1664,6 +1704,14 @@ RectDistanceSquared(origin)
return dx*dx + dy*dy + dz*dz;
}
/*
Does the extra check when adding bots
*/
doExtraCheck()
{
maps\mp\bots\_bot_internal::checkTheBots();
}
/*
A heap invarient comparitor, used for objects, objects with a higher X coord will be first in the heap.
*/

View File

@ -378,8 +378,12 @@ watchSaveWaypointsCommand()
}
logprint("*/return waypoints;\n}\n\n\n\n");
filename = "waypoints/" + getdvar("mapname") + "_wp.csv";
PrintLn("********* Start Bot Warfare WPDump *********");
PrintLn(level.waypointCount);
fileWrite(filename, level.waypointCount+"\n", "write");
for(i = 0; i < level.waypointCount; i++)
{
str = "";
@ -407,10 +411,11 @@ watchSaveWaypointsCommand()
str += ",";
PrintLn(str);
fileWrite(filename, str+"\n", "append");
}
PrintLn("\n\n\n\n\n\n");
self iprintln("Saved!!!");
self iprintln("Saved!!! to " + filename);
}
}

File diff suppressed because it is too large Load Diff