This is an addon I wrote for Blender, that lets me import creations from the indie video game Besiege
Besiege is a physics simulation based game where you create machines from blocks that are provided to you to complete tasks, varying from destroying armies to moving resources. It's a game that I love playing. It's one of the first video games I've ever played and I still play to this day. I've watched the game progress so far over the years and I wanted to make something of my own for the community. And at the time I wasn't familiar with how game engines worked, I decided to make this instead!
An addon for Blender that would accept .bsg
files, which is an XML that Besiege uses to describe the machines you created in-game. So people can share their creations. My addon would allow players to import these creations into the Blender by parsing the XML file, finding the models and textures from the games data directory (which were in plain view because the game also allows players to make their own skins) and position them within the scene.
Each model wasn't of the same scale within the game. Each object had to be imported and applied a certain transformation to them. So after importing them, I had to look up the part number and apply the transformation. And its not always easy to get this transformation data. Sure there documentation for some blocks, for example on the games wiki, there is a page describing transformations. But this pretty old and a lot of the newer blocks didn't have records. So I had to eyeball a lot of stuff based on screenshots with orthographic camera mode toggle within the game.
Normally each part of the machine was a static part. You just import it from the assets, normalize it and you're good. But in v1.05 of the game, they introduced Build Surfaces, which is a new type of block that doesn't have a fixed asset, but rather generates the mesh procedurally. This posed a lot challenges because I wasn't completely sure how the game made these meshes either. But after talking to some other people in the games community I met this user with the handle ProNou who helped me understand how it was done, I managed to recreate with my addon. There were some mishaps along the way and a lot, and I mean ALOT of failed attempts. Here are some
And finally here we have some of the first successful imports with the surfaceblock
Before the introduction of build surfaces if a player wanted to create a machine with a detailed surface, they would use something called brace cubes. In the game this just a simple connector that can reinforce the structure between two points. But players found if you changed the scale of the parent object and rotated the brace cubes, you can make interesting shapes
All in all, implementing this was easier than the build surfaces. Just involved a lot quaternion non-sense. But it was definitely not as interesting to implement as build surfaces.
Send me a message! Don't worry it's free!