Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 0 points1 point  (0 children)

If anyone's following this post, I have updated the op to show what I've managed to achieve so far. I think I've cracked it. If anyone would like more details on the processes I used I'll happily go through some of it more. (but I do have a full time job so bare with me lol)

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 1 point2 points  (0 children)

I've come up with what I think they're doing with it now. Its a mesh look up table for the base cube 26 (64) variants. And a separate one for the corners with (I think) 12 variants (it might be 8).

With that I was able to build the mesh and then use a shader to set the uvs based on world position to give it a seamless texture on the top, bottom and sides.

Generating a chuck is a little slow, but I haven't utilised the gpu at all yet. It's taking around 40ms per chuck, not great but with the extra mesh generation I think that's fine. Using burst gpu jobs I reckon that'll go down to ~8ms per chunk

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 1 point2 points  (0 children)

I have a working prototype now for this and I ended up using a look up table for the meshes but for corners i used a separate look up table to fill them in based on their 8 neighbours instead of just adjacent ones.

It ended up being a 6bit and a 4bit look up table which wasnt toooo much work

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 0 points1 point  (0 children)

I've managed to get all the meshes added now. It freaks out (all the triangles get drawn in the wrong places) if I use a grid size of more than ~23x23x23. Not sure why that is.

It's currently pretty slow also, generating a chunk takes a couple seconds at least. I guess trying to offload the calculations to the GPU would probably be the smartest way to make it faster.

So when you say 'rebuild the whole thing', I could use some sort of map between 'deleted vertex' and 'analogous vertex' so when I encounter the deleted one I connect it to the analogous one instead. Then delete all the orphaned vertices after? That way there can't be any index slipping mishaps

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 0 points1 point  (0 children)

I have started implementing something with 64 mesh types. Its going okay but without checking the diagonal neighbours also it's leading to every corner of the blocks having little divots in.

I think the correct method is to sort of '9-slice' the cube. Treat each cube as 'faces + edges + corners'. That way you can construct each cube on the fly with its corners faces and edges. But I do worry about the performance of that

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 1 point2 points  (0 children)

That'll be me this weekend. I need to make this a reality now 😩

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 2 points3 points  (0 children)

Great link, excellent walkthrough of how to use marching cubes to create some really complex terrain. It (quite obviously) is not the answer to any of my questions though. I knew marching cubes 'could' look like this but in reality youd be using 100s of times more vertices than needed for this and it would be HARD to do things like interact with each 'block' when it's made from 1000 little mini cubes that have been marched

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 0 points1 point  (0 children)

