User Customization (several questions)

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
panther25
Newbie
Posts: 1
Joined: Sat Sep 10, 2011 6:10 pm
Contact:

User Customization (several questions)

#1 Post by panther25 »

Hello!

I am creating a business/shop game in which I want the player to be able to customize the look of their building's exterior and interior.

I have a few questions regarding this:

1. How do I make certain items (e.g. wall color, a decoration) inaccessible until a certain level?

From what I have read online, it seems that I will need to use persistent data, but being relatively new to Ren'py, I am unsure how that feature works.

2. I am doing my own artwork, including backgrounds. How can I easily make the options appear without having to draw hundreds of different buildings for all the combinations?

I would really like to have a menu where the player can choose wall color, roof color, doors, windows, and decorations. But to draw all of the buildings with all of the possible combos would take my entire life.

Again, I have done a bit of research and I believe there is a way to accomplish this using layered sprites and ConditionSwitch? But I need an explanation on how to use those things for my specific situation. I have read the tutorials and whatnot on them, but what I want to do seems a little different than the examples given.

3. Once the player chooses the options they would like on their building, how do I get the building to reflect their choices every time they return to it?(e.g. I don't want them to choose a pink building and then when they go to the exterior of their business after the first time the building goes to default.)

And finally!

4. I want the player to be able to change their choices later. I want to know how to make the building change the second time according to what they choose. And how to make it stay that way until the player changes their choices again. (This may have the same answer as Q3... I apologize if it does, but I wanted to make sure there wasn't something I was missing.)

Thank you for anyone who answers. I realize I am asking a lot here.
If you have any questions, please ask. Sometimes what I am trying to say can come out a bit confusing when I try to explain it. Lol :)

User avatar
Gear
Miko-Class Veteran
Posts: 764
Joined: Tue Apr 05, 2011 10:15 pm
Projects: Tempestus Sum
Organization: Xenokos Interactive
IRC Nick: Gear
Skype: Skye.Gear
Location: Grand Prairie, TX
Contact:

Re: User Customization (several questions)

#2 Post by Gear »

My friend, you're going to be using a LOT of flags.

1. How do I make certain items (e.g. wall color, a decoration) inaccessible until a certain level?
Basically, you'll use a persistent flag. The full explanation is here:
http://renpy.org/wiki/renpy/doc/cookboo ... g_the_game
You'll create a persistent flag at the point where you want something to unlock, then have it only unlock if the flag value is true, or whatever value you wish to specify.

2. I am doing my own artwork, including backgrounds. How can I easily make the options appear without having to draw hundreds of different buildings for all the combinations?
EASILY? Good luck. But the only way I can think of is to manually have each item created. For example, if your player has an option of a red roof or a blue roof, you would have one image "blueroof.png" and another "redroof.png" ready. Then, using your if/then statements, if the player chooses blue roof, you'd have to code in for it to show blueroof, then give coordinates (xpos, ypos, yanchor, xanchor, etc.) Positioning elements is a tutorial found in the tutorial game that comes with Ren'Py.

3. Once the player chooses the options they would like on their building, how do I get the building to reflect their choices every time they return to it?
I THINK (emphasis on think, I've never tried it) that it would require another persistent flag. If persistent.red=true kind of thing. Refer to the above tutorial.

4. I want the player to be able to change their choices later. I want to know how to make the building change the second time according to what they choose. And how to make it stay that way until the player changes their choices again.
You're right, it's the same as the previous question. I believe that as long as you have your persistent flags working properly, there won't be an issue here, so study that tutorial carefully.

If someone else knows something I don't feel free to speak up. Otherwise, I hope this solves your problem.
The best reason to get up in the morning is to outdo yourself: to do it better than you've ever done it before. But if you haven't done it better by nightfall... look at your globe and pick a spot: it's always morning somewhere.

cosmo
Regular
Posts: 120
Joined: Mon Aug 29, 2011 11:01 am
Projects: | ZUKUNFT | Wayang Kulit - A Shadow Play (WIP version 0.1) |
Location: Germany
Contact:

Re: User Customization (several questions)

#3 Post by cosmo »

panther25 wrote:where the player can choose wall color, roof color, doors, windows, and decorations. But to draw all of the buildings with all of the possible combos would take my entire life.
There is a possibility at least to recolor sprites. It's explained in the demo (have a look at: "image operations"). Will not be suitable for every thing… but maybe you can use it in a creative way!
Have fun!
Project: Wayang Kulit - A Shadow Play
Status: First demo version "Proof of Concept" of my first project is out.

bink
Regular
Posts: 49
Joined: Sat Jul 09, 2011 4:34 pm
Contact:

Re: User Customization (several questions)

#4 Post by bink »

Gear wrote: 1. How do I make certain items (e.g. wall color, a decoration) inaccessible until a certain level?
Basically, you'll use a persistent flag. The full explanation is here:
http://renpy.org/wiki/renpy/doc/cookboo ... g_the_game
You'll create a persistent flag at the point where you want something to unlock, then have it only unlock if the flag value is true, or whatever value you wish to specify.
You only have to use persistent variables if you want the unlocked items to be shared across multiple saved games. That means after unlocking everything, even a new game will have all the items. If that's not necessary, regular variables will do.
I'd define a class for furniture and walls and such and give it a variable for the level requirement. Then, for example when displaying a list of furniture you can buy, you can just check if your current level is higher than or equal to the required level and display it.
Gear wrote: 2. I am doing my own artwork, including backgrounds. How can I easily make the options appear without having to draw hundreds of different buildings for all the combinations?
EASILY? Good luck. But the only way I can think of is to manually have each item created. For example, if your player has an option of a red roof or a blue roof, you would have one image "blueroof.png" and another "redroof.png" ready. Then, using your if/then statements, if the player chooses blue roof, you'd have to code in for it to show blueroof, then give coordinates (xpos, ypos, yanchor, xanchor, etc.) Positioning elements is a tutorial found in the tutorial game that comes with Ren'Py.
That is actually pretty easy if you write a class for these objects. You can then define them all the same way, using a default as a template and only changing the required values. Adding a new item is also easy. To make the game remember what items the player has, a list would be the way to go. Then you could use a for loop to go through that list and only have it check the items that the player has actually bought, instead of checking every item in existence to figure out if it was bought or not.
Gear wrote: 3. Once the player chooses the options they would like on their building, how do I get the building to reflect their choices every time they return to it?
I THINK (emphasis on think, I've never tried it) that it would require another persistent flag. If persistent.red=true kind of thing. Refer to the above tutorial.
As long as it's all in the same save file, there is no need to use persistent variables. As mentioned above, I'd create a list of existing items and a list with items that the player owns. Once an item is bought, the id of that item is saved into the list of bought items and can be used to retrieve info about the item (such as graphics, placement coordinates, color) very easily.


All in all, this seems like quite a complex project in terms of coding. Getting someone who knows exactly what they're doing might be the best idea. It's certainly not something somebody with little or no programming or Ren'Py experience should do. At least not if it's supposed to work properly and be finished before 2016. :P

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: User Customization (several questions)

#5 Post by Aleema »

LiveComposite + ConditionSwitch! People have been customizing sprites for a while now, and it didn't required hundreds of combinations. Look at the way I built this sprite.

Post Reply

Who is online

Users browsing this forum: No registered users