Jump to content

Windows 3D editor ate my scenario!

Recommended Posts

When I added an outdoor section, little did I know that BoA 3D editor would eat my scenario:


1. Add +1 North Outdoor Section,

All the terrain in current section (not the floors) removed!

2. Replaced terrain including the @$#!ing cliff walls.

3. Save, ERROR!

4. Reload, terrain still missing. #$*@!

5. Test save, ERROR!

6. Reload, try to edit town.

ERROR, 3D editor shut down.

7. Reload, try again:





This is pretty strange. It looks like I'm going to have to make another scenario and transfer the town into it (see if it's okay) as well as tranfer all the files. I'm just glad I hadn't gotten started on scripting yet.


Edit: I just wanted to mention that before the soldier transformed into a shield, he was shrouded in a black aura that slowly spread in all directions.

Link to comment
Share on other sites

Before you do that, go into your scenario folder and see if there isn't a file named [yourscenario].bas.bak. If there is, you can remove the .bak part of the extension and load it up in the editor like an ordinary scenario. Of course, keep a copy of the original .bas in case the 3D editor hasn't made a backup recently.


- This post brought to you by UBB. UBB: eating posts for your convenience!

Link to comment
Share on other sites

I'm glad to hear you were able to recover your work. This topic has, however, lead me to make the discovery that, unlike the Windows version, the Mac version of the editor seems to never leave backup files. On one hand I've never heard of a situation where it was needed, but on the other it could be good safety precaution.

Link to comment
Share on other sites

The Windows 3D Editor crashes totally during attempts to port BoE scenarios, it produces a 0Kb bas file.


It also crashes when you attempt to alter the outdoor sections. The good news is that it may actually make the intended alteration before crashing. Basically there are two other ways to alter the outdoor size of a scenario. The first is to make a new scenario with the desired outdoor dimensions, then import every outdoor zone and every town into it. The other is hex-editing, I have decrypted the bas file using the source code for the editor.

(Edit: I tried increasing the size of the outdoors on "A Visit to the Madhouse" and it didn't crash. Why didn't it crash?!)


Enraged Slith produced a fascinating graphic there, I don't know what it was intended to look like so I can't figure out what went wrong. Maybe the program inserted too many characters so the town records are starting on the wrong line.

Link to comment
Share on other sites

I've had this happen to me several times before, and it's always been caused by increasing outdoor size. It's fairly consistent (If I reload from the backup and try to increase outdoor size again, towns get corrupted in the same way), but I DO remember successfully increasing outdoor size once before, so hell if I know why for some scenarios it will consistently crash while for others it will work.


Apparently Isaac and company saw this one coming, because the .bas.bak files are always created when you try to increase outdoor size. wOOt

Link to comment
Share on other sites

As for the apparent success of me increasing the outdoors of A Visit to the Madhouse: there is no terrain in the Honeycomb outdoor map. I have not spot - checked the scenario as a whole there may be other errors.


Here is my understanding of the first part of a bas file, the numbers on the right are the number of places occupied by the contents of each line.

unsigned char flag1, flag2, flag3, flag4; 4

// for mac, flags are 97 215 7 33

// for win, flags are 199 61 2 53

unsigned char ver[3]; 3

unsigned char min_run_ver; 1

unsigned char prog_make_ver[3]; 3

unsigned char num_towns; 1

short out_width, out_height; 4

short min_level, max_level; 4

short rating; 2


Line 107, 57-58: last outdoor section edited.

Line 107, 59-60: last town edited.

Here ends the fixed scenario entries, now the first or only outdoor section should start.

These figures assume that there are 70 ASCII characters per line.


Outdoor Sections

184 lines and 12 characters each, should be 12892 characters in total.


char name[20]; 20

unsigned char floor[48][48],height[48][48]; 4608

(a lot of lines)

char section_script[14]; 14

short is_on_surface; 2

short extra[10]; 20

Link to comment
Share on other sites

No, this is not quite right; you see, the entire scenario is never loaded in memory, and furthermore the outdoor sections must be written into the scenario file in a specific order, so the size changing function is enmeshed in its own save procedure, which is not the same as the standard one. It might be better to say that the change outdoor size feature is a save procedure. Thus the save operation used by changing the outdoor size is not the same as the normal save feature, and must be source of the trouble.


The function in question should be do_save_change_to_outdoor_size in Bl A Fileio.cpp.

Link to comment
Share on other sites

It is good that the error has been identified. Unfortunately the Windows 3D Editor source code can't be compiled, except possibly on the Linux program KDevelop. So it is not currently possible to write a corrected Windows 3D Editor.


Adding extra outdoor sections is easy in a hex editor, figure out where you want them to go and just start pasting them in.


Edit: the scenario part of the bas file occupies the first 7,480 places. Assuming that the hexadecimal address of the first place is 0, the first outdoor sections starts at hex address 1D38.

Link to comment
Share on other sites

Well, I wouldn't say I've identified the rror, just the function that it must be in. I'm working on it. Also I've compiled the Windows Editor in the past using Dev C++, so there no serious problem there.


I would be careful about adding sections via hex editing, remember that you have to keep the outdoors rectangular, correct the outdoor width and outdoor height numbers, and maintain correctness of the scenario starting location. It's not a procedure for the faint of heart. However, in case it helps:

