Cube Switch Activator Bug

Solved another bug tonight, but in the “not really” kind of way that makes me very uncomfortable.

Here’s the issue:

manifold_garden_cubeSwitchingBug

When you pick the cube from the tree, the one that is out on the switch (which is connected to the one on the tree) is reset and you can see it shrink away and disappear. However, the switch stays active and the door remains is open.

This needs to be addressed because this is not how the switch activators work, and the player ends up with an extra block.

After a bit of digging around, it turns out that OnTriggerEnter() is getting called twice:

OnTriggerEnter

I couldn’t figure out why this is. I think it has something to do with the cube changing layers when it goes from being held by the player to being on its own? I will have to look into this tomorrow.

The switch keeps track of the number of cubes in it in a list: _currentTriggeringCubes

Because OnTriggerEnter() is being called twice, the gravity cube is getting added twice to _currentTriggeringCubes.

When you go to remove the cube, it only deducts a count of 1, and so the switch thinks there’s still one cube left in it when in fact there are non.

I added this code to check to see if the cube is already inside the list before adding it:

manifold_garden_code

This check is good to have anyway, but it really bothers me that I can’t figure out why the OnTriggerEnter() method is getting called twice. Inevitably this bug will come up somewhere else later and end up causing other problems. I will ask David about it in the morning.

Anyway, here’s the switch working correctly: manifold_garden_cubeSwitchCorrect

Cube Growing Back in Wrong Color – Fixed

Streamed for a bit tonight, and actually did figure out the issue with the cube growing back the wrong color.

manifold_garden_cubeGrowingBackInWrongOrder

Basically, the tree cube spawner instantiates 2 cubes at start. One is enabled, and one is not.

All cubes are actually instantiated as blue cubes, and then the colors are set accordingly (since they all need their own material instances anyway).

When you grab a cube, it basically swaps the two, putting one on the tree, making the other active off-tree.

It turned out there was a block of code where the color of the cube was being set that was for some reason commented out

Uncommenting it did the trick. Simple enough, but it did they me a while to get there. Most of it was figuring out the logic of the code.

manifold_garden_cubeGrowingBackInCorrectOrder

 

Fruit Cube Spawning

Fixed a bunch of minor bugs last night, mostly getting audio stuff to work correctly again.

Now starting to go through and understand the system for tree fruit cube spawning. It’s a bit complicated as it relies on delegates from the cube itself to call the spawner to decide when to reset the cube and so on.

Will probably just need to read through the code several times to fully understand it.

manifold_garden_fruitCubeSpawning

 

Manifold Garden 3 Year Development Anniversary

ManifoldGarden_2012vs2015

3 years sure makes a big difference.

Life

Took Thursday off for thanksgiving. Did not working on Manifold Garden at all. Helped cook, ate, and then played NBA 2K. It was awesome.

Latest Build Update

Anyway, getting ready for PSX next week. Thought I’d post about different issues with the game here. I’m working to address them all this weekend.

Regrown Cube Color Messed Up 

manifold_garden_regrownCube_001 manifold_garden_regrownCube_002

When you pick a cube off of a tree and it grows back, it should grow back the color of the cube, but translucent. That way, you know there’s a cube out there that you’ll be destroying as you pick this. Right now, the cubes are all growing back blue regardless of what their correct gravities are.

Tree Mesh Normal Screwed Up

manifold_garden_treeMeshScrewedUp

When trees are made with the tree generator tool, every segment is a separate piece. There’s a tool, “The Tree Finalizer”, which merges everything together into a single mesh (for optimization and management purposes). For some reason, when the mesh is merged, the normals get screwed up. If you look in the picture, you can see the side of part of the tree is blue. Only the top surface should be blue.

Cube Material Is See Through

manifold_garden_cubeMaterialSeeThrough

Shouldn’t look like this. Should be opaque. Pretty sure this has something to do with the shader.

Beam Mesh Z-Fighting

manifold_garden_zmeshFighting

When not extended, the beam mesh is this black plane which results in really ugly z-fighting.

Cube goes through wall when player standing on stairs

manifold_garden_cubeGoesThroughWall

I think this is because when you’re on stairs, I actually make the player weightless, which I think tricks the player object into thinking there’s nothing beneath the player, which changes the state of the cube that the player is carrying (removes actual physics). Will need to look into this obviously.

Sound messed up

The sound for a bunch of objects is screwed up, but I can’t really show that visually.

Plans for rest of weekend

Fix bugs and test the full game on PS4 devkit.

Tree Band Problem

David fixed the issue with the floating branches when you merge the tree. Mostly it had to do with getting quaternions right to handle the correct rotation.

We had another problem though, with the bands on the tree:

treebandproblem

These are only supposed to appear at the base of the tree to indicate how many fruit cubes grow from it. I think Chris wrote the script so that it should only go on the trunk part, which should be separate from the rest of the tree.

Anyway, right now it is getting applied to the entire tree.