THE tinySAUR GENERATOR
A downloadable game
My entry for procjam 2017.
I'm still working on texturing, and its ultimate fate is to be a twitter bot. (https://twitter.com/thetinySAURS)
Unfortunately, I have so far been unable to get any python to exe/app tools working with the particular set of modules it uses, so you will need python and the appropriate modules to run it, which is a big ask. Failing that, the uploaded screenshots are uncurated (i.e. I pressed generate and then saved each one, without deleting any ones I think might not be its best work), so you can replicate the experience of the app by flipping through the screenshots whilst pretending to press the generate button.
This gif should also provide the same experience: https://twitter.com/THISISDINOSAUR/status/929550688299995136
What is it?
It procedurally generates small scale pixel perfect dinosaurs. It's the little sibling to my much more ambitious project THE DINOSAUR GENERATOR, which you can read all about in issue two of Seeds p82 (http://www.procjam.com/seeds/). Whereas THE DINOSAUR GENERATOR is ambitious and focuses on generalisability, extensiblity, reusability, and to make integrating the output in a project as easy as possible, THE tinySAUR GENERATOR does none of that, doing whatever seemed most expedient to making pretty little pixelated dinosaurs at the time.
How does it work?
It's written in Python and is split into 8 sub generators, for different types of dinosaurs:
- Large Theropod
- Small Theropod
They were written in the above order, and you can certainly see how my approach evolved over each of them. There are some minor gaps in the above groupings, like other onithopods and other early bipeds, but at this scale most of these are indistinguishable from the things it does generate, so there's no current plans to expand this (unless you have a favourite dinosaur that you think it might not generate please do let me know).
Each sub generator works slightly differently, but all use the same basic approach of starting from a photoshop file that has layers sorted into groups (e.g. a group of tail options), which the generator then may pick zero or one of the layers in the group (e.g. a tail is compulsory, a horn is not). Some groups are also given a range of possible spatial offsets (e.g. some horns can be lower down and a position will be randomly selected). This structure is also leveraged to do different kinds of modifications, such as instead of selecting one from a number of body options, there may be a number of layers that can be added to modify the appearance of a the base body. There are also some conditional rules, such as if the top ceratops horn is too low or too big, it's not allowed to have a smaller one.
Depending on the sub generator, many other techniques are used to add variation, such as with the sauropod generator, where any sauropod has a 50% chance of having some sort of back frill or spines; this is then further modified by deleting a random amount of spine from the back to the middle of the sauropod. There is also a chance of removing the head portion of the spine (as long as the resulting spine would still be reasonably large). These rules were specifically selected to best match any sauropod references I could find. In this way, I could have the option of any sauropod having a spine without having to duplicate every possible neck, body, and tail option, and instead adding the spine to every possible one, and deleting it programmatically if it's not required.
For the construction of each sub generator I fell into the pattern of finding as many references for as many species as I could, and going through them one by one, adding rules and options to the generator until it was capable of producing (more or less) every dinosaur in that group. The hard part in this is ensuring that each addition doesn't combine with previous ones to make something ridiculous, without resorting to too many hard coded exceptions and special cases. This is part of the reason small and large theropods were seperated (and since most of the parts for the larger ones wouldn't work with the samller ones and vice versa, there would be little benifit to trying to combine them).
Generally speaking, the earlier I made a generator, the more likely it is to rely on programming (like spatial offsets), rather than a large number of options in the photoshop file. The former feels more elegant, but the latter was undeniably faster and produced better results.
Colour coding is used extensively in the photoshop files, with seperate colours for main bodies, horns, spines, eyes, feathers, and then a number of colours specific only to the samll theropod generator. This colour coding makes the programming much easier, for example, removing portions of the saurpod spine, and will likely be of most use for the texturing. The small dinosaur generator has several other colours that are used to distinguish feathered and none feathered theropods, allowing the generator to use the same files for both more classically scaley theropods, and theropods that are practically birds, like Archaeopteryx. One colour should only be there on unfeathered dinosaurs, another represents feathers themseleves, another is only on feathered dinosaurs, but isn't feathers, and a final one is on both, but is feathers when its on a feathered dinosaur (a distiction that is important when it comes to the texturing of the dinosaurs).
Don't tell the others I said this, but the feathered theropods are definitely my favourite.
Requires python 3.something, psd_tools, PIL, numpy, and tkinter (i.e, the includes at the top of the only .py file). If that all sounds like nonsense, turn back now (at least until I can wrangle it into an .exe/app); otherwise, they should hopefully all install easily with pip/homebrew/other package managers. IMO you're probably still better off just waiting for the twitter bot.
Leave a comment
Log in with your itch.io account to leave a comment.