The scenario data is indeed 7480 bytes, with the outdoor width being the 12th and 13th bytes and the outdoor height being the 14th and 15th. The x,y coordinates of the starting section are at offset 6374, each coordinat is a 2 byte field. Each outdoor section should be 12982 bytes, and begins with the outdoor section's name (which is 20 bytes long).

Link to comment
Share on other sites

I have had no luck compiling anything on Dev-C++, using Windows XP, how do you do it?


I have worked it out, but what this forum needs is an easy way to attach a file to a post. Ironworks Forum has this ability. It also needs the ability to insert tab stops into posts, tabs or tables.


The numbering of hex addresses below starts at 0 not 1. There are four columns, type of character, its description, how many spaces it occupies and where it starts.


The table, with an attempt to identify columns with tildes.


unsigned char ~ flag1, flag2, flag3, flag4; ~ 4 ~ 0

unsigned char ~ ver[3]; ~ 3 ~ 4

unsigned char ~ min_run_ver; ~ 1 ~ 7

unsigned char ~ prog_make_ver[3]; ~ 3 ~ 8

unsigned char ~ num_towns; ~ 1 ~ 11

short ~ out_width, out_height; ~ 4 ~ 12

short ~ min_level, max_level; ~ 4 ~ 16

short ~ rating; ~ 2 ~ 20

char ~ scen_name[50]; ~ 50 ~ 22


(a lot of deleted lines)


location ~ what_outdoor_section_start_in; ~ 2 ~ 6372

location ~ start_where_in_outdoor_section; ~ 2 ~ 6374

short ~ town_to_add_to[10]; ~ 20 ~ 6376


(a lot of deleted lines)


location ~ last_out_edited; ~ 2 ~ 7476

short ~ last_town_edited; ~ 2 ~ 7478

Link to comment
Share on other sites

Like the records above, these are easiest to read if you import them into Word and change the tildes to tabs.


Outdoor Records

char ~ name[20]; ~ 20 ~ 0

unsigned char ~ floor[48][48] ~ 2304 ~ 20

unsigned char ~ height[48][48]; ~ 2304 ~ 2324

short ~ terrain[48][48]; ~ 4608 ~ 4628


(a lot of deleted lines)


char ~ section_script[14]; ~ 14 ~ 12856

short ~ is_on_surface; ~ 2 ~ 12870

short ~ extra[10]; ~ 20 ~ 12872


Town Records


char ~ town_name[20]; ~ 20 ~ 0

short ~ respawn_monsts[4][6]; ~ 48 ~ 20

location ~ respawn_locs[6]; ~ 12 ~ 68


(a lot of deleted lines)


location ~ waypoints[10]; ~ 20 ~ 16314

short ~ exit_specs[4]; ~ 8 ~ 16334

short ~ spec_on_entry; ~ 2 ~ 16342

short ~ spec_on_entry_if_dead; ~ 2 ~ 16344


Size of Big_tr_type

Size of Big_tr_type ~ = 20480;

short ~ terrain[64][64]; ~ 8192 ~ 0

unsigned char ~ floor[64][64]; ~ 4096 ~ 8192

unsigned char ~ height[64][64]; ~ 4096 ~ 12288

unsigned char ~ lighting[64][64]; ~ 4096 ~ 16384


Size of Ave_tr_type

Size of Ave_tr_type ~ = 11520; ~ ~

short ~ terrain[48][48]; ~ 4608 ~ 0

unsigned char ~ floor[48][48]; ~ 2304 ~ 4608

unsigned char ~ height[48][48]; ~ 2304 ~ 6912

unsigned char ~ lighting[48][48]; ~ 2304 ~ 9216


Size of Tiny_tr_type

Size of Tiny_tr_type ~ = 5120; ~ ~

short ~ terrain[32][32]; ~ 2048 ~ 0

unsigned char ~ floor[32][32]; ~ 1024 ~ 2048

unsigned char ~ height[32][32]; ~ 1024 ~ 3072

unsigned char ~ lighting[32][32]; ~ 1024 ~ 4096


Town records have three different possible sizes.

Size of Town_record_type = ~ 16346

Size of Big_tr_type = ~ 16346 ~+ ~ 20480 ~=~ 36826

Size of Ave_tr_type = ~ 16346 ~+ ~ 11520 ~=~ 27866

Size of Tiny_tr_type = ~ 16346 ~+ ~ 5120 ~=~ 21466

Link to comment
Share on other sites

For the record, it's probably not worth going into all this detail, since all this information is in the editor code for anyone who wants it badly. (And I suspect that not too many will, really.)


As to compiling on Windows, I don't really remember what I did, I'm afraid, but it seemed pretty simple at the time.

Link to comment
Share on other sites

As I said, I see no way to attach a file to any post. At some point I will have to upload something to my site and insert a hyperlink. In the meantime I have trimmed the posts above. The unexpurgated listings of the various records might clarify which parts of a scenario are being wrecked. In the hex editor I noticed that the outdoor signs parts are being filled with junk.


If you have the time, try recompiling the 3D code, that would be a blessing to all Windows users if it worked. We could then all have our own home - brewed editors, just like the Mac users. I suspect that it is simply language dependent features connected with Linux.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...