Ambermoon.net icon indicating copy to clipboard operation
Ambermoon.net copied to clipboard

[Project] Ambermoon bugfix patches

Open Pyrdacor opened this issue 4 years ago • 322 comments

The goal is to create a stable patched Ambermoon version in german and english. We focus on the english patch for now.

Pyrdacor avatar Oct 31 '20 07:10 Pyrdacor

I decided to first add writers for all game objects like monsters, NPCs, texts, etc. I partially need this anyway to save Ambermoon.net games back to original savegames.

With those writers and the existing readers you can then do the following in code very easily:

  • Load a monster
  • Change a monster value
  • Save the monster

Combined with a decompressor/compressor and archive loader/writer this should allow for easy editing whole game files like "Monster_char_data.amb".

The archive loader and writer functionality is already there with decompression and compression support.

So when I finish the game object writers (which isn't too hard), the game data patching should be very easy.

Pyrdacor avatar Oct 31 '20 09:10 Pyrdacor

The implementation of the writers will be tracked here: #53

Pyrdacor avatar Oct 31 '20 10:10 Pyrdacor

@a1exh I will keep you up to date regarding data writer implementation status. Afterwards I'll need your support to fix those bugs and create a patch.

Pyrdacor avatar Oct 31 '20 10:10 Pyrdacor

Sounds good. I'll try to make some diff files for the more obscure bug fixes to help satisfy my curiosity

a1exh avatar Oct 31 '20 10:10 a1exh

@a1exh The character writers are ready (monsters, NPCs, party members) and the text writers too. So we could start fixing. Items will be much harder though, but maybe the first patch version could just fix characters and texts. Map writers are missing too but map texts can be fixed already.

Pyrdacor avatar Nov 02 '20 06:11 Pyrdacor

Object_texts.amb sub-file 001.amb this file has a bug in it where it uses the word "GRANDSON" regardless of the gender of the main character. In my bugfix I change the text to "GRANDCHILD". I think I didn't know if there was a scripting special markup gender specific code e.g. ~ SEX1 ~ (HE/SHE) AND ~ SEX2 ~ (HIS/HER) for things like this. But I don't think there anything as specific as SON/DAUGHTER

a1exh avatar Nov 03 '20 09:11 a1exh

v1.07 has an issue where if you're flying/sailing near the coordinates [0,0] (might be [1,1]) that there is a reference to a missing text block in 1Map_texts.amb that causes the Amiga version to crash. This was patched in two different ways, Metallic fixed it by adding a dummy text block 001.amb into 1Map_texts.amb so that it didn't crash. Meynaf said he removed the reference to the missing text block but he didn't say where or how he did this. The Meynaf patch doesn't modify 1Map_data.amb. I'd be curious to know what the underlaying cause of this is and how Meynaf patch works.

a1exh avatar Nov 03 '20 09:11 a1exh

I've been working for years on the list of bugfix patches for v1.07

https://docs.google.com/spreadsheets/d/1as5W8gibm-MTb9VEqpkfgtwWviqjQx96A3NmcvzX98A/edit?usp=sharing

The "sub-filename" number is the one produced using the Amiga tool by Metallic "ExtractAmb" to split files into their components.

Most bugs have two sub-files to DIFF to see the changes (however the files sometimes contain fixes for more than one bug)

You can sort the spreadsheet using the filename column to put them into file order.

I'm going through on a file-by-file basis starting with v1.07, Party_char.amb.

If I am going too slow for you then for v1.07 take a look at the modified version by Meynaf

http://meynaf.free.fr/pr/amberpatch.lzx

The patch is not comprehensive (there are known fixable bugs he didn't fix and at least one with a mistake) and it contains fixes not detailed in the list of fixes in the text file included in the archive.

And for v1.05 take a look at the modified versions by Daniel Schulz

http://slothsoft.net/getResource.php/amber/patch/Ambermoon.v1.06.zip

I don't know much about v1.05 as I don't read German but I believe he's fixed most (all?) of the common bugs between v1.07 and v1.05. He has a list v1.05 bugs albeit not down to the specific bytes :

http://slothsoft.net/Ambermoon/EditorHelp/ (look at the section : MIR BEKANNTE BUGS IN AMBERMOON)

a1exh avatar Nov 03 '20 09:11 a1exh

If you don't know in which file a bug may be located, feel free to ask. I am very familiar to the internal data structures and their relations already.

Where are the real opening times of all the shops stored? Lots of them have the wrong opening times in the v1.07 text blocks. Most have patches where people have worked out "in-game" the real opening times, but one or two remain. For example 2Map_texts.amb sub-file 119.amb ALCHEMISTS TOWER - "ALCHEMISTIC ACCESSORIES^ OPEN FROM 8 AM TO 8 PM" but I have bug reports it wasn't open when they visited at 18:45

a1exh avatar Nov 03 '20 09:11 a1exh

Object_texts.amb sub-file 001.amb this file has a bug in it where it uses the word "GRANDSON" regardless of the gender of the main character. In my bugfix I change the text to "GRANDCHILD". I think I didn't know if there was a scripting special markup gender specific code e.g. ~ SEX1 ~ (HE/SHE) AND ~ SEX2 ~ (HIS/HER) for things like this. But I don't think there anything as specific as SON/DAUGHTER

No there is only he/she and his/her. So I guess grandchild is a good solution.

Pyrdacor avatar Nov 03 '20 10:11 Pyrdacor

v1.07 has an issue where if you're flying/sailing near the coordinates [0,0] (might be [1,1]) that there is a reference to a missing text block in 1Map_texts.amb that causes the Amiga version to crash. This was patched in two different ways, Metallic fixed it by adding a dummy text block 001.amb into 1Map_texts.amb so that it didn't crash. Meynaf said he removed the reference to the missing text block but he didn't say where or how he did this. The Meynaf patch doesn't modify 1Map_data.amb. I'd be curious to know what the underlaying cause of this is and how Meynaf patch works.

In general text popups are triggered by specific map events. They are stored inside the map data. It is possible to fix the text index or remove the event. But if Meynaf didn't change the map data file this is strange. Another possibility are NPCs. They also can use map texts in some cases. But I don't think there is an NPC on that map.

Pyrdacor avatar Nov 03 '20 10:11 Pyrdacor

If you don't know in which file a bug may be located, feel free to ask. I am very familiar to the internal data structures and their relations already.

Where are the real opening times of all the shops stored? Lots of them have the wrong opening times in the v1.07 text blocks. Most have patches where people have worked out "in-game" the real opening times, but one or two remain. For example 2Map_texts.amb sub-file 119.amb ALCHEMISTS TOWER - "ALCHEMISTIC ACCESSORIES^ OPEN FROM 8 AM TO 8 PM" but I have bug reports it wasn't open when they visited at 18:45

The opening times are stored in the map events of each map. Only hours are stored. There are two places in Alchemists Tower: a merchant (sells goods) and a library (sells spell scrolls). In my current data the following open times are set for them:

  • Merchant: 8-18 (8am to 6pm)
  • Library: 8-20 (8am to 8pm)

Pyrdacor avatar Nov 03 '20 12:11 Pyrdacor

Thanks. I can change the text and move this bug to the FIXED page.

a1exh avatar Nov 03 '20 12:11 a1exh

@a1exh I don't know if this bug was reported before but I found something during battle testing in original:

If you choose to attack a nearby monster with a close-ranged weapon (e.g. Scimitar) and then open the inventory and exchange this weapon with a long-ranged weapon (e.g. Crossbow) you will be able to attack with the long-ranged weapon without consuming ammunition. Moreover the symbol for close-ranged attack is displayed near the portrait.

Pyrdacor avatar Dec 01 '20 08:12 Pyrdacor

Thanks this has never been reported. Is it 100% reproducible?

a1exh avatar Dec 01 '20 09:12 a1exh

Daniel Schulz has noted two semi-related things

  1. Magic Bolts require 0 hands and so can be combined with a 2-handed weapon to give enchantment bonus of attack +15

  2. Sling Knife and Sling Dagger have an attack value even though they are ammunition and therefore you should equip rather than a shield

It is not obvious if these are bugs or as intended.

a1exh avatar Dec 01 '20 09:12 a1exh

Thanks this has never been reported. Is it 100% reproducible?

I only tested with german v1.01 (22-11-1993). But with this version it is reproducible.

Pyrdacor avatar Dec 01 '20 09:12 Pyrdacor

@a1exh Found another minor bug. The spell Blink is cast on a friend to teleport him in battle. But if the friend moves before the spell is cast, a message like " has been blinked" is shown. So there is no character name. I guess the game looks at the spot for a character but does not find one anymore. The character is not blinked of course.

I would expect one of the following:

  • Blink the moved character
  • Let the spell fail and show a message about it

I decided to implement the "fail message" in Ambermoon.net. It is a bit odd but in Ambermoon even support spells like Healing can miss if the character has moved before casting. So I added this behavior to Blink as well to be consistent. It is kind of a game mechanic. You have to consider speed when casting supportive spells and maybe have to increase the Speed attribute of supportive members like Healers and Alchemists.

Pyrdacor avatar Jan 08 '21 09:01 Pyrdacor

@a1exh I wonder if someone already reported this but you can create a character with an empty name. In this case no name is shown in inventory, at the top portrait and in conversations.

Pyrdacor avatar Jan 29 '21 13:01 Pyrdacor

No one has mentioned it. But it is not really a bug unless it causes crashes due to string length errors etc? No?

a1exh avatar Jan 29 '21 13:01 a1exh

True. I don't know if this can cause problems in some situation but even if, this wouldn't be much of a problem as you can just pick a valid name. ;)

Pyrdacor avatar Jan 29 '21 14:01 Pyrdacor

Bug: when the monster ai is determining which spell to cast and on which target, there is a bug in the row spell targeting:

        0023c23a 72 00           moveq      #0x0,D1
        0023c23c 74 00           moveq      #0x0,D2
        0023c23e 76 00           moveq      #0x0,D3
        0023c240 7e 18           moveq      #0x18,D7
                             LAB_0023c242                                    XREF[1]:     0023c258(j)  
        0023c242 0f 00           btst.l     D7,D0
        0023c244 67 0a           beq.b      LAB_0023c250
        0023c246 26 52           movea.l    (A2)=>battlefield.fields[24],A3                  = null
        0023c248 36 2b 00 22     move.w     (0x22,A3),D3w
        0023c24c d2 83           add.l      D3,D1
        0023c24e 52 42           addq.w     #0x1,D2w
                             LAB_0023c250                                    XREF[1]:     0023c244(j)  
        0023c250 58 8a           addq.l     #0x4,A2
        0023c252 52 47           addq.w     #0x1,D7w
        0023c254 be 7c 00 18     cmp.w      #0x18,D7w
        0023c258 6b e8           bmi.b      LAB_0023c242
        0023c25a 4a 42           tst.w      D2w
        0023c25c 67 02           beq.b      LAB_0023c260
        0023c25e 82 c2           divu.w     D2w,D1

The loop ends when D7 is > 0x18, but it is set to that value at the loop's start and then only incremented, so the loop will always exit after 1 pass. 0x18 is 24, the index of the first field in the lowest row on the battlefield. The loop calculates the avarage last damage and is probably copied from a one before it, which does the same for the row above it. Then they forgot to change the exit condition...

I think changing

0023c254 be 7c 00 18     cmp.w      #0x18,D7w

to

0023c254 be 7c 00 1e     cmp.w      #0x1e,D7w

should be enough to fix it.

kermitfrog avatar Feb 11 '21 14:02 kermitfrog

Even though this might technically be a bug i would hesitate fixing this in the original Amiga Version as it could change the Gameplay significantly.

Thallyrion avatar Feb 11 '21 14:02 Thallyrion

At least we should add it to a bug list so that it is documented. Maybe someone wants to release some advanced version later with better balancing and fixed mechanics. Some things in Ambermoon feel quiet buggy or out of balance. Some of those might just be small bugs in the code like this one.

Pyrdacor avatar Feb 11 '21 15:02 Pyrdacor

@a1exh Found another bug in original. When you buy items you store them in a temporary item grid. This grid has 4x6 slots (same amount as the merchant). But the merchant can stack all items. For example the merchant in Spannenberg sells 15 sandals as one stack. Sandals can't be stacked otherwise (inventory, chests, etc). This is also true for the temporary item grid. Sandals can't be stacked there.

This way you can fill the temporary item grid with more than the 24 items. And when you do so the game stops to react to any input. The only thing that still works is the mouse cursor.

So to reproduce the bug go to the merchant in Spannenberg and buy more than 24 non-stackable items (e.g. Robe, Leather shoes and sandals). Then the game should stop reacting.

A possible fix would be to steps:

  • Disable the "buy" button when the temporary item grid already has 24 items
  • Limit the amount you can choose from the "amount input box" for unstackable items to the amount of free slots in the temporary item grid

This is also the way I implement it in Ambermoon.net.

Pyrdacor avatar Feb 15 '21 10:02 Pyrdacor

Another bug or feature? is about the elven harp. When you give the 7 crystal strings to Matthias the harper you get the crystal harp even without having bought the elven harp before. I guess this is a bug as the conversation states that he takes the strings AND the elven harp from you to make the crytal harp.

Thallyrion avatar Feb 15 '21 15:02 Thallyrion

This can be fixed easily inside the NPC data by adjusting the conversation events.

Pyrdacor avatar Feb 15 '21 16:02 Pyrdacor

I also think this is a bug. @a1exh should add this to the bug list. I can analyze the bugged data and provide a fix instruction.

Pyrdacor avatar Feb 18 '21 18:02 Pyrdacor

Thanks. I've added it to the bug database. The location is ILLIEN, HOUSE OF THE HARPER. The associated text is NPC_texts.amb sub-file 01D.amb

Please let me know if this affects both v1.07(Eng) and V1.01(Ger) and the exact details on the fix when you have them.

a1exh avatar Feb 19 '21 12:02 a1exh

A save-game with the 7 crystal harp strings nearby would be good for testing if anyone has one.

a1exh avatar Feb 19 '21 12:02 a1exh