richardbiely / Voxelmetric

An efficient voxel framework for Unity3d
GNU General Public License v3.0
158 stars 27 forks source link

DLL Architechure Issue #48

Closed jaspercayne closed 7 years ago

jaspercayne commented 7 years ago

With a fresh import of the repo, I get the usual errors with the Editor folder (maybe it's time to just remove it entirely since it has never been touched) but also a few new complaints from Unity:

Failed to load 'Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Plugins/FastNoise.dll', expected x64 architecture, but was x86 architecture. You must recompile your plugin for x64 architecture.
Voxelmetric.Code.Utilities.Noise.NoiseWrapperSIMD:.ctor(String) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Utilities/Noise/NoiseWrapperSIMD.cs:25)
Voxelmetric.Code.Utilities.Noise.NoiseWrapperSIMD:.ctor(String) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Utilities/Noise/NoiseWrapperSIMD.cs:18)
TerrainLayer:BaseSetUp(LayerConfig, World, TerrainGen) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/Layers/TerrainLayer.cs:39)
TerrainGen:ProcessConfigs(World, String) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:60)
TerrainGen:Init(World, String) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:28)
TerrainGen:Create(World, String) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:17)
Voxelmetric.Code.Core.World:StartWorld() (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Core/World.cs:102)
Voxelmetric.Code.Core.World:Start() (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Core/World.cs:53)
Failed to load 'Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Plugins/FastNoise.dll', expected x64 architecture, but was x86 architecture. You must recompile your plugin for x64 architecture.
Voxelmetric.Code.Utilities.Noise.FastNoiseSIMD:.ctor(Int32) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Utilities/Noise/FastNoiseSIMD.cs:55)
Voxelmetric.Code.Utilities.Noise.FastNoiseSIMD:.ctor(Int32) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Utilities/Noise/FastNoiseSIMD.cs:54)
Voxelmetric.Code.Utilities.Noise.NoiseWrapperSIMD:.ctor(String) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Utilities/Noise/NoiseWrapperSIMD.cs:18)
TerrainLayer:BaseSetUp(LayerConfig, World, TerrainGen) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/Layers/TerrainLayer.cs:39)
TerrainGen:ProcessConfigs(World, String) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:60)
TerrainGen:Init(World, String) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:28)
TerrainGen:Create(World, String) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:17)
Voxelmetric.Code.Core.World:StartWorld() (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Core/World.cs:102)
Voxelmetric.Code.Core.World:Start() (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Core/World.cs:53)
DllNotFoundException: FastNoise
Voxelmetric.Code.Utilities.Noise.FastNoiseSIMD..ctor (Int32 seed) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Utilities/Noise/FastNoiseSIMD.cs:54)
Voxelmetric.Code.Utilities.Noise.NoiseWrapperSIMD..ctor (System.String seed) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Utilities/Noise/NoiseWrapperSIMD.cs:18)
TerrainLayer.BaseSetUp (LayerConfig config, Voxelmetric.Code.Core.World world, .TerrainGen terrainGen) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/Layers/TerrainLayer.cs:39)
TerrainGen.ProcessConfigs (Voxelmetric.Code.Core.World world, System.String layerFolder) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:60)
TerrainGen.Init (Voxelmetric.Code.Core.World world, System.String layerFolder) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:28)
TerrainGen.Create (Voxelmetric.Code.Core.World world, System.String layerFolder) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:17)
Voxelmetric.Code.Core.World.StartWorld () (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Core/World.cs:102)
Voxelmetric.Code.Core.World.Start () (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Core/World.cs:53)

If I look at line 132 of FastNoiseSIMD where error is originating from, the precompiler is seeing my setup as 32 bit and ignoring the use of the 64 bit DLL. If I just change line 132 to point at "FastNoise_x64" instead, I can enter play mode just fine, but the terrain generator is clearly doing something seriously wrong... http://imgur.com/a/zfh4U I tried fiddling with the Unity settings for both DLL files, but it looks like this is actually an architecture problem, and I'm unsure if the generator or FastNoise is the issue since I cannot check the DLL that seems to be generating the problematic terrain.

XeonG commented 7 years ago

probably not a fresh import at all.. things got changed.. your project folder has old files in it that are being picked up, so do a proper fresh import.

though you'll find there are other problems with the commit log as of 479 still has some other problems... but nothing to do with the dll issue you have.

jaspercayne commented 7 years ago

Thanks for your concern, but it is a clean project, I'll never import anything into an existing directory. Secondly, I've repeated the issue numerous times now across multiple projects, yet it always results in the same. The plugin is not properly detected as 64 bit, and unity throws an error about it. If I rewrite that one line, it will load the 64 bit named dll as 32 bit, but the terrain generation is still all kinds of wrong. I can clearly see a pattern to what it wants to do, but the chunks seem to be getting rotated. If I try to place/break blocks in the world, I get wrong coordinates from the block it should have been.

On Tue, Apr 25, 2017, 4:38 AM XeonG notifications@github.com wrote:

probably not a fresh import at all.. things got changed.. your project folder has old files in it that are being picked up, so do a proper fresh import.

