SoA Source Code - Bugfixes

  • Continuied from: das POX datei format

    If the new pox-viewer will have an export-option, this would be an advantage. The old ones had a problem with exporting all frames. The first one was skipped evertime. Only solution: Screenshot of the first frame, select a rectancle with the same height and width as the other frames and then save it. Well... Makeable, but laborious.


    Reminds me a little bit of the problem with the rectancle and diamond-tiles in relation to the source code from github which I could solve.

    Export into what format(s)? multiple single images or spritesheets? BMPs, JPGs or PNG? Full set or per "action"?


    Could you elaborate on the problem rectangle/diamond-tiles - did I forget/miss something? (again :) )


    Thanks



    GitHub Source Code: https://github.com/SteveNew/Siege-of-Avalon-Open-Source

    • Offizieller Beitrag

    Each frame to bmp.


    That was something I mentioned a time ago: The first frame of the first Rectancle such as diamond-tile on each map wasn't displayed (just transparent). At this date I solved it: (Post #12) HD und FullHD Version zu Siege of Avalon (aus dem Source Code mit Delphi 4) (Post #12)

  • Sorry about that, will take a look. And the export.


    Edit:


    That was something I mentioned a time ago: The first frame of the first Rectancle such as diamond-tile on each map wasn't displayed (just transparent). At this date I solved it: (Post #12) HD und FullHD Version zu Siege of Avalon (aus dem Source Code mit Delphi 4) (Post #12)

    Yes, remember now - we also had a PM on that - I left the two lines in question from gondurs fork as comments - but I think the cause is something different - since assuming both index numbers are positive a mod would not return negative - and otherwise expecting negative result would then be very dependent on implementation of the programming language itself. The second line in question would always evaluate to false - but will see if I can reproduce the "bug" - I have not seen the "transparent" or any pink bug - after I fixed the menu quick. So I do not think my fork of the repo has these issues.


    Bmp export done btw. Curious on the need for the export - since I have no experience with SoA modding, I am just asking to learn - would that be for colour manipulation or just to have something as a basis for some new asset?

    • Offizieller Beitrag

    I just compiled the Code without my solution to take a screenshot (have a look at the attachment). On this test-map there's just dirt2A.pox as rectangle and darkdirt11.pox as diamond.

    The first frame of the rectangle dirt went pink because it's transparent. The first Layers are the rectangle ones. So under this there's just pink. Same with Darkdirt11.pox. There's a random combination of the frames. Every first Frame of the pox-File is transparent too.

    • Offizieller Beitrag

    This Code is the original one from Domenique Louis (CartBlanche). This problem existed before I invented HD and FullHD. This Bug is on every map, no exception. But of course I can upload this test-map here.


    I forgot to answer your question about exporting the frames from the pox-file. I made a few pox files based on original ones like rubylegplate.pox because there was no leg plate colorized ruby. So I needed the orinignal frames and edit them.

  • This Code is the original one from Domenique Louis (CartBlanche). This problem existed before I invented HD and FullHD. This Bug is on every map, no exception. But of course I can upload this test-map here.

    Oh it seems I am missing:


    spriteobject\character\targetable\invistrigger

    staticobject\props\campfire

    staticobject\props\logbench5

    staticobject\props\logbench6


    Are they from one of the other chapters? Then I have them somewhere.

    I forgot to answer your question about exporting the frames from the pox-file. I made a few pox files based on original ones like rubylegplate.pox because there was no leg plate colorized ruby. So I needed the orinignal frames and edit them.

    That was what I guessed could be one of the uses - what about having the possibility to change colors - within the POX viewer/editor - then it can be done in one step and not for each exported bmp frame.

  • I think it's Chapter 2 and 4. Anyway... Attachment!

    Thanks! I did just test this on two machines - with different graphic cards - Intel and Nvidia - on the source from "my" version of the source code - no error or glitches. See attachments - I did also try in FullHD more on my HighDPI suerface. Converted bmp to jpg to be able to upload.


    So - my guess is:

    1. Graphic card AMD issue?

    2. Or the nasty "magenta" issue - I fixed in connection to the menus. The "transparent" magenta is ( on purpose? ) set a bit off in the original code you use.


    I put my money on number 2 :)


    This has to me nothing to do with drawing calculation we talked about. I need to run some errands - but will be back with the piece of code that has the "wrong" color code.

    • Offizieller Beitrag

    I get the same picture like U with the changings I mentioned (Maxindex...). I've tested it too on two Pcs (AMD and Nvidia). Same issue, or even worse...

    I can't finde any code pointing to transparentcolor := FC04FC in my code.

    By the way: Did you already tested some flickering-action from the "bulbs" ingame? Only "none" works everything other get some pink-bug.

  • Rucksacksepp I owe you some money (or beer) - you are right the $FC04FC issue was only relevant for the menus - and since you redid those, you did not have the issue.


    As you also describe in the thread when you fixed it - this is an calculation error - I would argue that these to lines are sufficient:


    X := ( FTileMaxIndex div FTileMaxColumnIndex ) * FMap.FTileWidth ; // fix by rucksacksepp

    Y := ( FTileMaxIndex mod FTileMaxColumnIndex ) * FMap.FTileHeight;


    And that the condition below in this context always ends up false - so they could just be removed:


    if ( ( FTileMaxIndex mod FTileMaxColumnIndex ) < 0 ) and ( FTileMaxIndex > 0 ) then // fix by rucksacksepp

    inc( X, FMap.FTileWidth );


    I was not able to reproduce the errors myself (is any xref.db involved, I only use the one from chapter 1?) - but I have now included you corrections - as shown above - thanks!!


    I should just listen to your experience, and stop arguing. And the prof is that your code fixed the problem - cant argue with that :D.


    What did you mean about:

    Did you already tested some flickering-action from the "bulbs" ingame? Only "none" works everything other get some pink-bug.

    - sorry for all the stupid questions - but I lack the years of experience of the game and modding SoA - and a picture might explain better?


    BTW: Have you ever seen the use of animated cursors in the game? Some code is included, by seems never to be called - noticed when I redid the cursors in SDL2.

    • Offizieller Beitrag
    Zitat von Stevenew

    And that the condition below in this context always ends up false - so they could just be removed:

    A short testing shows that your right...


    I involved the old Xref.db from Chapter 1 - 6. There was a new one with some changes which is uploaded to on github instead of the old one.

    There was a pink-bug patch where some transparent colors were pink instead of transparent. A new executable was made where a new xref.b was involved. I wanted to keep the old one to avoid editing my xref.db, so I changed this:

    Have a look at the attachment. You can also test a map where I added a "bulb" (lightsymbol) on this map with a property called flickering set to "torch".

    I tried to fix that but this time I couldn't find a way...

  • Thanks for moving the thread!


    I need to get into what the xref.db is used for - seems to add some "value" (irony applied) - will put it on the list :)


    The variations in the version of the xref.db explains - I would try and actually support both, and adjust the transparent base on need - if doable. I initially use the files that were posted on GitHub (what I meant by Chapter1 - since they were publicly released) - being naive and thinking that they were the latest and greatest.


    I will take a look at the bulb issue - hopefully tomorrow.


    In regards to the code sample - I will start to argue again ;)


    Pos(substring, string) finds the position where substring is found within string - so not found returns 0.


    If the idea with the code is to find the XRefDB field index of the field value that contains the "NakedName", then your suggestion will not work, since

    Code
    Pos( S1, lowercase( S ) ) >= 0

    will always evaluate to true and leave(break) the while loop - with XRefIndex=1, so

    Code
    if XRefDB.FindRecord( 'Base' ) then XRefIndex := 1;

    would end up doing the same thing.


    Which could be OK - if you are sure the first element is what you want. I ended up with a female character, wearing men's cloths - as I remember it - seems to be the xref.db versions are playing trick on us - again. I use the female character as default. Result with the above change and the GitHub xref.db - when using a female character.


    Is this not down to a question of supporting various retail SoA (and Mods) versus released SoAOS files. Then I need to get some test scenarios setup - covering all? Or can we reduce the scenarios?

    • Offizieller Beitrag

    Xref.db is for handling one item to each Character like Male, Female, Skeleton, etc.

    If I use the old Xref.db with the new Code in the Source code no clothing will be painted ingame. That's why I changed the Code. I can remember now, why I changed the Source Code and not the Xref.db. My aim was to get a new Siege.exe working without changing anything in Siege of Avalon. That's why I redid the old mainmenu, too.


    You're right, so I could just remove that line

    Code
    while S <> '' do
    begin
    if Pos( S1, lowercase( S ) ) > 0 then // to: if Pos( S1, lowercase( S ) ) >= 0 then
    break;
    inc( XRefIndex );
    S := XRefDB.Fields[ XRefIndex ];

    and I will get the same result. If other Characters are used, I need this line but have to change the Xref.db too. Seems like I have to change that line:

    Code
    Base|BaseHumanMale.gif|BaseHumanFemale.gif|BaseSkeleton.gif|BaseAhoul.gif|BaseDwarfMale.gif|

    to:

    Code
    Base|HumanMaleLayers\BaseHumanMale.gif|HumanFeMaleLayers\BaseHumanFemale.gif|and so on...

    My conclusion: Changing character wasn't first planed in the original version of SoA.

    Of course u can use the new version of the Source Code in parts.pas if the new Xref.db is included in the "upgrade".


    The flickering bug wasn't in the original executeable. I would be interested in your version/executable if there's this bug too. But no rush. There's much time.

  • The flickering bug wasn't in the original executeable. I would be interested in your version/executable if there's this bug too. But no rush. There's much time.

    Well I did spend much time in Anigrp30.pas - not a place you want to be :)


    Partly solved - and I found the cause - remove the part I put in comments from TAniView.CopyTile:

    There goes the pink rectangle - and the "lighting" is drawn correct - non-animated :(


    Now try to walk into the lighting area - your character is still rendered correct - now turn on x-ray - should match attachment.


    The problem is that single tiles are refreshed - apart from when x-ray is turn on - then RefreshRegion (rendering a bigger area) is called, so to fix this nicely:

    1. Figure out if any TLightZone is present/visible, calculate the region needed to refresh and call RefreshRegion.

    2. The CampFire should behave like a LightZone on the tiles - does behave correctly on characters.


    So the "bulb" and the campfire is consistent now - RefreshRegion is only called once - where having x-ray active.


    I will leave it with this for now - need to throw some code out before I venture into Anigrp30.pas again.

    • Offizieller Beitrag

    Well I was in there too because of the rectangle and diamond-bug. For me the worst part is when we're going to assembling code (move eax and so on)... No chance.


    Anyway: Thanks for finding this. After testing I have to say it's much nicer when flickering details are just drawn on spriteobjects. But one problem: Staticobjects are now invisible in that area.

    Maybe it would be easier to deactivate the re-rendering on lights with Xray-On around the character and enabled re-rendering on staticobjects.Well it's not that important so no need to fix this now.

    Btw: In the original executable of SoA, flickering works correctly.

  • Well I was in there too because of the rectangle and diamond-bug. For me the worst part is when we're going to assembling code (move eax and so on)... No chance.

    I know :) - the worst part is the digiFX stuff - blackbox - with no source for the DLLs. But I hope we are mostly past that bit now. I will transform the asm into pascal - so that we can read it - and don't think it has any mayor impact on performance - mostly color manipulation what I have noticed.

    Staticobjects are now invisible in that area.

    The Staticobjects should only be invisible when x-ray is active - no change there - that I am aware of.

    Maybe it would be easier to deactivate the re-rendering on lights with Xray-On around the character and enabled re-rendering on staticobjects.Well it's not that important so no need to fix this now.

    The whole rendering part in SoA is still mostly uncharted territory on my part - so good idea to leave as-is for now.

    Btw: In the original executable of SoA, flickering works correctly.

    Yes I started out testing the map with DTMain.exe from 2001, I think they removed it due to performance - or pink issues :D


    BTW:

    I would like to test how "compatible" a new build is, when I do some changes - what versions of the old .exe should I try to "replace"? The DTMain.exe I used has the stupid thing about a Maps subfolder. And it would be great in the future to include AoA.exe as well - if you do not mind.

    • Offizieller Beitrag

    What do u mean with "version of the old .exe"?
    Which maps-subfolder?


    Did I understood you right, that you want to build only one executable with every function in every mod but no swapping. So something like this: Ashes has the option to activate hardmode in a new game and Siege doesn't have.

  • What do u mean with "version of the old .exe"?
    Which maps-subfolder?

    I use:

    DTMain1.exe version 1.1.2001.1104 - which I guess is from the free Chapter1 from http://soaos.sourceforge.net/

    Siege.exe 1.1.2001.409 - which I guess is from the code on sf/github.

    ...then there are patches applied.

    I also have an seal copy of the GameStar set - but I wont open that :)

    MadSc repo build

    My own builds


    - So the question is - if I want to make my build "compatible" - so that you just can replace the old DTMain1.exe/Siege.exe - what "distributions/versions" do I need to test/support?


    One of the above has a bug - were it needs an extra Maps folder to write to.

    Did I understood you right, that you want to build only one executable with every function in every mod but no swapping. So something like this: Ashes has the option to activate hardmode in a new game and Siege doesn't have.

    Yes - most of the settings are controlled by the siege.ini anyway - I did added a few - but if they do not exists, it just works as the original. I had prepared for localized keymapping, your adjusted XP rules and also loading of extra resources/layers - Golem, IceBlock and Tabar - if I remember correct.


    I starting throwing a lot of code out - so when reorganizing - I think it could be done fairly flexible - the resources know which layers/actions the have already.


    The reason that I eventually would prefer to move down that route, is that we get things fixed in one "engine" - instead of we all have various variations of the engine - the assets, story and data should give the variation. But it is not something that is done by next week :D

    • Offizieller Beitrag

    I think the Version which should be replaced would be version 1.1.2001.1106. This is the one from SoAmigos patch and the original Anthology updated version. (Chapter 1-6)

    But if your aim is to replace the one from free Chapter 1 then it's just the version from Chapter 1. (You dont say...)

    Zitat von Stevenew

    One of the above has a bug - were it needs an extra Maps folder to write to

    I didn't have seen this before.


    "XP" means trainingpoints?

    The problem is that for example if AoA uses a new cast like Bloodlust, the Engine needs to load the pox file Bloodlust.pox. If the original SoA hasn't this pox file you cannot use the new .exe without adding the new poxfiles. Not that easy. ->A lot of work...