Skip to content

Instantly share code, notes, and snippets.

@WithinAmnesia
Created February 25, 2024 20:25
Show Gist options
  • Save WithinAmnesia/fd2ef44f29da3d334c4444a2fb2f403c to your computer and use it in GitHub Desktop.
Save WithinAmnesia/fd2ef44f29da3d334c4444a2fb2f403c to your computer and use it in GitHub Desktop.
From Godor_Voxel Discord solution finding puzzle solving for adding a new block to blocky_game demo
From Godor_Voxel Discord solution finding puzzle solving for adding a new block to blocky_game demo:
"Matthew — Yesterday at 11:39
I was recommend to go here to ask questions here. I have the following questions: https://github.com/Zylann/voxelgame/issues/104
What are the steps needed to add blocks to the Blocklygame demo? Is there a documented guide? Has anyone done this who has knowledge in how to do this? I am trying to add an item storage chest and block spawner for testing voxel_metadata so the community has working examples for storage and entities. This is from: https://github.com/Zylann/voxelgame/issues/103#issuecomment-1962210328 Here is a prototype art asset for the blockygame demo style chest mesh / art / textures:
!terrain(chest). Any feedback is welcome.
Zylann — Yesterday at 11:55
Check the documentation https://voxel-tools.readthedocs.io/en/latest/blocky_terrain/
Also since I remember you don't know, .tres files are resources you can open in the Godot Editor. You dont have to edit them by hand. I would recommend getting more familiar with how Godot works before getting into this rather complex module cuz you seem to lack experience in that (there is also a general Godot Discord in which you can ask things https://discord.gg/4JBkykG)
Matthew — Yesterday at 11:59
Oh excellent this is like so helpful. I wish I found this earlier lol. I am new to all of this and lol I was looking in the wrong spots. Ya I was openning the .tres in notepad++ and I was very confused for the string values are not human readable. I have a lot to learn but thank you, this helps a lot. I was reading the wrong documentation about the right things. I feel silly. Thank you again. I know it's complex but I'll just keep trying and eventually things will work bit by bit. I'll do my best to be positive too. I will ask around the general community Godot discord too. Thank you for recommending myself to go there as well. I think the Godot discord should help in areas and expand my ability to ask dev questions. I should learn to add new blocks now and start proper testing of the storage and entities systems too.🌟
Matthew — Yesterday at 23:02
I am trying to add a new block 'chest' using following the documentation of https://voxel-tools.readthedocs.io/en/latest/blocky_terrain/
I am not currently able to click to expand the VoxelBlockyTypeLibrary to "see a list of generated IDs by clicking on the Inspect model IDs at the very bottom of a VoxelBlockyTypeLibrary in the inspector." I added a block in the voxel_library.tres
Image
the error is from running a multiplayer test where it looks like it is not finding ID and giving an error.
this is the prototype chest block it uses VoxelBlockyModelCube
Image
Matthew — Yesterday at 23:11
I have #'d the code that attempts to add the 'chest' in blocks.gd
Image
I have #'d the code that attempts to add Block ID 9, 10, 11 and 12 to their own spots in the inventory and block ID 12 should be the chest block when counting the add named blocks in the blocks.gd code.
Image
Matthew — Yesterday at 23:27
The documentation for VoxelBlockyLibraryBase says that the:
"Models used by VoxelMesherBlocky must be baked before they can be used efficiently at runtime. The way this process happens depends on the implementation of this class. It can be a simple list of models, or a list of high-level types generating variant models. Check child classes for more information." https://voxel-tools.readthedocs.io/en/latest/api/VoxelBlockyLibraryBase/
yet I am not knowing how to expand / open the VoxelBlockyLibraryBase panel / window in Godot for clicking everywhere does not open it and I clicked the VoxelBlockyLibrary section on the right with the "Array[VoxelBlockyModel]..." and it opens / expands the panel / window yet the same is not true for clicking on the VoxelBlockyLibraryBase's bake tangents one and on box and I am wondering if there is a keybind or another way to open / expand this VoxelBlockyLibraryBase panel for in the documentation it sounds easy and there are more buttons and details: https://voxel-tools.readthedocs.io/en/latest/api/VoxelBlockyTypeLibrary/ . I read this "Numerical IDs and names are mapped with what we could call an "ID map". You can see a list of generated IDs by clicking on the Inspect model IDs at the very bottom of a VoxelBlockyTypeLibrary in the inspector." Then I am not sure how to even get to VoxelBlockyTypeLibrary in the inspector for I click around but I feel stuck. It said it is an experimenter feature am I using the wrong / missing editor or something? I can bake paths for the added 'chest' block but I am not able to currently get to this part of the documentaion: "You can see a list of generated IDs by clicking on the Inspect model IDs at the very bottom of a VoxelBlockyTypeLibrary in the inspector." What should be done? Where can I improve and what is a solution that could work? All feedback is welcome.🤔
Image
nul — Yesterday at 23:41
This sounds a lot like not knowing how the Godot IDE works in general.
The Bake Tangents doesn't expand because it's not a panel/window. It's just a setting that can be on or off. It's just a boolean.
The reason the Models Array can expand is because an Array is an object. So the array itself has data inside of it. When you expand it, it shows you all of the available VoxelBlockyModels, whether they're empty, cubes, or meshes.
Matthew — Today at 01:05
Well if its not the data type in the VoxelBlockyLibraryBase spot in the editor then how can we get to this "You can see a list of generated IDs by clicking on the Inspect model IDs at the very bottom of a VoxelBlockyTypeLibrary in the inspector."?🤔
Matthew — Today at 01:13
How does one get to the VoxelBlockyTypeLibrary in the inspector. Fore there is a description in the documentation of what looks like VoxelBlockyLibraryBase expanding into a bigger panel that has VoxelBlockyTypeLibrary with a button to press to show generated IDs. How can one find the generated IDs in the editor and also why is my block not working exactly for I am bung up on this what I think is ~'ID missing step' or something so I'm a bit lost on what to do to add blocks for I am not able to find the generated IDs from VoxelBlockyTypeLibrary in the inspector. What should be done here if people know the answer? it feels like a simnple misstep but but I'm not sure where exactly and it was going fine until an iD error.
nul — Today at 01:13
You might be looking at a VoxelBlockyLibrary and not a VoxelBlockyTypeLibrary.
They are two different types of resources
Matthew — Today at 01:13
possibly
⁠blocky-voxels⁠ so https://voxel-tools.readthedocs.io/en/latest/blocky_terrain/
I was pointed to follow this documentation.
it says near the bottom "Numerical IDs and names are mapped with what we could call an "ID map". You can see a list of generated IDs by clicking on the Inspect model IDs at the very bottom of a VoxelBlockyTypeLibrary in the inspector."
nul — Today at 01:16
Yes, but the example project is built using a VoxelBlockyLibrary. So you'll have to look into how to use those, or figure out how to switch the entire system to a VoxelBlockyTypeLibrary
Matthew — Today at 01:16
VoxelBlockyTypeLibrary where can this be found?
is blockygame just not using VoxelBlockyTypeLibrary?
I'm trying to add a block to blockygame to test voxel metadata to test chests / storage
nul — Today at 01:17
It's not using it I believe, so it'd take some work to switch it to use that instead
You can probably achieve what you're trying to do without it though.
Matthew — Today at 01:18
that could work
nul — Today at 01:18
Just skip over the VoxelMesherBlocky with types part because that just explains how VoxelBlockyTypeLibrarys work
Matthew — Today at 01:18
okay.
so I get this error when I add in 1 new block to blockygame demo with adding a VoxelBlockyModelCube
Image
it says its from ID issues?
I wonder what step I am missing?
These are all the files I tinkered with.
Image
Image
Attachment file type: unknown
voxel_library.tres
12.12 KB
Attachment file type: unknown
blocks.gd
6.19 KB
Attachment file type: unknown
inventory.gd
4.13 KB
Attachment file type: unknown
chest.obj
1.07 KB
I used a clone of the regular blockygame and I have been trying to add one block to it so I can start testing voxel_metadata for storage chests. Maybe I am missing some simple steps?
Matthew — Today at 01:26
I wonder what should be done to add one block to blockygame?🤔
I made the window bigger too see all of the error message line. It happens at multiplayer host.
Image
I also deleted the save file so its a fresh world. If the voxel_library is swapped with a default voxel_library from default blocky game even withe the rest of the modified and and added files the game starts regularly fine.
Matthew — Today at 01:34
I use these to world save. m keybind is force world save too. It works fine with this its just extra files that is handy for testing.
Attachment file type: unknown
blocky_game.tscn
2.17 KB
Attachment file type: unknown
blocky_game.gd
7.05 KB
What to do?🤔
Zylann — Today at 08:19
The demo is not using VoxelBlockyType***. there isn't one in the project. It's doing its own thing in scripts based on VoxelBlockyLibrary and models. There is a voxel_library.tres in the blocks folder in which all models are stored, they all have a name. Then they are registered in the game from blocks.gd (that second part is specific to how that demo was made)
Matthew — Today at 10:27
ohhhh lol okay that makes a lot of sense.
Matthew — Today at 11:53
I had a bugged voxel_library.tres I accidentally replaced the last block / voxel of dead shrub with the chest and only by cross referencing the working and unworking test voxel_library.tres prototypes in notepad++ and counting lines and looking over the code I noticed that there should be 26+1=27 blocks / voxels but there was a total of 26. So I spotted that in the bugged voxel_library.tres it was crashing because blocks.gd called for the accidentally removed dead_shrub it crashed. It had not much to do with my new block. The working voxel_library.tres with the chest block added I made from scratch from a copy of the working default voxel_library.tres and I needed to keep all of preexisting blocks and then add the chest block / voxel as the subsequent ID as in 26+1=27 and when I did that it worked and my blocks.gd inventory.gd script addition guesses worked and it works!
Image
one can just barely see the latch art in the shadows but it works! I will go post my working prototype scripts in the issues to give them clarity on github and help any passers by / new devs lol.
Image
Matthew — Today at 12:14
multiplayer works too.
Image
The World saves work too in multiplayer. I had to world save with a not-host client for I accidentally closed the host client but it worked so that's another test done extra. Everything works great.
Image"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment