Help - Search - Members - Calendar
Full Version: Custom Map Trouble...
Battlefield SinglePlayer Forum > Main > BF42 and BFV Discussion > AI Editing and Mod Support
Dreamcast004
I used Single Player Adder to add bot support to a custom map. Right now I'm only using all-black pathmaps.

So I remm'd out the ai.CreateAllMaps thing and tried loading my map in both the debugger and the game and neither finish loading: they only get to 75% before stopping the load.

Any idea what's happening?

Much thanks in advance.
FourCentsShy
The logs created by the game debugger are your best bet to solve the problem. What ever is causing the CTD is probably noted near the end of the logs.
Dreamcast004
It's not a CTD - at 75% the game just stops loading. So I go back and check my hard disk usage light and of course it's not flashing...so something happened. I read through the logs at the bottom but it seemed like it was loading fine. I can try again though. Thanks.
Dreamcast004
CODE
Debug: AIStrategic: SAI created.
AIStrategic\SAI.cpp(306): Debug: AIStrategic: SAI being created.
AIStrategic\SAI.cpp(417): Debug: AIStrategic: SAI created.
Engine\Io\Console.cpp(1497): Warning: Io: Error bf1942/levels/Defense1/ai.con (29): endIf
Engine\Io\Console.cpp(1498): Warning: Io: Error bf1942/levels/Defense1/ai.con: Can not have an "endIf" without an "if"!
Engine\Io\Console.cpp(1769): Debug: Io: CRC32: (run) AIPathFinding.con
Engine\Io\Console.cpp(1497): Warning: Io: Error bf1942/levels/Defense1/AIPathFinding.con (0): if v_arg1 == host
Engine\Io\Console.cpp(1498): Warning: Io: Error bf1942/levels/Defense1/AIPathFinding.con: Error: Syntax error in expression!
AI\AIPathfinding.cpp(882): Debug: AI: Added searchmap: 0


That's where it ends.

I let SPC code the .con files, the only changes I made (thus something could be screwed up) were my remarking the pathmap gen code lines...

I didn't get any red boxes when I ran the map up to this point, which is why I'm wondering why it didn't show me that endIf problem. Maybe it just resumes execution on minor errors like that?

