No Logic World Wednesdays this week

by @Jimmy 2019-07-10

Hi everybody, unfortunately there will not be a Logic World development blog this week.

I simply haven’t got much done. Since Friday I’ve been struggling with a single programming problem which has turned out to be much more difficult than I expected. I’ve mostly got it solved now but the game is still pretty much the same as it was a week ago.

For his part, Felipe is on vacation right now. There just isn’t much to talk about so I’m making the call to cancel this week’s blog.

Thanks for your understanding, and I’ll see you next week.

@ForLoveOfCats 2019-07-12

What is the difficult problem? Anything interesting?

@Jimmy 2019-07-25

The issues were with Board Models, which I’ve finally (mostly) finished. Getting them to work was plagued with issues. Off the top of my head:

  • trying to generate the model using the saved board data. This turned out to not be fully possible: because circuit simulation is calculated exclusively on the server, the client can’t know what wires should be rendered as on and which should be off. In the end I decided to generate and save a model when a board is saved. This approach is probably also better for performance when you’re switching between items in the list.
  • generating an isolated model of just a board, its children, and any wires attached to them. In-world everything is mushed together into many big models, so extracting a subset of that required some trickery.
  • saving and loading the generated model. I tried to do it in both obj and fbx but ran into headaches with both. Ended up creating my own custom binary model format.
  • fixing errors with the saved models. First the normals were screwed up, then the uvs were messed up exclusively along the y axis of the model, then the model wasn’t receiving ambient light, then the shadows the model cast on itself were too strong. Bleagh.
  • I encountered an awful Unity bug that prevented me from rendering transparency to the UI. So the render of the 3D model would have a bright pink background instead of a transparent one. I spent a great deal of time tracking down the bug, documenting it for my bug report, and implementing my workaround.

I expected board models to take a couple days at most, but it actually took two weeks. Programming is a bitch sometimes. I think it was worth my time, though; the models are fun to play with and super useful.