openpixels icon indicating copy to clipboard operation
openpixels copied to clipboard

Tool for Character Creation

Open super3 opened this issue 12 years ago • 17 comments
trafficstars

In one of your very old post you said you wanted to make a tool to allow you to automatically generate characters rather than have a gimp file. Did you ever start on that?

If not I think that would be a great tool to have and something I could put together rather easily.

super3 avatar Dec 17 '12 00:12 super3

I never started. The extract_layers.sh created all the assets in /layers. Someone started something using html/javascript, checkboxes and divs as layers, but it doesn't exported (save) the results. I would crete probably I would do something URL oriented, e.g. example.com/char_generetor/body_green+eyes_default+cloths_blackdress.png and I would get a png. This would create a character service for avatars or javascript games. Then, a web UI would generate these URLs.

silveira avatar Dec 17 '12 02:12 silveira

Do you have a link to the code that someone started on? Seems like would need two simple solutions.

The first one you could code using a little html/javascript, using transparent divs, and buttons between choices. Good luck getting this to work in IE. This would work for display, but it would not allow you to save the image because it would just be a bunch of layers of images. That is when you could have a server side script(maybe in python) to quickly generate an actually .png for download when you are done. What do you think?

On Sun, Dec 16, 2012 at 6:11 PM, Silveira Neto [email protected]:

I never started. The extract_layers.sh created all the assets in /layers. Someone started something using html/javascript, checkboxes and divs as layers, but it doesn't exported (save) the results. I would crete probably I would do something URL oriented, e.g. example.com/char_generetor/body_green+eyes_default+cloths_blackdress.pngand I would get a png. This would create a character service for avatars or javascript games. Then, a web UI would generate these URLs.

— Reply to this email directly or view it on GitHubhttps://github.com/silveira/openpixels/issues/7#issuecomment-11428410.

Shawn Wilkinson Student, Morehouse College Independent Web Developer [email protected] http://super3.org

super3 avatar Dec 17 '12 03:12 super3

No, I have been doing a bad job in keeping track of what projects are using the openpixels. I should have a file with links to these. :(

Yes, this is a good approach to the server side. With Python I would recomend the PIL http://www.pythonware.com/products/pil/. Let me know if you tried something.

silveira avatar Dec 17 '12 17:12 silveira

If you could find that it would be helpful, and maybe save some time.

That would finally give me an excuse to learn how to use the PIL, although this could be put together with PyGame too if I was lazy. I think the best thing to do is make a little command line app that can generate large amounts of characters sets that you can release.

If I put together this tool do you mind if throw some of the sets I generate up on my website (to exploit them for some traffic of course). If it turns out that the automatically generated assets are pretty awesome then I could put together a whole site just for them. All with your permission of course.

super3 avatar Dec 17 '12 20:12 super3

It seems possible to just generate and cache all the possible combinations of characters, but we have currently 76 layers. If we maintain the current fixed order used in Gimp (e.g. the body comes before than the eyes, hair, etc), this gives us 2^76 different png images. If we could choose any order for the layers we would have 76! (76 factorial) different png images. A single image have about 5.8k today (or about 8kb with 2x zoom). Either case, it is too much space.

Another approaches could be:

    1. Generate images as needed.
    1. Generate images as needed but cache the already generate images.
    1. Generate images as needed but cache the most recent and/or most used images.

silveira avatar Dec 17 '12 20:12 silveira

Yeah the first two would be something that could be easily implemented. First you make the actual function to generate the images(1). Then you add a little script that will check if it has generated it already first, then generate it if not(2). You would implement (3) if you we really processing a large amount of images and needed to optimize.

This function actually could have other uses too. You can now procedurally or explicitly generate characters for a game. You could have 1,000s of unique characters, but not actually have to have art assets rather than just the layers.

super3 avatar Dec 17 '12 21:12 super3

Oh, there is a few rendered characters at https://github.com/silveira/openpixels/tree/master/examples/characters

silveira avatar Dec 17 '12 21:12 silveira

Thanks. I saw that while browsing through the repo. Ok, I am going to play around with the script, and I'll keep you updated.

super3 avatar Dec 19 '12 03:12 super3

Do you want me to continue working on my own fork?

super3 avatar Dec 19 '12 04:12 super3

I can give you permissions here if you want. Do you want it?

silveira avatar Dec 19 '12 05:12 silveira

Auto generated guy. This is why I love python. This was done in like 20 minutes. export

Sure I could work on a separate branch for my auto generated script.

super3 avatar Dec 19 '12 05:12 super3

Now I'm just randomly generating them. Need to define some logic for creating a char, so they have stuff like pants. Here are some good ones from an autogenerated set of 50:

Mr.T? export8

export19 export35 export46

super3 avatar Dec 19 '12 05:12 super3

Amazing! I guess you could have a mandatory body and eyes, to start with. I just gave you permissions as a collaborator. Fell free to create another branch or just do anything you want. Looking forward to see this code. :)

silveira avatar Dec 19 '12 05:12 silveira

Some of the things in clothes are just pants or shirts. We might need to work out how to attach some logic to each item. The helmet it just not going to work well with the afro. Then again maybe we should just ignore the logic part and just make the script generate whatever is passed to it.

The ugly code is in my fork. It needs to be cleaned and doced. Mind if I throw some of these on Reddit so people can see the project?

super3 avatar Dec 19 '12 06:12 super3

Tool is done. Still need to document it a bit.

super3 avatar Dec 19 '12 11:12 super3

About the logic, I think a graph of precedence (http://en.wikipedia.org/wiki/Precedence_graph) which is basically what you said, put the hair before the hat for example.

No problem about Reddit. Which subreddit?

I'll try to take a look on the weekend now my finals are over. :)

silveira avatar Dec 21 '12 17:12 silveira

Ha ha. Suddenly I'm writing DFAs again. Posted in r/gamedev. It is on the front page. Awesome. I think I'm going to generate some large sets out for people to use.

super3 avatar Dec 22 '12 00:12 super3