Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.61k stars 245 forks source link

Compile Error on Godot 3 (master) related to PoolVector #12

Closed HummusSamurai closed 7 years ago

HummusSamurai commented 7 years ago

The issue with opensimplex (https://github.com/Zylann/godot_opensimplex/issues/2) was solved by the PR (thanks @Xrayez), and Godot now compiles with opensimplex.

However now I get the following error when compiling voxel with Godot 3 master, both when compiling with the opensimplex module and alone.

modules/voxel/voxel_mesher_smooth.cpp: In function 'void copy_to(PoolVector&, Vector&)': modules/voxel/voxel_mesher_smooth.cpp:54:2: error: need 'typename' before 'PoolVector::Write' because 'PoolVector' is a dependent scope PoolVector::Write w = to.write(); ^~~~~

Full pastebin of the errors: https://pastebin.com/UnXu7g6R

I think I saw a discussion about PoolVector in some PR recently, but I can't seem to find it again.

Thanks again and I am looking forward to making this work!

Zylann commented 7 years ago

It's really easy to fix, the solution is in the errors (litterally)

Zylann commented 7 years ago

I submitted a fix

HummusSamurai commented 7 years ago

Success! The engine compiles with opensimplex, voxel, and hterrain!

I can now finally test some terrain :3 I'll let you know how it goes.

HummusSamurai commented 7 years ago

I launched the voxelgame project and I'm getting an error in the editor when I try to launch:

Invalid call. Nonexistent function 'set_cube_geometry' in base 'Voxel'

Line 15 in voxelmap.gd

Zylann commented 7 years ago

uh... well you can comment out most of this script actually, what it does is done in .tscn now :)

HummusSamurai commented 7 years ago

@Zylann I commented out the lines that caused errors, and it works even after I instanced my own character controller!

Unfortunately there are no collisions, neither the kinematicbody player nor his bullets are colliding with anything.

The commented lines were definitely needed, as the game looks rather bare now. But it's progress!

Zylann commented 7 years ago

The commented lines were not doing any collision. You can notice I also disabled some lines in the character controller. But in fact there can't be collisions because I removed the code that generated the shapes, and I need to remake them differently. Also I look forward to see this in action: https://github.com/godotengine/godot/pull/10013

Note that using the physics engine with this module is doubling memory usage, so I eventually plan to implement some Axis-Aligned physics similar to what Minecraft has (limited, but wayyyy less memory usage and faster)

HummusSamurai commented 7 years ago

Oh well then I guess I'll wait :D But this is already impressive to see right now (although I didn't find an option for smooth voxels anywhere). And the bullet physics will make it even better.

Also I tried the heightmap and it keeps refusing to import the heightmaps I'm testing, even though the resolution is fine and I'm pretty sure I have the color settings correct also. Do you have any pointers?

Zylann commented 7 years ago

Smooth voxels are supported, but aren't exposed well editor-side. The idea is that you have to generate voxel data in the channel Voxel.CHANNEL_ISOLEVEL instead of Voxel.CHANNEL_TYPE. Basically the isolevel is a number between 0 and 255 that represents the density of matter, and the module will render the intersection surface at the median value 127. The smooth mesher doesn't use VoxelLibrary at all though, and the output will be texture-less, but it's a start^^ I need to write some documentation, because at the moment it's not explained that: you need to write your own voxel "generator" by inheriting VoxelProvider (it can be C++ or GDScript), and putting it in the VoxelTerrain (in the example I have set VoxelProviderTest, which generates waves in the CHANNEL_TYPE channel).

If you want to ask stuff about HeightMap, you should open an issue there: https://github.com/Zylann/godot_heightmap_module/issues

Zylann commented 7 years ago

The script error should be fixed now