pie charts

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
pucedragonlord
Regular
Posts: 159
Joined: Wed May 09, 2012 2:49 am
Projects: The Diviner
Organization: Two Crowns Entertainment
Location: Now: Charlottesville, VA
Contact:

pie charts

#1 Post by pucedragonlord »

I'd like to implement some sort of visual percentage representation in my game. Pie charts are the standard for such data, but I'm not sure how to go about them in RenPy in any way that isn't a little hackey (making a 1/360th of a circle and repeating it, for example). Anyone know a good way to go about this? Could I even just do it in Python using whatever rendering base RenPy uses (OpenGL? I'm actually not sure)?

This is a bit of a challenge, to be sure, but it would be neat to see it done.
The more you know

User avatar
Kaen
Regular
Posts: 148
Joined: Tue Oct 16, 2012 10:49 pm
Contact:

Re: pie charts

#2 Post by Kaen »

I'd like to use it as well! If you find a way how to do this, please share >~<

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: pie charts

#3 Post by PyTom »

There isn't really a good way to do this at the moment. At some point, I'll add support for geometry, but we don't have that yet.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

pucedragonlord
Regular
Posts: 159
Joined: Wed May 09, 2012 2:49 am
Projects: The Diviner
Organization: Two Crowns Entertainment
Location: Now: Charlottesville, VA
Contact:

Re: pie charts

#4 Post by pucedragonlord »

hackey ways it is, then!
The more you know

User avatar
fluxus
Regular
Posts: 133
Joined: Thu Jun 19, 2014 8:06 am
Projects: Animal Anaesthesia (a teaching game)
Contact:

Re: pie charts

#5 Post by fluxus »

Wouldn't a DynamicDisplayable be able to do this?

I think PyGame has some circle and arc functionality. I'm not entirely sure of how PyGame should be used from inside a DynamicDisplayable, or if there's some explodey potentials in that mix, but offhand it seems like a good idea.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: pie charts

#6 Post by xela »

fluxus wrote:Wouldn't a DynamicDisplayable be able to do this?

I think PyGame has some circle and arc functionality. I'm not entirely sure of how PyGame should be used from inside a DynamicDisplayable, or if there's some explodey potentials in that mix, but offhand it seems like a good idea.
Doesn't look like UDD is going to work (edges are messy, both with circle and polygons approach):

Image

Best bet is to try and slice predefined images but I am not sure how to go about writing that code atm.
Like what we're doing? Support us at:
Image

User avatar
fluxus
Regular
Posts: 133
Joined: Thu Jun 19, 2014 8:06 am
Projects: Animal Anaesthesia (a teaching game)
Contact:

Re: pie charts

#7 Post by fluxus »

xela wrote:
fluxus wrote:Wouldn't a DynamicDisplayable be able to do this?
Doesn't look like UDD is going to work (edges are messy, both with circle and polygons approach)
Hmm. I see what you mean. And yes, sorry, I did mean userdefined displayable.
Strange thing with the blurred edges though.

Winter Wolves, in Loren, displayed hit points and mana points with circular-style bars.
Maybe they know something we don't :]
xela wrote: Best bet is to try and slice predefined images but I am not sure how to go about writing that code atm.
You could always.. rotate and crop a semicircle, then livecomposite with another (or well, the same) semicircle depending on whether you want more or less than 180 degrees.

Not the most elegant solution, I'm sure :]

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: pie charts

#8 Post by xela »

I think they just used conditioned images in Loren or a custom bar(less likely). I coded a two images bar one of which rotated over the other similar to that for someone on this forum few month back. There is a pretty full circle bar in a game I worked on for a bit made out of 110 images.

I have no idea why udd comes out like that. That was rendered using polygons but even a circle seems to come out edged a bit.

There is no reason for a 'hacky' way not to work. You can even recolor the segment in renpy.
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: No registered users