CGs Based on Characters

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

CGs Based on Characters

#1 Post by ArizaLuca »

The main character in my game is customizable; and with six options for the hair, six for the eyes, and four for skin tone, it makes it rather difficult to draw CGs. Would it be possible to somehow change the CG based on how the main character looks? I know LiveComposite is an option, but I am using LayeredImage and I'm not sure that it would work together.

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: CGs Based on Characters

#2 Post by wyverngem »

You can do it this way;
1 - Create default variables for the different attributes that can be customized.
2 - Create CG image with Composite using [atrribute] to automatically change it based on the variable value
3 - Set up and save your CG images as individual layers with appropriate names using Save Layers to File

Code: Select all

# Customized Character attributes
default eye_type = 1
default eye_color = "blue"
default hair_type = 1
default hair_color = "blue"
default skin_tone = 1

# Your CG image template
image cg_firstkiss = Composite(
     (1066, 600), #The size of your image
     (0, 0), "cg/firstkiss/base.png", # Numbers are your position of x and y. The "" is the file name.
     (0, 0), "cg/firstkiss/eye_[eye_type]_[eye_color].png",
     (0, 0), "cg/firstkiss/hair_[hair_type]_[hair_color].png",
     (0, 0), "cg/firstkiss/skin_tone_[skin_tone].png",
     (0, 0), "cg/firstkiss/line_art.png")
You'll have to create the changes using layers in your Photo Editor. GIMP and Photoshop can do this. You'll want to set them up to something like this:
eye_1_blue
eye_1_green
eye_1_brown
eye_2_blue
eye_2_green
eye_2_brown
hair_1_brown
hair_1_blonde
hair_1_red
hair_2_brown
hair_3_blonde
hair_4_red
skin_tone_1
skin_tone_2
skin_tone_3

So that when displayed it looks right over the base image. In both Photoshop and GIMP you can then run a script called "Save Layers to File", which will save them individually. Just ensure that you don't trim transparency when you run the course. You will have to rename them, but if you keep the layer names to match your variable path you'll only have to modify it a little bit.

I hope this helps.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], jeffster, plastiekk