Anyway, I'm reviewing my ai.con and AIPathFinding.con files
Dreamcast004
Alright, I ran BF1942 two more times (without changing .con's) and still got the same errors at the end.

I'm no expert C++/java programmer, but (considering the .con scripting looks similar to C++) the .con files look okay to me. I'll just post them.

---------------------------------------------------------
My AIPathFinding.con is as follows:

CODE
if v_arg1 == host

rem *** Pathfinding debug mode
rem game.aiPathfindingDebuggingActive 1

rem *** Set number of maps ***
rem ai.setNSearchMaps 2 *** DEPRICATED ***
rem ai.setNSearchTypes 2 *** DEPRICATED ***

rem *** Set number of AStar resources ***
rem ai.numAStarResources 12

rem *** Setup map parameters ***
rem *** searchMap name/waterHeight/waterDepth/maxSlope/brush/lowClipLevel/hiClipLevel/considerAITypes
rem *** searchType name/mapNum/minSearchLevel


rem *** Tank ***
ai.addSearchMap Tank0 0 0 25 3.0 0.3 2.5 0
ai.addSearchType Tank 0 0
rem ai.setMapSpawnPoints 0 1912/1923
ai.setSmoothing 0 20
rem 1912/1923, 1912/1923, 1907/1919, 1907/1919, 1916/1905, 1916/1905, 1925/1909, 1925/1909, 1927/1919, 1927/1919, 1935/1920, 1935/1920, 1922/1927, 1922/1927, 1907/1909, 1907/1909, 1903/1908, 1903/1908, 1743/1315, 1743/1315, 1757/1316, 1757/1316, 1714/1314, 1714/1314, 1737/1304, 1737/1304, 1746/1305, 1746/1305, 1738/1331, 1738/1331, 866/1304, 866/1304, 873/1305, 873/1305, 839/1310, 839/1310, 861/1322, 861/1322, 1191/103, 1191/103, 1161/107, 1161/107, 1159/94, 1159/94, 1184/90, 1184/90, 1173/115, 1173/115, 1164/113, 1164/113, 1146/113, 1146/113, 1152/127, 1152/127, 1185/114, 1185/114, 1145/95, 1145/95, 1136/96, 1136/96, 1147/88, 1147/88, 1152/96, 1152/96, 1134/104, 1134/104, 354/769, 354/769, 360/778, 360/778, 371/778, 371/778, 381/768, 381/768, 1624/725, 1624/725, 1633/723, 1633/723, 1617/730, 1617/730, 1604/730, 1604/730, 1605/719, 1605/719, 1615/716, 1615/716, 1610/734, 1610/734, 611/1993, 611/1993, 619/1993, 619/1993, 626/1994, 626/1994, 627/1984, 627/1984, 619/1983, 619/1983, 611/1983, 611/1983, 626/1973, 626/1973, 619/1973, 619/1973, 612/1971, 612/1971, 625/1963, 625/1963, 616/1962, 616/1962

rem *** Infantry ***
ai.addSearchMap Infantry1 0 1.5 30 1.0 0.4 2.0 1
ai.addSearchType Infantry 1 0
rem ai.setMapSpawnPoints 1 1937/1915
ai.setSmoothing 1 10
rem 1937/1915, 861/1309, 1332/1895, 1736/1319, 1885/161, 1181/98, 365/762, 1626/732, 610/1983

beginrem
rem *** Amphibius ***
ai.addSearchMap Amphibius4 0 1000 30 4.0 0.3 2.5 0
ai.addSearchType Amphibius 4 0
ai.setMapSpawnPoints 4 0/0
ai.setSmoothing 4 20
ai.setWaterCutOffDepth 1
endrem

rem *** Load maps ***
ai.loadMaps



endIf


-----End of file-----

----------------------------------------------------
My ai.con is as follows:

CODE
if v_arg1 == host

rem ************** LEVEL SPECIFIC AI SETTINGS ***************************
aiSettings.setWorldMapSize 2048 2048
aiSettings.setViewDistance 400
aiSettings.setInformationGridDimension 45

rem ********************** START THE AI *********************************
rem *** Init AI using current settings ****
ai.init 2

rem aiSettings.lodEnable 1

rem *** init Botmanager ***
AIBotManager.setLodLevelTicks 6 6 6
AIBotManager.setLodLevelPriority 3 3 3
AIBotManager.setPlannedDecisionMakingThreshold 0.5 0.5 0.5
AIBotManager.setUnplannedDecisionMakingThreshold 0.3 0.4 0.4
AIBotManager.setDecisionMakingInterleave 2 2
AIBotManager.setSensingQuotient 1 1
AIBotManager.setSystemQuotient 40 40 20

rem *** Strategic map dimension, MUST BE DONE BEFORE CREATING SAI! ***
ai.saiMapXDimension 64
ai.saiMapYDimension 64

rem *** Create Strategic AI ***
ai.createSAI

rem *** Bot statistic ***
ai.botStatisticUpdateSpeed 3

rem *** Enabled or disabled bot debug stats here ***
ai.saiEnable 1
game.showAIstats 0
ai.showBotStats 1
ai.showStrategicAreas 1

endIf

run AIPathFinding.con v_arg1
run ai/StrategicAreas.con v_arg1
run ai/Conditions.con v_arg1
run ai/Prerequisites.con v_arg1
run ai/Strategies.con v_arg1


rem *** Add strategies ***
if v_arg1 == host

ai.addSAIStrategy 1 AxisAttack
ai.addSAIStrategy 2 AlliedAttack

endIf


-----End of file-----

I removed the lines I remm'd because I thought maybe they were the problem. Obviously the thing still doesn't work, so it's something with my code...

As I said, I read through it a couple times and it looks like it's okay. Every if has a matching endIf. I'm just not seeing the problem...
FourCentsShy
The next line in the logs, if it could get that far, would be:

AI\AIPathfinding.cpp(882): Debug: AI: Added searchmap: 1

So it seems to have trouble with the pathmaps themselves. Are the all black pathmaps the right size? From the ai.con file they should be 2048 x 2048. If they are the right size, they could be corrupt.
Death_EnForcer
If you try to run the game with these two lines having 1's in them, then you will crash.

ai.showBotStats 1
ai.showStrategicAreas 1

I usually change them to 0 when creating pathmaps.
Dreamcast004
I figured, since I didn't want to see those bot stats anyway... I'll go right now and do it.

Thanks.
Dreamcast004
Okay. A few things.

I realized what you said FourCentsShy, that it just wasn't loading the next pathmap (the infantry one I think.) All pathmaps are the 2048x2048 cajun supplied on the other forum.


I repacked my map and now I'm getting nasty startup errors which I'm trying to resolve..."TBM:fel!" and stuff.
Death_EnForcer
nm .... did you make a backup of conquest map? Before you made it coop.
Dreamcast004
Yes, my pathmaps are correct.

I did what you said as well. But for whatever reason, now when I repack my map I get those corrupt map startup errors...
Death_EnForcer
Can you startup any other maps or it's only your map that doesn't startup.
Dreamcast004
I can't start up battlefield altogether, but when I remove what I repack it's okay.
Death_EnForcer
Yeah, sounds like a corrupt map. Maybe you should just restart the adding of coop. I hope you had a backup copy of the conquest map.
Dreamcast004
Error: IoFile: TBM: fel!
Engine\IoFile\FlatArchive.cpp(804): Error: IoFile: TBM: extractFilePath(fileIter->first.c_str()) Defense1/
Engine\IoFile\FlatArchive.cpp(805): Error: IoFile: TBM: m_archivePath Bf1942/Levels/Defense1/


That's what happens.

Thanks for your help, by the way, any suggestions are much appreciated. At this point I just want to see bots on my map, no matter how dumb they are.
Death_EnForcer
Is it a small map? Maybe you could email it to me and I could check it out.
Dreamcast004
Eh, it's in a mod, so I'd have to send you what I've got. I don't want to trouble you.

Here's the problem: I use BFSPC to create the map, load up BF1942 in debug mode, and during the pathmap generation part of the process, BF1942 decides not to load my map past 75%. My map works fine in conquest, it's just whenever it's loading it in SP or generating the pathmaps it screws up...

EDIT: Battlefield is still running when it reaches 75%. It just doesn't load past 75% and the log file says (even when creating pathmaps):

Engine\Io\Console.cpp(1769): Debug: Io: CRC32: (run) ai
Engine\Io\Console.cpp(1497): Warning: Io: Error bf1942/levels/Defense1/ai.con (0): if v_arg1 == host
Engine\Io\Console.cpp(1498): Warning: Io: Error bf1942/levels/Defense1/ai.con: Error: Syntax error in expression!
AI\AIConsole.cpp(231): Debug: AI: Successfully initialized AI
AIStrategic\SAI.cpp(306): Debug: AIStrategic: SAI being created.
AIStrategic\SAI.cpp(417): Debug: AIStrategic: SAI created.
AIStrategic\SAI.cpp(306): Debug: AIStrategic: SAI being created.
AIStrategic\SAI.cpp(417): Debug: AIStrategic: SAI created.
Engine\Io\Console.cpp(1497): Warning: Io: Error bf1942/levels/Defense1/ai.con (29): endIf
Engine\Io\Console.cpp(1498): Warning: Io: Error bf1942/levels/Defense1/ai.con: Can not have an "endIf" without an "if"!
Engine\Io\Console.cpp(1769): Debug: Io: CRC32: (run) AIPathFinding.con
Engine\Io\Console.cpp(1497): Warning: Io: Error bf1942/levels/Defense1/AIPathFinding.con (0): if v_arg1 == host
Engine\Io\Console.cpp(1498): Warning: Io: Error bf1942/levels/Defense1/AIPathFinding.con: Error: Syntax error in expression!
AI\AIPathfinding.cpp(882): Debug: AI: Added searchmap: 0


So it's claiming there's a syntax error in a .con file. Note that the above was captured while I was CREATING the pathmaps. So it's saying "Added searchmap: 0" and not going on to the infantry searchmap.
Death_EnForcer
Yeah it looks like a con problem. Maybe one of the if v_arg1 == host lines is missing. I would just start over and add the coop files again. It only takes a few minutes. Then you add the Black pathmaps folder and change those botstat 1's to 0. Then you rem the createallmaps code. Then repack and hope it works.
Dreamcast004
QUOTE (Death_EnForcer @ Jun 23 2005, 06:51 PM)
Yeah it looks like a con problem. Maybe one of the if v_arg1 == host lines is missing. I would just start over and add the coop files again. It only takes a few minutes. Then you add the Black pathmaps folder and change those botstat 1's to 0. Then you rem the createallmaps code. Then repack and hope it works.

Yeah, that's exactly what I did (a few times over) but it still stopped at the same spot every time.

Don't trouble yourself with it though, it doesn't really matter. I'll figure it out sometime later - I think I need time away from it laugh.gif
Death_EnForcer
Good luck. Sorry it didn't work.
FourCentsShy
I would check the map name for typo's. The name has to match the folder it's in, but is not case sensitive. The other thing that will cause that error is if the base folder of the map is wrong. Either way it's best to try to repack it.
cajunwolf
You need to rem out the ...



ai.setMapSpawnPoints

and do the maps one at a time. Be sure and disable the stats in the AI.con file. Rem out the object spawns in the coop.con files. Now start the map in the debugger in coop. Once the map loads (you might have to keep hitting the "R" key to get past any errors) hit the "P" to pause it. Now hitthe "~" key to drop the console and use the following command to create the pathmaps.

ai.createMaps 0 for Tank ..

ai.createMaps 1 for infantry ..and so on.


There will be a pause and you will see when it has finished with each map no.

Also make sure to put your bf1942 "Init.con file back to stock. If it has a line in there for creating shadows etc..get rid of it.

Any problems post back. This is the best way to run pathmaps for a mod of bf1942.
Dreamcast004
Thanks! I'll try that right now and get back to you.
Dreamcast004
Okay, I'm back to square one. I tried what Cajun said but once again my map loaded to 75% and BF stopped responding (because it didn't load the AI pathmaps.) I will look through my .con files a little more carefully and retry it a couple times.
cajunwolf
Try this, rem out the static objects and see if that works. I had an issue with an DesertCombat map one time that was about the same as yours. It turned out to be several of the DC static objects..like stair 4 from Oil_Fields was one of them. I could create Infantry maps but not the tank maps. If this works then unrem like 10 of the statics at a time till you find the trouble makers. Another thing I noticed was you still had aiMeshes turned on in your AIpathFinding.con file (Infantry map call). This can cause issues if you do not have aiMeshes for the Mod objects. In this line here ...