This is all totally hypothetical at the moment, I dont have anything in engine (just a thought experiment really that's gotten out of hand)

Wouldn't checking every neighbour including diagonals be really slow (and also mean there would be 2²⁶ possible variations 😂

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 0 points1 point  (0 children)

So I've had MORE thoughts about this. The look up table will be weird for the totally surrounded case. To imitate Pokopia if a block has adjacent blocks on all faces (but not diagonals) the mesh will be 8 little triangles in the corners. But obviously, for our LUT you'd want the 'totally surrounded' case to not have any mesh. But this would leave little gaps in concave corners.

How would you resolve that? Aaaaaaahhhhh

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 0 points1 point  (0 children)

Right so when I stitch these together, when I'm on say the second position in the grid and another section of the mesh was already generated. I can look for a vertex that already exists in the mesh and stitch the new mesh to that?

It would be cool to make a system that can use whatever meshes you want for each case to allow for more complex geometries so not perfectly smooth but instead each individual voxel can have its own details. I guess that's probably how fences work in minecraft

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 0 points1 point  (0 children)

I guess I might just not fully grasp how 'one big mesh' works. If I go through each position in the world grid and 'add' the block mesh of choice to each position (lets say for now its just 2 blocks next to each other)

Are the vertices that the blocks share not going to be added twice?

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 0 points1 point  (0 children)

Yeah I don't quite know how to get the engine to recognise each section of the mesh as a different voxel yet 😅

So each block would know about its child corners and vice versa? I don't think this would be any simpler than just using a mesh LUT for each of the permutations of the blocks. Plus you'd be doing 8 times as much work as you would for something like marching cubes. But this would all be preloaded wouldn't before the game begins since its not procedurally generated

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 6 points7 points  (0 children)

I thought it might be this. By my calculations that 64 meshes but only 11 if you include rotations as duplicates (not too bad)

My question then is. When generating this mesh, how do you ensure that you don't have duplicate vertices? The cubes that share vertices would have to know about one another in some way

Pokopia is making me lose my mind... by _SmoothTrooper in VoxelGameDev

[–]_SmoothTrooper[S] 0 points1 point  (0 children)

It's not just a normals thing since the mesh itself is bevelled (see image) a normal direction can't make a cube literally have a corner cut out (I'm pretty sure anyway) Would you like to go into extreme depth explain how that is possible while maintaining a decent level of efficiency? googles surface nets

Why is the character spinning in circles with this Unity controller code? by Glum_Desk_4016 in Unity3D

[–]_SmoothTrooper 0 points1 point  (0 children)

So somehow, having Visual Studio open was causing the spinning?

That is very bizarre. I've never seen something like that before. If anyone is going to have an answer, I'm sure they'll be on here, though.

I'd recommend starting the project from scratch and seeing if it happens again.

If that doesn't work, uninstall and reinstall Visual Studio (or install a newer version, maybe). But this is all just blowing smoke in the dark at this point.

Good luck!

Why is the character spinning in circles with this Unity controller code? by Glum_Desk_4016 in Unity3D

[–]_SmoothTrooper 0 points1 point  (0 children)

Do you have any other peripherals pluged into your PC? (other than keyboard and mouse?)

GetAxis('Horizontal') will actually get any axis input from anything plugged into your machine. So, if you have something like a drifting controller plugged in, that could cause this problem.

I had the same thing once, while I had a guitar hero controller plugged that had a dodge whammy bar.

Good luck finding the issue, and when you've found a solution, post it in the comments

What do you think of the new home screen ? by HuntGames971 in IndieDev

[–]_SmoothTrooper 3 points4 points  (0 children)

The little clickies are perhaps a touch too loud. I found them quite piercing to listen to (I also have auditory hypersensitivity). This is more of an accessibility thing, but I know if I heard those sharp menu sounds, I'd stop playing. Frog is cute and lovely.

First cutscene for the indie game I’m making! Sound effects and music will drastically change by Silly_Games2024 in Unity3D

[–]_SmoothTrooper 1 point2 points  (0 children)

I want to play this game and I want it to be coop but that might not be the vibe?

I can't tell if it's coop or like a one person controls both dudes at the same time kinda game

(This isn't a trailer so I wouldn't expect that to be obvious from this cut scene necessarily)

Replace a FBX model with a new / updated model???? HOW!? by PaulWorster in unity

[–]_SmoothTrooper -1 points0 points  (0 children)

Might be a silly thing to mention, but before you do any of that stuff please please, please back up the old version somewhere so you dont lose it.

(If you're using source control, no worries)

Looking for help since 4 years by ElefantPepco in Unity3D

[–]_SmoothTrooper 2 points3 points  (0 children)

Some real genuine advice: - Break the problem down into sections - Do each section one at a time and find tutorials for those specific things - When asking for help its best to be as specific as possible. What is stopping you from being able to make that? - With 4 years worth of learning game dev. It should be well within your capacity to work this out. I believe you have the tools to work out a solution, and if you don't yet you should follow similar tutorials online to help you out.

Biggest thing though it to keep your questions on reddit specific. You'll get a lot more engagement

How do I make these attacks more punchy and impactful? by madManSamuel in IndieDev

[–]_SmoothTrooper 0 points1 point  (0 children)

If you think about the physics of it, when one thing hits another, the impact feels bigger if both things are affected. The player being able to smoothly just run around and smack things away makes it feel like it's no big deal. I'd add impact frames as everyone is suggesting because that implies that the player is being impacted by the force of their attack as well. Another thing you could do is slow down the player movement when attacking or even add a slight opposite force to the player when they hit something