Open ApanLoon opened 6 years ago
Nice! I'm glad that my work helped you sort out some of the details of the blueprint format. Adding support for colours was one that I didn't really bother with, since the input STLs I was dealing with didn't have colour information. That said, if you want read colour form the input model, you can probably auto-colour the output Empyrion model too.
I have come quite a long way since I posted this. Python is not a language that agrees with me, so I kept working on the C# .Net program. You can check it out here if you are interested: https://github.com/ApanLoon/EmpyrionStuff
It can read quite a lot of data from several versions of the file format, including creator tags and textures/symbols and colours.
The part I worked on most recently is the block type/variant codes. I think that we both do this wrong currently. The variant should be a six bit integer to cover the 64 variants, however, the total block count list indicate that, for example, there are two block types for steel blocks. This leads me to think that the variant number is only five bits. Even so, things become weird on many block type/variant combinations.
Hey guys, wow, years are passing by like days, hm. Are you 2 still involved in this idea? Importing external files into Empyrion (epb)?
Just found an awesome video / project about Blender and proc. generated spaceships. https://github.com/ldo/blender_spaceship_generator
I would really love to use this.
I have to admit that I don’t remember exactly how this script works/worked. I suppose that simply flood-filling a volume bounded by the polygon result of the “space ship generator” with cubes would be somewhat straight-forward. I think that the GS Tools has a flood-fill function. My EmpyrionStuff tools do not at this time. One of the visions I had for my tools was to, somehow, come up with an algorithm that can match block variants with rotations to specific mathematical surfaces like tilted planes or spheres. Unfortunately I lost most of my energy and momentum long before I could even start thinking about that seriously.
It might be easier to figure out a different algorithm for generating shapes using a set of rules like “in front of block type x1. variant y1 at rotation z1 there is a w% chance of a blocK type x2, variant y2 with a rotation z2”. You could generate these rules from statistical analysis of all the blueprints in the game or perhaps even the workshop. Just an idea.
Okay, thanks for the update! I think it would be much better, if Eleon giving us the possibility to read the epb file freely without those Hex hacking guesses... Maybe such tools would be more easier to make then
I wouldn't say I'm still working on it, but I'm definitely still kicking around!
The basic idea for this script isn't to try to flood-fill a mesh, because meshes often have small holes in them, but rather to approximate the surface of the mesh with 3d voxels. This looks at every triangle in the mesh, and says "So, how can we place cubes to try to approximate this triangle", and then does that.
As post-process steps, I've added flood-filling, morphological dilation/hollowing (which is a far more robust way of filling in a mostly bounded region, like a 3D mesh), and attempts to place sloped blocks based on gradients of the cubes. I never got around to placing corner blocks, because Empyrion didn't actually support a complete set of corner blocks, and it was going to be a pain in the butt to sort out the edge cases.
That all said, you could definitely export a mesh from that ship-builder, pipe it through here, and it should spit out a functional hull for you to start with. I don't think the blueprint file format has changed enough to break this tool, but I'm not sure (and no one has filed an issue saying this tool is totally broken now, only just kind of broken... but it's always been kind of broken. 😅 )
@B-iggy An official file format description would be nice, but I think that most bits are understood well enough now. Of course the GS Tools are in need of a bit of an update here.
@Riebart Awesome! I didn't know that you actually do some of this surface to block matching. I have seen that there is a lot of geometry math in your code, but since I don't really understand python, I never saw exactly what it does. In retrospect, I think that what you have done is probably quite close to what I wanted in my tool as well but from a different starting point.
Hi, I realise that you probably stopped fiddling with this a year ago but I just found it today.
Have you made any progress on this and are you still interested?
I don't know Python, but I managed to get some pointers that assisted my hex editor explorations. I made a little C# .Net console application that reads a blueprint and outputs some data about it. Like your code, I can't read the stuff that has to do with creator name and save game mappings yet. I can, however read the block definitions from the zipped parts and I figured out how the colours and textures are applied to the faces of the cubes.
I attached an example output of my program run on a blueprint from the Steam Workshop: T4-Blitz.txt