RCIX
Guest
|
|
« on: October 27, 2010, 06:15:17 PM » |
|
I present to you: The Grand Pixel-art Spaceship Generator!Screenies (generated ship at 4x magnification on the left, key texture on the right): I borrowed the mirroring idea from Dave Bollinger's Pixel Spaceships page (though the actual generation method is different). I'm in a hurry right now so can't explain how it works, but will do later. Thanks to VomitOnLino's Invaders: Corruption project (check the DevLogs section) for the motivation to hammer this out! Update:Download the generator program (current version: 1.5)
|
|
« Last Edit: October 31, 2010, 09:41:31 AM by RCIX »
|
Logged
|
|
|
|
RCIX
Guest
|
|
« Reply #1 on: October 28, 2010, 01:20:15 AM » |
|
So anyway, the algorithm: - I take in a "key" texture, which is what controls the RNG.
- I loop over each pixel in the image, and generate a random value.
- I then use that random value and the color of the current pixel on the key texture to decide whether to fill in the current pixel or not.
- In this case, white is always fill, green is 75% fill chance, red is 50%, blue is 25%, and black is don't fill at all.
- From there, I get rid of floating black pixels that have 0 or 1 neighbors and turn on white ones with several black neighbors.
- Finally, I take the left half of the ship and mirror it over the right (so it's symmetrical)
I got it working for arbitrary sizes and amounts of key textures, too. My plan is to add texture saving and batch rendering support, then try and hack together some sort of downloadable thing so you guys can play with it as well.
|
|
« Last Edit: October 28, 2010, 01:26:39 AM by RCIX »
|
Logged
|
|
|
|
davidp
|
|
« Reply #2 on: October 28, 2010, 01:41:19 AM » |
|
downloadabale version would be nice yea, i might use it to generate ship sprite for my next game
|
|
|
Logged
|
|
|
|
RCIX
Guest
|
|
« Reply #3 on: October 28, 2010, 02:49:37 AM » |
|
downloadabale version would be nice yea, i might use it to generate ship sprite for my next game I'll have to repackage the code in a nice Winforms project, but that should be fairly doable.
|
|
|
Logged
|
|
|
|
jotapeh
|
|
« Reply #4 on: October 28, 2010, 06:13:38 AM » |
|
Huh. That is pretty cool stuff. Definitely not something I would have thought of... I like your higher-rez version a lot more though!
|
|
|
Logged
|
|
|
|
easynam
|
|
« Reply #5 on: October 28, 2010, 07:19:42 AM » |
|
I was messing with that algorithm too quite a while ago (with some random modifications) Also if you mess around a bit it can do more than just ships I need to get back into this some time. Procedurally generated pixel art is pretty fun
|
|
|
Logged
|
|
|
|
snowyowl
Level 1
|
|
« Reply #6 on: October 28, 2010, 01:22:18 PM » |
|
Procedurally generated HAIR?! That's the most bizarrely awesome thing since Doctor Who flew a Spitfire plane into space.
|
|
|
Logged
|
|
|
|
jotapeh
|
|
« Reply #7 on: October 28, 2010, 02:10:31 PM » |
|
Some of those good sir are most definitely Procedural Cowboy Hats
|
|
|
Logged
|
|
|
|
ANtY
|
|
« Reply #8 on: October 28, 2010, 02:17:47 PM » |
|
When i saw that ships i felt wanting to create game with them :]
|
|
|
Logged
|
|
|
|
RCIX
Guest
|
|
« Reply #9 on: October 28, 2010, 07:56:12 PM » |
|
OK, the generator is up! Notes: * Prereqs are .NET 3.5 and XNA Redistributable (or full) 3.1. * The random seed box doesn't quite work, forgot to code it up >.< * It's a bit rough around the edges but ought to work fine. * You can make ship textures of any size, but the most the UI can properly display are 32x64 ones.
|
|
|
Logged
|
|
|
|
RCIX
Guest
|
|
« Reply #10 on: October 30, 2010, 10:23:27 AM » |
|
I've mostly completed a version that has, among other things: * a working random seed box * the ability to "permute" ships * More methods of mirroring the generated ships * (hopefully) code that you can use in your program if you want! (release may be delayed
|
|
|
Logged
|
|
|
|
RCIX
Guest
|
|
« Reply #11 on: October 31, 2010, 09:43:28 AM » |
|
V1.5 up! Has many new features, and a DLL you can use to program in your own procedural gneeration. Go ahead and use it where you want, just give me credit.
|
|
|
Logged
|
|
|
|
KM
|
|
« Reply #12 on: November 03, 2010, 10:21:38 AM » |
|
Those look pretty f'ing awesome easy. :D
|
|
|
Logged
|
|
|
|
Fallsburg
|
|
« Reply #13 on: November 10, 2010, 01:42:32 PM » |
|
I was inspired by this (and VomitOnLino's Invaders: Corruption by extension), and have extended it a bit more for my current project. Instead of 4 distinct values (0,25%,50%,75%,100%), I have any value between 0-100 and >100 for special values (i.e. if you want the cockpit to be a different color scheme). I also allow for vertical, horizontal, vertical and horizontal, or no symmetry. If anyone is interested in the code (it is in Flash AS3), I can supply it to them.
|
|
|
Logged
|
|
|
|
|
|