ai.addSearchMap Infantry1 0 1.5 30 1.0 0.4 2.0 1


change the bool value on the last digit (in red) like so ...

ai.addSearchMap Infantry1 0 1.5 30 1.0 0.4 2.0 0

This will turn off the use of aiMeshes for the infantry maps. If you do get a set of Infantry maps but they are streaked then increase the brush size to 2.0 instead of 1.0 as it is now.

By the way ... what Mod is it for?

Adder here ... As mentioned above be sure and rem the object spawns as you do not need them to do the pathmaps. This way a troubled Object will not cause you grief.
Dreamcast004
I have no static objects on the map and I haven't added static objects to the mod yet (but I did turn off AI meshes anyway like you said hoping that it would work, unfortunately it didn't).

I made a very quick mod (by basically adding 0's to the stats of the Battlefield 1942 vehicles in the .cons to make them insane). My object files are okay.

It adds the tank searchmap, so it gets past

CODE
rem *** Tank ***
ai.addSearchMap Tank0 0 0 25 3.0 0.3 2.5 0
ai.addSearchType Tank 0 0
rem ai.setMapSpawnPoints 0 1912/1923
ai.setSmoothing 0 20
rem 1912/1923, 1912/1923, 1907/1919, 1907/1919, 1916/1905, 1916/1905, 1925/1909, 1925/1909, 1927/1919, 1927/1919, 1935/1920, 1935/1920, 1922/1927, 1922/1927, 1907/1909, 1907/1909, 1903/1908, 1903/1908, 1743/1315, 1743/1315, 1757/1316, 1757/1316, 1714/1314, 1714/1314, 1737/1304, 1737/1304, 1746/1305, 1746/1305, 1738/1331, 1738/1331, 866/1304, 866/1304, 873/1305, 873/1305, 839/1310, 839/1310, 861/1322, 861/1322, 1191/103, 1191/103, 1161/107, 1161/107, 1159/94, 1159/94, 1184/90, 1184/90, 1173/115, 1173/115, 1164/113, 1164/113, 1146/113, 1146/113, 1152/127, 1152/127, 1185/114, 1185/114, 1145/95, 1145/95, 1136/96, 1136/96, 1147/88, 1147/88, 1152/96, 1152/96, 1134/104, 1134/104, 354/769, 354/769, 360/778, 360/778, 371/778, 371/778, 381/768, 381/768, 1624/725, 1624/725, 1633/723, 1633/723, 1617/730, 1617/730, 1604/730, 1604/730, 1605/719, 1605/719, 1615/716, 1615/716, 1610/734, 1610/734, 611/1993, 611/1993, 619/1993, 619/1993, 626/1994, 626/1994, 627/1984, 627/1984, 619/1983, 619/1983, 611/1983, 611/1983, 626/1973, 626/1973, 619/1973, 619/1973, 612/1971, 612/1971, 625/1963, 625/1963, 616/1962, 616/1962


However, it hangs up when trying to add the infantry searchmap, so it gets screwed up here:

CODE

rem *** Infantry ***
ai.addSearchMap Infantry1 0 1.5 30 1.0 0.4 2.0 0
ai.addSearchType Infantry 1 0
rem ai.setMapSpawnPoints 1 1937/1915
ai.setSmoothing 1 10
rem 1937/1915, 861/1309, 1332/1895, 1736/1319, 1885/161, 1181/98, 365/762, 1626/732, 610/1983


I can't find anything wrong with either of those, so I don't know what's causing the hang up. Once again, I don't want to trouble anyone with this (because I'll eventually figure it out, hopefully), but all suggestions are welcome.

Thanks for the help so far.
FourCentsShy
You could try removing the all black pathmaps completely, load the map and pause it immediately once it's loaded (if it loads).

Another thing to look for is any unpacked pathmaps and con files. When you generate pathmaps, they end up in here:

<game dir>\Bf1942\levels\<map name>\Pathfinding

Where <game dir> is the folder where battlefield is installed (usually C:\Program Files\EA GAMES\Battlefield 1942) and <map name> is the maps name (of course). Any files in unpacked folder take precedence over those in the packed rfa. If, by chance, there are damaged pathfinding files in there, the game will try to load them. Any unpacked con files also are run instead of those in packed rfa's, if there are any.
cajunwolf
Dreamcast004,

QUOTE
Once again, I don't want to trouble anyone with this (because I'll eventually figure it out, hopefully), but all suggestions are welcome.


Hay bud thats what we are here for and what this forum is about. Is there any way you can get this rar'ed or zip'ed up so we can d\l it for a look see. From what you are posting it should work. If myself, 4c or one of the others could take a look see maybe we can figure out what the problem might be. We wait for problems like this to work on as it is our fun.
Dreamcast004
It's an entire mod I'd have to send you, but I'm going to zip up just the map so you can see all my .con files.

As for my objects, they're 100% error-free as far as I know (since I rigorously checked through them and redid the ones causing the errors according to the debugger.) ALL red boxes the debugger used to give me are fixed.

Obviously you won't be able to run the map, but you can look at the .cons to see if something's wrong.

Thanks very much for the help.
cajunwolf
K got a copy and will see what I can do. I noticed you have no terrain textures but I can add them from the height map. I will change this to another mod and see if I can get it to path. The files all look ok to me.
Dreamcast004
Okay, thanks very much for all your help cajun!

Don't let it take up too much time though, I don't want you worrying over one little thing.
cajunwolf
Did you ever do the surface maps for this map..or did you just leave out the textures to save size?

Ok have your pathmaps done. The main problem you had was in the Init\Terrain.con file.

It was calling for ..



GeometryTemplate.file bf1942\levels\Defense1\Heightmap

Instead of ...

GeometryTemplate.file bf1942\levels\Defense1_Control\Heightmap

Which is the name of the map. This needs to be changed in all four lines in the Terrain.con file. You need to re-name it "Defense_One_Control" which is what I did as bf hates numbers in map names.)

