The 3rd Age

Battles of Narnia

Battles of Narnia

A mod that will add the Narnian world to the BFME I game

Button for The 3rd AgeButton for The Dwarf HoldsButton for The Elven AllianceButton for Helm's Deep Last HopeButton for GothmogtheOrcButton for BFME+Button for The Four AgesButton for HDR HeadquartersButton for Middle Earth CenterButton for Project Perfect Mod

Become an affiliate!

   

Quick Lists

Top Rated Popular New Updated Last Comments Users

Register and log in to move these advertisements down

Advanced Debugging

Tutorial for Battle for Middle-earth BFME, Battle for Middle-earth II BFME 2, Battle for Middle-earth II: Rise of the Witch-king ROTWK

Avatar of ched

ched

Category: Code
Level: Expert
Created: Monday June 11, 2007 - 15:25
Updated: Sunday June 17, 2007 - 13:29
Views: 5808
Summary: Debug these errors that the engine does not report

Rating

Staff says

3.6

Members say

4.0

Average

3.7/5.0

6 votes

Page 1 2 3 4
Let's now learn how to handle Worldbuilder errors.



Introduction

For those yet unfamiliar with Worldbuilder (how did you even come to read Expert tutorials ?), it's the tool that mappers can use to design maps, as well as script most of the things that run on maps (Hear that music in the background while you are playing ? That's a script. Playin' BfME1 ? the AI is entirely scripted).

You will find the Worldbuilder launcher in the main BfME directory, the exe being named, strangely enough, worldbuilder.exe.



Limitations

Right, so Worldbuilder is an invaluable tool if you intend for your mod to be somewhat elaborate (new music, AI adapted, new bases for the new factions ...). Yet, EA didn't think it would be fit to equip Worldbuilder with a debugger, which is justified by the fact that the game has one already.

However, that's not the only limitation that WB has. It somehow finds it fit to load the entire contents of your BfME main directory, reading any and all .big file it reads, as well as loading the requested files.
Your entire INI structure will be interpreted by the engine, while each object contains a maximum of 10 lines that are useful to WB. No wonder the tool is so laggy on low-end computers ...

What's more, and that's probably the most crippling problem for WB, is that it doesn't support any of the arguments that the game supports. That means that one cannot launch WB with a -mod argument, thus forcing you to arrange your modded files differently.



Setting things up

The best advice I can give you if you have a fully working mod and would like to launch WB simply is to place your file in the main BfME directory, and to rename it to have an underscore ( _ ) at the beginning of its name.
For example, MyCoolMod.big becomes _MyCoolMod.big. This ensures that your files get read before the games' default, thus preventing the INI from being read twice.
Note that if you have altered the INI's organisation, you are advised to disable INI.big (simplest solution being renaming it to INI.bfme).

Now launch WB. If your coding is irreproachable, you should gain access to Worldbuilder. If you have some errors in your INI file, WB will just close itself, not reporting any errors.
DO NOT PANIC.


First off, try to start the game, and correct any errors reported by the game. If after that, Worldbuilder still crashes, we'll be moving into the hardcore part.



Obtaining the loading sequence

That's a fancy title, eh ?
My advice would now be to make some arrangements to prepare for the actual debugging. Place your INI files (the modded ones, the vanilla ones can remain disabled) unpacked in the data/ini/ folder, and remove your .big file (loading your INI is enough to effectively debug.

Launch Process Monitor, which you should have installed in page 2, and start logging the events.
Now launch Worldbuilder, and wait calmly for it to crash. When it crashes, stop logging the events in Process Monitor, and apply the filters described on page 2 if you haven't done so yet.
Now, that looks like a mess huh ? Skip directly to the INI files, and try to see which one is loaded last. That's the problematic file.
To help you out with finding out where things go wrong, I've added in the references what happens to be the loading sequence for Worldbuilder with a vanilla game. It's in PML format, which can be opened in Process Monitor

If you're lucky, it won't be an object file, linked to a thousand others and thus taking hours to check.
If one of your object crashes, try to go ingame with him, and see if he happens to crash somewhere. If you get a game.dat with him, refer to the "Known game.dat errors" article.

If it's not an object file, then simply review the file and try to see where the error is. Here are a few tips that you should know:


  • Upgrade.ini is the first file loaded that makes use of macros. Check your macros if it's crashing. {Submitted by ched}
  • The most common error is the old 75% loaded... then splash/load dialog disapears and then nothing.
  • well I find that running the game, then quitting straight back out fixes it.
    its something to do with the resource files getting temporarily screwed up. {Submitted by Hebblewhite}


I have also enclosed the loading order to a vanilla WB to load, so that you can see where it goes wrong for you.
Also, abuse of WinMerge to compare the differences you have between the last known version to work with WB you have and that buggy version of yours. The differences are the only points likely to crash the game.


Best of luck with the debugging ! Know that while this is a lengthy process, there is no known solution that is more efficient ...

Links / Downloads

 HitsAdded
Load Sequence for WB - Process Monitor Log1047June 17, 2007 - 13:29
Known game.dat errors1353June 14, 2007 - 14:10
Process Monitor1347June 11, 2007 - 15:27
WinMerge1196June 11, 2007 - 15:27

Comments

Display order: Newest first

halbarad - Saturday August 11, 2007 - 8:09

wise words indeed,

though it may be worth mentioning that sometimes the best (or only) way of debugging is to brute-force it: to slowly change back all the last things you edited until the game works again, not nice but sometimes necessary (is currently having to do it)

Sulherokhh (Team Chamber Member) - Thursday August 9, 2007 - 3:34

Heroes. All of you. :D
Thank you for writing it down.

Go to top

 

"One site to rule them all, one site to find them,
one site to host them all, and on the network bind them."

 
14:32:21