Jump to content
Official BF Editor Forums
Sign in to follow this  
Psi_Co_Killa

Bot Support

Recommended Posts

hello again...

i havent slept since the above post

and have worked thru the "checklist" in the tutorials section twice now.its all straight forward , except for "bots"

I am hopelessly stuck on the "createnavmesh.bat" part

being new to botsupport + mapping in general , i didnt make a copy of "generatenavmeshlocal.py" before editing + saving

now i think i botched it up good , because whenever i try to run "createnavmesh.bat" i enter mod-bf2

map-my_map_name ,then it brings up the "generatenavmeshlocal.py" file again

heres what the file looks like currently

_____________________________________________________________________________________________________________________________

import os

import sys

import string

# Change the line below to the mod you are working on

mod = "bf2"

#

# TODO:

# Replace ROBOCOPY with python copy instead, don't know if we can ship with ROBOCOPY.

#

################################################################################

def findNocaseString(strings, toFind):

index = 0

lowerToFind = string.lower(toFind)

for entry in strings:

if (string.lower(entry) == lowerToFind):

return index

index = index + 1

return -1

################################################################################

def executeCommand(commandLine):

print "Executing: " + commandLine

result = os.system(commandLine)

print ""

return result

################################################################################

def copyDirectory(source, destination):

executeCommand( "robocopy " + source + " " + destination + " /MIR")

################################################################################

def moveDirectory(source, destination):

executeCommand("robocopy " + source + " " + destination + " /MOVE /MIR")

################################################################################

def removeDirectory(directory):

executeCommand("rd /Q /S " + directory)

################################################################################

def runEditor(level, conScript):

os.chdir("..")

executeCommand("bf2editor +loadMod " + mod + " +loadLevel " + level + " +runConFileAndClose \"" + conScript + "\" +enableAsserts 0 +forceLoadPlugin SinglePlayerEditor")

os.chdir("NavMesh")

################################################################################

def runNavMeshControl(level, workingFolder):

return executeCommand("NavMeshControl.py " + workingFolder + "\\" + level + "\\GTSData")

################################################################################

def cleanupOldData(level, levelFolder):

# Removing old data

removeDirectory(levelFolder + "\\" + level + "\\GTSData\\Meshes")

# Deleting old pathfinding mesh...

executeCommand("del /Q /F " + levelFolder + "\\" + level + "\\aiPathFinding\\*.*")

################################################################################

def exportGts(level, levelFolder):

print "-----------------------------------------------------------------------"

print "- Exporting gts-data..."

# Export GTS data...

runEditor(level, "exportGTS")

print "Done..."

print ""

return True

################################################################################

def generateNavmesh(level, levelFolder, workingFolder):

print "-----------------------------------------------------------------------"

print "- Generating navmesh..."

# Copy GTS-files to working folder

moveDirectory(levelFolder + "\\" + level + "\\GTSData\\Meshes", workingFolder + "\\" + level + "\\GTSData\\Meshes")

# Generate the navmesh

result = runNavMeshControl(level, workingFolder)

print "Done..."

print ""

if (result == 0):

return True;

else:

return False;

################################################################################

def createQtrFiles(level, levelFolder, workingFolder, useP4):

print "-----------------------------------------------------------------------"

print "- Creating qtr-files..."

print "Copying navmesh-data to levelfolder"

copyDirectory( workingFolder + "\\" + level + "\\GTSData\\Output", levelFolder + "\\" + level + "\\GtsData\\Output")

print "Converting to qtr-files"

conScript = "saveQuadNoP4"

if (useP4 == True):

conScript = "saveQuad"

runEditor(level, conScript)

print "Done..."

print ""

return True

################################################################################

def printUsage():

print "Usage: GenerateNavmeshLocal.py <modName> <levelName> [p4]"

print "p4 - If specified the editor will automatically submit the data to perforce"

################################################################################

def main():

if (len(sys.argv) < 3):

printUsage()

return

mod = sys.argv[1]

level = sys.argv[2]

p4 = findNocaseString(sys.argv[3:], "p4") >= 0

cleanup = True

print "########################################################################"

print "#"

print "# Generating navmesh"

print "#"

