As promised, a post on ship generation!
I am using a tried and tested method for my ship generation, with some modifications to get the exact results I require.
Each specific ship part has its own key texture from which its graphics are generated.
As an example, here is the key texture for a ship's hull (enlarged 4x), which i'll be using for the purpose of this post.
The colours in this image represent percentage chances of a white pixel being placed at that position.
On the key texture, white ensures that pixel is always filled; green, blue and red stand for 75%, 50% and 25% respectively.Step one
Using the values mentioned above, we cycle through the image and fill pixels based on the colour provided by the key image and its associated percentages.Step two
We then cycle through the image, removing all single white pixels and filling in background pixels that have several white neighbours.
At the end of this stage, we have an image that looks something like this:Step three
If a pixel is next to a white pixel orthogonally, then it is set to black. This creates an outline around the white shape we generated in the previous step. We only do this for half of the image, for reasons which will become apparent later.
Our ship part now looks like this:Step four
Each white pixel that is next to two or more black pixels is darkened, this provides us with a crude form of anti-aliasing which makes the ship part look smoother.Step five
For the final step we make the image symmetrical along its centre, this is the reason we only outlined half of the image earlier. If we had outlined the entire image, any outlines that occurred more than halfway across the image would have been lost at this point.
This gives us our final image, which in this case is a hull!
As it currently stands, this allows for a total of 3.4024343*10^38 different graphical combinations!
Thought i'd give you guys a little insight into Novus' ship part generation, and hopefully someone will find this useful if they are trying to create some random graphics.
Thanks for reading!