If you had not generated surface maps this would be a problem also. If you have created new vehicles for the mod they will have to have aiTemplates to work.

I just ported the map to bf1942, surface mapped in Battlecraft, corrected the Terrain.con file and ran the pathmaps. I rem'ed out object spawns also.

I got all the errors in the Debugger but like I always do..I just ignor the darn thing and just get my pathmaps done.

BTW the Bots ran around and tried to kill each other like they are supposed to (no vehicles though as I did not have your mod).

Here are the pathfinding files ...


Pathfinding

Here is the whole map as I set it up ported to bf1942.

http://www.cajunwolf.com/files/Defense_one_Control

Just port it back and un rem all the rem's in BOTH coop.con files. Then try it out in your mod. If the bots do not move rem out the object spawns, if they move then you have an error with there ai templates or do not have ai templates.
mschoeldgen
Great job finding out that one , Cajunwolf ! biggrin.gif I guess the problem with numbers in mapnames comes from the engine converting mapnames to small letters internally, like you have it on the dedi server. Ever tried to convert a capital 1 to a small 1 ? rolleyes.gif
cajunwolf
Yea mschoeldgen that number thing bit me when I first started mapping with bf1942 about three years ago now and I have never forgotton it!
Dreamcast004
Sorry I haven't been here for a while, I've been a bit busy.

Thanks for the help, cajun! I'll go try that now and let you know how it turns out.
cajunwolf
Be sure and d\l the pathmaps I made and the map if you want it. Let me know when you have them so I can remove from my site.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.