print "# mod = " + sys.argv[1]

print "# level = " + map

print "# p4 = " + str(p4)

print "#"

print "########################################################################"

levelFolder = "..\\mods\\" + mod + "\\levels"

workingFolder = "work"

# Make sure that the level exists

if ( not os.path.isdir(levelFolder + "\\" + level)):

print "Error: Failed to find level-directory for " + level

return

if (cleanup):

cleanupOldData(level, levelFolder)

if (not exportGts(level, levelFolder)):

print "Error: Failed to export gts-data..."

return

if (not generateNavmesh(level, levelFolder, workingFolder)):

print "Error: Failed to generate navmesh..."

return

if (not createQtrFiles(level, levelFolder, workingFolder, p4)):

print "Error: Failed to create qtr-files..."

return

print "Generation completed"

main()

___________________________________________________________________________________________________________________________________

any help would be appreciated - thanx

Psi_

Share this post


Link to post
Share on other sites

hello again...

i havent slept since the above post

and have worked thru the "checklist" in the tutorials section twice now.its all straight forward , except for "bots"

I am hopelessly stuck on the "createnavmesh.bat" part

being new to botsupport + mapping in general , i didnt make a copy of "generatenavmeshlocal.py" before editing + saving

now i think i botched it up good , because whenever i try to run "createnavmesh.bat" i enter mod-bf2

map-my_map_name ,then it brings up the "generatenavmeshlocal.py" file again

heres what the file looks like currently

Sounds to me like you did not install Python. What tutorial are you using? Kysterama's is the most user friendly, step by step tutorial created.

Share this post


Link to post
Share on other sites

hi

i am using the 1 created by Mschoeldgen . its part of the checklist.

I did install python , even tried re-installing it when this wouldnt work.

I have followed the instructions step-by-step....

checklist : http://www.bfeditor.org/forums/index.php?showtopic=4611

bot support : http://www.bfeditor.org/forums/index.php?showtopic=3809

I get to the point where it says edit 'GenerateNavmeshLocal.py' , edited it using notepad...

then I export the 2 .con files

(as prescribed : i have overgrowth - so skip that step.)

and then run "createnavmesh.bat"

When prompted - i enter the mod : bf2 (+ enter)

When prompted - i enter the map : Psi_Co_Killas_1st_Assault (+ enter)

then it just opens up 'GenerateNavmeshLocal.py' in notepad again....

more info - dont know what might be usefull :

bf2 patched - 1.41 (not 1.5) (default paths)

editor version - 1.3 (v.0.1.237.0) (default paths)

python version - 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] (default paths)

Right now I dont have big plans for mods :(u need a masters degree in patience for that)

I just wanna make ( small - medium sized )co-op levels with bot-support for me mates + I to lan on.

Normal BF2 vanilla maps , which we will then run in Folkes_Unlocks123 Mod (to get all the guns etc.)

And according to the checklist - I am nearly there :blink:

