Code Monkey home page Code Monkey logo

Comments (17)

Pyrdacor avatar Pyrdacor commented on May 23, 2024

This is strange. What version do you use? Do you build it yourself? Which version of the nuget packages for the libs do you use? Are they up to date?

from ambermoon.net.

Metibor avatar Metibor commented on May 23, 2024

The first screenshot is made with the unextracted ADF files from Ambermoon DE v1.01 and Ambermoon.net v1.0.6.
But I get the same wrong colors in my IDE with the extracted data files.

The second screenshot is made in the IDE with the extracted data files from the German v1.01 version and the changed lines.

Maybe we have different Palette files?
Name: Palettes.amb
Size: 3338 bytes (3 KiB)
CRC32: 0C459ADF
CRC64: 1E17431F840E6762
SHA256: BF4E4ADD5DCE5E26FCC055AA35494377F1E60155C56F976E06563116581758B1
SHA1: 61ACCBD13DD7AC5AEAD25B61ED7F5FD541D151F1
BLAKE2sp: DBD3A7982AF988F45BF63F5151E4E3EF111AAD7C9791F4B8B2DA3C622FAF2EAD
Hash values were created with 7-Zip

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

Strange. When I download the files you tried and linked (Ambermoon.net and the 1.01 zip) it all works fine. The palettes are correct.

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

Ah can you please edit or remove the file %APPDATA%\Ambermoon\ambermoon.cfg. It memorizes the path to the data if "UseDataPath" is set to true. So set this to false, or adjust to the correct "DataPath" or remove the file before starting the exe.

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

Also tell me which DataPath value there was before because this might be non-working data.

from ambermoon.net.

Metibor avatar Metibor commented on May 23, 2024

Sadly, I already tried different settings in ambermoon.cfg

This is a current screenshot with Ambermoon.net v1.0.6 and the ADF files from your v1.0.1 zip content (which is falsely claimed as 1.0.5 on the Thalion shrine website):
grafik

Before I also tried the English version, wich is working if you add

            { "Dictionary.english", 'G' },

in Ambermoon/AmbermoonTools/Ambermoon.Data.Legacy/Files.cs

I may be able to debug the loading of the Palette.amb file, but since you moved the handling to the other solution I'm having trouble to do that. How do you that exactly? Do you have an additional solution with all projects combined?
I am able to compile and use new Nuget packages from one solution , but don't know how to debug them from another solution, yet. I never had to debug nuget packages in Visual Studio before.

But maybe this helps:
On loading the map I have these values

Map.Index = 259  => GROSSVATERS KELLER
Map.PaletteIndex = 6

with my workaround it sets the values

floor.PaletteIndex = 5
ceiling.PaletteIndex = 5
wall.PaletteIndex = 5
mapObject.PaletteIndex = 5

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

Yeah I am also not very happy with the two solutions. I have a solution with all projects but most of the time I use a small console app to test stuff in the libs like loading maps. You can add the lib projects as a project reference. It will prefer the project even if the nuget package reference is also there.

I divided the projects as the libs should be useful for other projects and I plan to create some tools in the lib repo as well. This repo should focus on the engine and game logic.

I hadn't the time to test the palette indices. Sorry.

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

Good point about the english dictionary. Does the german version work with it added? If so you could maybe create a PR and I can merge it.

from ambermoon.net.

Metibor avatar Metibor commented on May 23, 2024

Thanks for the info regarding the solutions!

I was able to try out Ambermoon.net v1.0.6 with the v1.0.1 ADF files on my computer at work and it is working as expected (palette and also z order). This one is using a nVidia Quadro K620.
This is really strange.

I will try to do some debugging tomorrow.

The dictionary thing worked with the added line, but I removed it after the solution split and the added config file.
I will do the pull request if I can figure out the nuget thing. πŸ€”

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

I have the local repo folders next to each other. The problem aren't the solutions but the projects. Cause if you add the local project reference the project file changes and you can't check it in this way as the other project is in another project. Maybe you can clone the csproj files and create a new solution with the modified csproj that are not part of the version control.

Your PR has to be inside the other repo though of course.

I'll think of a better approach in the meantime.

from ambermoon.net.

Metibor avatar Metibor commented on May 23, 2024

I didn't have much time today, but I managed to do some debugging (in a combined solution).

The data should be correct.
Map 259 has PaletteIndex = 6 and the 6th Palette sub file inside Palette.amb is read into the Palettes dictionary with Key = 6 as you can see in the screenshot.

grafik

So in theory it should work on my computer, but somehow the colors are still wrong.
It seems on my side it is 0-based, because if I set PaletteIndex to 0 (which should be an invalid Key) it uses the first palette from Palettes.jpg
Which ironically is 0-based.

Could it be something with the Texture3DFragmentShader?
But I already cleaned my Shadercache under %appdata%\AMD\GLCache

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

I also think it's the shader. It uses floats for positions and reads from an image which contains all palette colors. So if the float value for y is a bit of it will read the wrong palette color. So maybe it's a shader precision issue. Maybe some kind of interpolation is used in the shader?

The shader reads with the palette index and color index (which is read from the texture with texcoords) inside the pallette image to get the right color. I guess it's some kind of interpolation or precision issue.

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

I could add more range to the palette image (not 1 pixel per color but 3x3 for example). Maybe this will safely resolve this.

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

I think I made a mistake as the shader expects the 0-based index. I changed the code to pass the right palette indices. So the error was on my end. It seems that the texture offsets were exactly on the edge and some hardware would choose the left/up and some the right/down pixel. At least this is my guess. I adjusted the shaders so that they add 0.5 to both the color index and palette index (which internally in the shader is a float but with the value of an integer). So the pixel coordinate should now be the same on each hardware. Can you please pull the current changes and retry 2D and 3D?

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

Ah about the english dictionary. I added it and updated the nuget package. You have to update your referenced package version locally and it should work with english data. Maybe you can check and let me know. Thanks

from ambermoon.net.

Metibor avatar Metibor commented on May 23, 2024

Yes, it's working now!

This is the line I came up with after some testing with the shaders:

wall.PaletteIndex = (byte)Map.PaletteIndex;

vec4 pixelColor = texture({DefaultPaletteName}, vec2((colorIndex + 0.5f) / 32.0f, (palIndex - 0.5f) / 51.0f));",

Which is basically the same as your solution

wall.PaletteIndex = (byte)(Map.PaletteIndex - 1);

vec4 pixelColor = texture({DefaultPaletteName}, vec2((colorIndex + 0.5f) / 32.0f, (palIndex + 0.5f) / 51.0f));",

The TextFragmentShader also uses palIndex and colorIndex. Text is not displeyed yet, but I think the correction is needed there too.

The English version works fine.

So this one can be closed. Thanks!

from ambermoon.net.

Pyrdacor avatar Pyrdacor commented on May 23, 2024

Oh I forgot the text shader. Thanks. Will fix it too.

I will stick to my solution as the renderer is designed to work with any data later and I like to work with 0-based stuff. Moreover it makes calculation easier most of the times. I stick to 1-based palette indices as the original data references it as 1-based.

from ambermoon.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.