though you'll find there are other problems with the commit log as of 479 still has some other problems... but nothing to do with the dll issue you have.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/richardbiely/Voxelmetric/issues/48#issuecomment-296960465, or mute the thread https://github.com/notifications/unsubscribe-auth/AGHiBad9mbsZ7h14uNs-55oZS6qcXJ5Sks5rzbEDgaJpZM4NGj7J .

XeonG commented 7 years ago

dunno then.. os?, unity version?
as its working here.. there was a unity 5.6 version that had some issues with .dll files but pretty sure it was fixed for final release

richardbiely commented 7 years ago

Jaspercayne, you're a problematic one :) I think the reason why the project never works for you out-of-the-box is that you're always a version of Unity3D behind.

As for the SIMD library - don't use it. It's experimental and just for my testing purposes for now. That's why you have to manually enable it by removing DISABLE_FASTSIMD macro.

Even though I can't reproduce your issue, just to be sure, I completely disabled FastNoiseSIMD when running the project without DISABLE_FASTSIMD.

jaspercayne commented 7 years ago

I swear I updated unity like a month ago! But yes, I've generally been a version behind... I saw mention of the fast noise switch but couldn't find where to actually disable it. I'm by no means asking for full documentation, but maybe a quick write up about where to find key flags that might be toggled by the user? I know you are aiming to make the framework very "all encompassing" with lots of options a user can click on and off at will, but the sheer scope of the engine is making it difficult to track down one small item here and there. Not so much proper documentation I guess, but more of a cheat sheet to find your way through the code base?

On Wed, Apr 26, 2017, 1:50 AM Richard Biely notifications@github.com wrote:

Jaspercayne, you're a problematic one :) I think the reason why the project never works for you out-of-the-box is that you're always a version of Unity3D behind.

As for the SIMD library - don't use it. It's experimental and just for my testing purposes for now. That's why you have to manually enable it manually by removing DISABLE_FASTSIMD macro.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/richardbiely/Voxelmetric/issues/48#issuecomment-297244781, or mute the thread https://github.com/notifications/unsubscribe-auth/AGHiBZfBMLCGyk52NHCYSV0t9vUHDLftks5rztsPgaJpZM4NGj7J .

richardbiely commented 7 years ago

When it comes to configuration, the only project file that should be of a user's interest is Config.cs.

This macro is something set via Unity3D's editor in your player settings and it is there for my personal use only (for now). Therefore, I do not find it important for anybody else to know about it :)

A cheat sheat will be available in time. But the interface has to stabilize first.

Personally, I don't find Voxe(lmetric) that big. Quite the opposite, I find it rather small. I usually don't have trouble orienting myself in a code of this size after a while so I really believe that anybody willing to spend some time with the code should be able to understand it quite well.

jaspercayne commented 7 years ago

So I grabbed a fresh copy of the repository, fired up Unity, and when I hit play I still get the exact same thing. DLL file is not compiled for the correct architecture and DLL not found "FastNoise". If I change that line in FastSIMD again, I once again get the same results of the editor starting the scene, but the terrain is all rotated incorrectly.

DllNotFoundException: FastNoise
Voxelmetric.Code.Utilities.Noise.FastNoiseSIMD..ctor (Int32 seed) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Utilities/Noise/FastNoiseSIMD.cs:54)
Voxelmetric.Code.Utilities.Noise.NoiseWrapperSIMD..ctor (System.String seed) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Utilities/Noise/NoiseWrapperSIMD.cs:18)
TerrainLayer.BaseSetUp (LayerConfig config, Voxelmetric.Code.Core.World world, .TerrainGen terrainGen) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/Layers/TerrainLayer.cs:39)
TerrainGen.ProcessConfigs (Voxelmetric.Code.Core.World world, System.String layerFolder) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:60)
TerrainGen.Init (Voxelmetric.Code.Core.World world, System.String layerFolder) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:28)
TerrainGen.Create (Voxelmetric.Code.Core.World world, System.String layerFolder) (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Configurable/TerrainGen.cs:17)
Voxelmetric.Code.Core.World.StartWorld () (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Core/World.cs:132)
Voxelmetric.Code.Core.World.Start () (at Assets/Voxelmetric-alpha_3/VoxeUnity/Assets/Voxelmetric/Code/Core/World.cs:53)

It looks like FastNoiseSIMD is still getting called in TerrainLayer.cs a few times. Once I added the "or UNITY_EDITOR_WIN" check to each precompiler line (16, 25, 38), the scene will load without attempting to call FastNoise. There is still a problem with chunk rotations, but the scene will actually load in a fresh project now.

EDIT: Quick update after fiddling around a bit: There does not appear to be any actual rotation issues going on, things are not being correctly rendered and it is causing chunks to appear out of place. Textures are also being stretched pretty badly in these ghost chunks, but if I can find an area open enough to see what I am doing, the blocks themselves are rendering perfectly.

XeonG commented 7 years ago

yeh so I just recently for this dll error while updating my game project to the latest commit...

just needed to go into the player settings and add "DISABLE_FASTSIMD"

richardbiely commented 7 years ago

I changed !DISABLE_FASTSIMD to ENABLE_FASTSIMD. This should fix the issue: a9268becaa23b85db5ac1080dfd032f7a881b5d8