Logic World Wednesdays: The Jimmy's Birthday Edition

by @MouseHatGamesDeveloper2 years ago

Cleanup - Jimmy

Over the past few months, I’ve been reworking large chunks of the Logic World codebase (as you’ve been reading about on this blog :)). In the process, a number of issues, bugs and oversights have crept in, and I took some time this week to address these problems and clean up the dang game.

Here are some highlights from my janitorial adventures:

Standing display variants

A while ago I showed how Panel Displays have been condensed into one component type; instead of a separate component type for each number of pegs, there’s just one component type, and you can choose how many pegs it has. This week I finally gave the same treatment to Standing Displays.

These four components are all the same type:

standing displays.jpg

On a similar note, by popular request I’ve added secret settings for all the dynamic components (AND gates, panel displays, standing displays) to choose how many pegs you can assign to them. Respectively, they are by default limited to 4, 9, and 4 pegs, but the procedural generators can handle arbitrarily large numbers.

Adjustable component collision checks

When you change the variant of a dynamic component, or when you adjust the delay length of a Delayer (which changes the angle of its input), the world geometry changes. This can potentially lead to invalid scenarios; an object could clip inside another object, a wire could be cut off, etc. I’ve now added checks when you perform these actions so that invalid states are never entered.

Collider types

Objects in Logic World – like in many other video games – use Colliders to assert their solid, physics-enabled geometry. Most components in the game are cubic in shape, so we’ve been able to assign them simple bounding boxes as colliders.† As such, there’s a ton of code in the game that assumes all component colliders will be boxes. However, the recent addition of Buffers, with their strikingly non-cubic geometry, has challenged that assumption.

This week I’ve added support for all Unity/PhysX collider types to be used as component colliders. In addition to the standard Box Colliders, components can now have Sphere Colliders, Capsule Colliders, and convex Mesh Colliders. This was a surprisingly annoying task: there are a lot of places in the game that deal with component colliders (testing for intersections, testing for contact, etc), and each collider type has its own finnicky nuances for how you work with it. But they’re all supported now, and can be used by vanilla components or modded components.

Last time when I showed the new design for Buffers, their central block had no colliders. That meant players could walk through them, you could place items inside of them, wires could pass through them, etc. Now, however, Buffers use a sexy mesh collider, and their unique geometry is seamlessly integrated into the game.

†(While Chairs do have funky non-cubic geometry, they still use box colliders)

Bug Squashing

I’ve squashed a bunch of bugs this week. Most notably, I’ve fixed a bunch of edge cases with Relays and Buffers; the linker layer is now very solid and should work as expected in all circumstances, while still being nice and fast to simulate.

Speedy Website Builds - Felipe

As you probably know by now, the logicworld.net website is an SPA, meaning that all the content is dynamically rendered using JavaScript. Each page is composed of many components using the Vue.js framework and each component is like a little page of its own, with its HTML, JS and CSS. However, your browser doesn’t know how to put these components together to form the entire page so before it’s sent to you we need to pack them together, almost like compiling code of languages like C#.

This step used to be performed using Vue’s official tooling but, as its written in JavaScript, it was extremely slow. Production builds used to take upwards of 4 minutes on Bob (our build server), which doubled when I implemented SSR as it needed a build of its own with different parameters. This made deploying changes very slow, and after getting fed up with it I started to look for alternatives.

That’s when I found esbuild, an “extremely fast JavaScript bundler” that certainly doesn’t disappoint. esbuild is built using Go, which means that it is orders of magnitude faster from the get-go. This together with the efficient usage of threads means that build times went down from several minutes to 3 seconds! It was not without its hardships though, as esbuild is still a relatively young project and not all frameworks are fully supported, including Vue.

Vue’s components are (usually) written in the form of single file components, where the component’s HTML, JS and CSS are all together in a file with the “.vue” extension. However, as esbuild doesn’t natively support Vue, it has no idea how to handle these “.vue” files. At this point I would usually install a plugin and call it a day, however I quickly found out that there were no feature-complete and up-to-date plugins for Vue 3 so I had no choice but to write my own.

I learned a ton about the internals of Vue and JS build systems in general, so I think it was a great use of the weekend… and a couple more days. After spending some more time squashing bugs, it’s almost ready to roll into production. I also took this opportunity to update libraries and improve some parts of the code, which together with esbuild reduced the site’s JS payload size almost in half!

This new speedy build pipeline will help me to develop, test and deploy logicworld.net quickly and efficiently. As we strive to turn this place into a hub of discussion and creation for the game, I’m glad to have this new pipeline on my side.

New Building Begins - Jimmy

I’ve spent a bunch of time this week planning out, in excruciating detail, the long-awaited new building mechanics for Logic World. I feel really good about the plan, both in terms of how pleasant the mechanics will be to use, and in terms of how cleanly they can be integrated into the code.

I decided I had to do some cleanup (described above) before I could really tackle this thing, but I’m almost finished all the cleanup tasks I had planned, and I’m excited to start working on the building in earnest in the next few days! This is really exciting to me; the last few months have been about adding tech and refactoring the game to support my epic new building system, and all that has finally come together such that I can begin to implement it. Logic World is all about building things, and I am going to make it fast and fun as heck to build those things.

One thing I’m super pumped about with this plan is multi-select. Under this plan, every building mechanic – move, clone, rotate, etc, and some brand-new mechanics that don’t exist in the game yet – can be performed on multiple components simultaneously, instead of tediously modifying components one by one as in the current game.

I’m hoping to have some fun building stuff to show off next Wednesday; if not, I’ll at least do a bigger writeup of the plan and how it all works from a technical perspective. Stay tuned!

We’ll keep releasing these weekly updates right up until the game comes out. To make sure you don’t miss them, you can sign up for our newsletter. Be sure also to wishlist Logic World on Steam and join the official Discord.

See you next Wednesday!

More Logic World Wednesdays

RSS icon
@Ecconia2 years ago (edited2 years ago)

Speedy website builds

That is interesting. Its always good to have it faster. Out of curiosity @pipe01, do you have a fully functional copy for testing on your computer? For live development, I assume so shrug.

New building mechanics

I am looking forward to these so much. Good material to write comments to too.

@pipe01Developer2 years ago

do you have a fully functional copy for testing on your computer?

Yup, I have a local instance of the site that isn’t connected to any database and instead uses in-memory mock data.

@Vykori2 years ago

One thing I’m super pumped about with this plan is multi-select…

Oh FUCK yeah!! Bulk operations are key to making building as pain-free as possible. <3

@JimmyDeveloper2 years ago

It’s gonna be rad 🤘