the link to the other tut u mention is broken (i think-if its the same 1 : http://kysterama.co.nr/ ) site unavailable...

Any1 that can tell me where Im going wrong - please do.

Regards

Psi_

Edited by Psi_Co_Killa

Share this post


Link to post
Share on other sites

It sounds like your operating system does not know to run python when a file with .py extension is called. This may have happend when you edited the file. If you had the checkmark to always load in notepad, then it won't try to run it anymore. Try right clicking on the GenerateNavmeshLocal.py, choose open with and then find the pyhon program on your computer (make sure the always use box this is checked). Then, the next time you edit it, right click, use the open with option, select notepad (but this time make sure the always use box is not checked).

By the way, I created a PDF archive of all the good navmesh tutorials and posted them here:

http://www.battlefieldsingleplayer.com/forum/index.php?showtopic=15853

Share this post


Link to post
Share on other sites

WOW

WOW WOW

Thanx for the links! ive downloaded all of the tuts

i eventually started all over - completely removed bf2+python+editor (everything)

deleted all leftover folders+files + re-installed the lot

now i have a back-up of the original 'GenerateNavmeshLocal.py' stashed safely away...(lesson learned)

also - as u suggested - i made sure the file associations where correctly set (not auto open with notepad)

so currently - its working - sortof - the bots just sit in 1 place...

still experimenting...the tuts will help a lot

i am planning on using GMAX to do the navmesh editing - are there any issues i should be aware of beforehand?

thanx again!!

Psi_

Share this post


Link to post
Share on other sites

i am planning on using GMAX to do the navmesh editing - are there any issues i should be aware of beforehand?

thanx again!!

Psi_

No, gmax doesn't work without serious filemangling, you are currently not able to do that.

Use Blender or Wings3D or any other3D editor with built-in OBJ support.

i eventually started all over - completely removed bf2+python+editor (everything)

deleted all leftover folders+files + re-installed the lot

That tells me - all you would have to do wold be to left-click a *.py file -> Open with.. select python.exe and check the 'Always use his program to open that kind of file ' box. Instead you re-install the whole bunch , spending hours.

I'm afraid that bot support is currently beyond your scope - but surprise me :P

Edited by mschoeldgen[Xww2]

Share this post


Link to post
Share on other sites

Hello Again

1ST - APPOLOGIES - THIS STARTED OUT AS A QUESTION ON LIGHTMAPPING...

and sorta changed to bot-support after i got lightmapping working properly

OK - so I got bot support working (under very strict conditions)

Heres the 3 ways I could get it working (this works without even having to edit the navmesh with a 3rd party app) as long as i do it last

If i make changes to the map + run createnavmesh.bat + then fixnavmesh.bat again - it no longer works... (??WHY??)

SA NEIGBOR SA NEIGHBOR SA

team1 uncapable <-> neutral capable <-> team2 uncapable

team1 capable --> neutral capable <-- team2 capable

team1 uncapable <-> team1 capable --> neutral capable <-- team2 capable <-> team2 uncapable

So thats OK for now...i can live\work with that.

And u say GMAX is a no-no(TOO COMPLICATED). Will try BLENDER when the time comes-downloading now.

Thank u so much for ur patience.

I tried BF2 Mapping 2 years ago - but lost heart when I couldnt get to grips with a lot of the things

(and i think I just didnt have the patience) + nowadays the Tutorials are also organised better

!!!!!Special thanx for the "checklist" tutorial!!!!

There used to be a video tut that showed how to make the brush larger than 100% - i cant find it now...

And i never downloaded it back then (regrets.....) The maker of the tut's had a post that was pinned (under general discussion i think)with many usefull video tut's ,but now i cant find it anywhere...it involved the 3 dropdown console thingies - i tried some combinations that seemed logical - but could not find the right combination...(big surprise....lol)

Hoping to get my 1st complete level done soon.

Regards

Psi_

Edited by Psi_Co_Killa

Share this post


Link to post
Share on other sites

Heres the 3 ways I could get it working (this works without even having to edit the navmesh with a 3rd party app) as long as i do it last

If i make changes to the map + run createnavmesh.bat + then fixnavmesh.bat again - it no longer works... (??WHY??)

And u say GMAX is a no-no(TOO COMPLICATED). Will try BLENDER when the time comes-downloading now.

Thank u so much for ur patience.

Once you get a working navmesh, don't redo it until you are finished with map changes. The navmesh generation process can be very 'touchy'. Moving spawn points can change it. The navmesh process tends to have occasional issues with open areas and transitions (like onto any object that bots can cross, like bridge entrances). Adding spawns at the bridge entrance can help. You can add extra spawn points before navmeshing into poential problems areas to try to get better a better navmesh generated. If the map is small enough, you map be able to generate a working navmesh without editing, but I have never had success with that for a vehicle navmesh, even if you use the largest generated obj file instead of fixing the navmesh islands.

Gmax does not support the obj format. You would have to use another tool to handle the conversions, that's why it's better to use a free tool like blender that has native obj support.

Share this post


Link to post
Share on other sites

dont redo it...OK-so itll be the last thing i do.

will keep that in mind...

regarding the vehicle navmesh thing - i dont know if this is relavant at all :

i didnt make any roads using the roads tool - just let the bots figure it out 4 thenselves in my previous tests

i tried keeping the map simple till i got bots working - so there were 2 or 3 buildings only.

they found their way ok - i am currently putting something a bit more complex together - will test before continuing (will back it up before continuing.)

no point putting more work into it if it wont work again...

Thanx :D.

Psi_

Edited by Psi_Co_Killa

Share this post


Link to post
Share on other sites
i didnt make any roads using the roads tool - just let the bots figure it out 4 thenselves in my previous tests

i tried keeping the map simple till i got bots working - so there were 2 or 3 buildings only.

they found their way ok - i am currently putting something a bit more complex together - will test before continuing (will back it up before continuing.)

no point putting more work into it if it wont work again...

Roads - thats ok, the bots don't recognize them anyway, it won't affect the navmesh process. There's a lot of mods without using roads but SP support.

Buildings: Making the navmesh should be last on your map checklist. Changing maps after creating the navmesh will lead to serious probblems, even crashes. Finish your map *completely* before adding bot support or start over with navmeshing. As a rule of thumb if your map runs perfectly in CQ it should be ready for neighbouring settings and navmeshing. Once you move things around or change overgrowth, undergrowth etc... You have to make a new navmesh.

Share this post


Link to post
Share on other sites

OK

so i got it all working - my bots are taking flags without me having to give orders (not just standing there anymore :D heres a list of what i found where the absolute minimum requirements 4 bots 2 work + without using any 3rd party apps

TERRAIN - PAINTED - AT LEAST 1 COLOUR (LOW DETAILTEXTURE SET + GENERATED) flat for this test

LEVEL - 1 FLAGperTEAM + 1 SPAWNPOINTperFLAG + 1 CapABLE FLAG WITH SPAWNPOINT,AND AT LEAST 1 CAR on ANY FLAG

OVERGROWTH - PUT A BIT SOMEWHERE ON YOUR MAP + GENERATE ALL,MAKING THE DUMMY FOLDER LIKE IN THE TUT DIDNT WORK 4 ME

FOLDERS - PASTE AI + WATER INTO YOUR_MAP FOLDER }EXTRACTED FROM - DALIAN PLANT (use any original map)

FILES - PASTE SKY.CON + WATER.CON INTO YOUR_MAP FOLDER }EXTRACTED FROM - DALIAN PLANT (server.zip)

COMBAT AREA - TICK - used by path finding -OPTION AVAILABLE AFTER YOU CONNECT THE DOTS-or edit gameplayobjects.con

STRATEGIC AREAS - 1 SA / FLAG + 1 NEIGHBOUR / SA (1 WAY= CAPABLE-to-NEUTRAL FLAG) + SA's NEEDS VEHICLE + INF.ORDER POSITIONS

NEIGHBOURING - THESE 4 VARIATIONS WORK FOR ME EVERY TIME :

01 ) TEAM_1_UNCAPPABLE <-> TEAM_1_CAPPABLE --> NEUTRAL_CAPPABLE <-- TEAM_2_CAPPABLE <-> TEAM_2_UNCAPPABLE

02 ) TEAM_1_CAPPABLE --> NEUTRAL_CAPPABLE <-- TEAM_2_CAPPABLE

03 ) TEAM_1_UNCAPPABLE <-> NEUTRAL_CAPPABLE <-> TEAM_2_UNCAPPABLE

04 ) TEAM_1_CAPPABLE <--> TEAM_2_CAPPABLE

THEN RUN - CREATENAVMESH.BAT (IT MUST LAUNCH EDITOR TWICE DURING BUILD) AND THEN RUN FIXNAVMESH.BAT

BOTS - SHOULD NOW BE WORKING IN CO-OP + SINGLE PLAYER

WAYPOINTS - ONLY ADD THEM AFTER THE NAVMESH IS DONE

Ive put my findings here to hopefully help other noobs like me get bots going

if u havent yet succsesfully got bots to work - follow the above steps

KEEP IT SIMPLE.after some success doing simple maps - scale up in size and complexity

THEN :D:D:lol::D:lol: AS U SEE THE BOTS GO FOR A FLAG BY THEMSELVES ON YOUR OWN MAP FOR THE 1ST TIME

Thanx for the assistance

Psi_

Edited by Psi_Co_Killa

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×