Do Ren'py support sprites / spritesheets? [SOLVED]

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
User avatar
Luxliev
Veteran
Posts: 242
Joined: Sat Feb 07, 2015 11:01 am
Soundcloud: Luxliev
Contact:

Do Ren'py support sprites / spritesheets? [SOLVED]

#1 Post by Luxliev »

Do Ren'py support sprites / spritesheets? As in subject.
Last edited by Luxliev on Thu Nov 26, 2015 8:00 am, edited 1 time in total.
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc

Forum with my music: http://luxliev.proboards.com/

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: Do Ren'py support sprites / spritesheets?

#2 Post by PyTom »

Yes, but to be honest they're less efficient than just loading from multiple files.
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

User avatar
Luxliev
Veteran
Posts: 242
Joined: Sat Feb 07, 2015 11:01 am
Soundcloud: Luxliev
Contact:

Re: Do Ren'py support sprites / spritesheets?

#3 Post by Luxliev »

Loading multiple files is more efficient? That's good news to me but if it's not a problem can I know why? Almost everyone says that spritesheets have better performance and use less space.

I just want to be sure before I'll write code. I'll probably use more than hundred images for animation and I have plans for mod support.
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc

Forum with my music: http://luxliev.proboards.com/

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Do Ren'py support sprites / spritesheets?

#4 Post by nyaatrap »

I'd also like to know which is efficient:

Code: Select all

image animation:
    "A.png"
    pause 1
    "B.png"

image animation:
    "spritesheet.png"
    crop rectA
    pause 1
    crop rectB

User avatar
Sword of Akasha
Regular
Posts: 61
Joined: Sun Dec 14, 2014 6:51 am
Projects: Shadows of Shattered Dreams
Organization: Akashic Creative Studios
Deviantart: Sword-of-Akasha
Contact:

Re: Do Ren'py support sprites / spritesheets?

#5 Post by Sword of Akasha »

I'd recommend using different images instead of sprite sheets. I like it much better as an artist since it allows greater freedom in expressions regarding not just the face but the body. Posture and etc can be easily set to correspond to an emotion. Sprite sheets that only change the face are kind of bit boring to me.
Image

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: Do Ren'py support sprites / spritesheets?

#6 Post by PyTom »

Well, when I said spritesheet, I meant Filmstrip, which nobody uses anymore. That loaded the entire image into memory, and then cropped it in a way that meant it doubled memory usage.

I don't have that much a sense of which - if any - of the proposed methods are faster. My general thinking is that Ren'Py is usually fill-rate limited, so once the images are loaded (which occurs in the background) you're going to get the same performance.
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

User avatar
Luxliev
Veteran
Posts: 242
Joined: Sat Feb 07, 2015 11:01 am
Soundcloud: Luxliev
Contact:

Re: Do Ren'py support sprites / spritesheets?

#7 Post by Luxliev »

Sword of Akasha wrote: I like it much better as an artist since it allows greater freedom in expressions regarding not just the face but the body.
Spritesheets do not limit you in any way. What they are is one big image for character instead of tens or hundreds. Also because there is only one image to load it's much bettter for performance and memory usage at least that's what I was told. Example below:
Image

For simple python code you can make all frames used for animation in the same size:
Image

You can also see examples of that in RPG Battle Engine in Cookbook section.

Good tutorial on spritesheets:
http://gamedevelopment.tutsplus.com/tut ... edev-13099
PyTom wrote:My general thinking is that Ren'Py is usually fill-rate limited, so once the images are loaded (which occurs in the background) you're going to get the same performance.
So all images are loaded on the fly? I'm really curious how this exactly work in Ren'py. Is there some link explaining this? For example when I replaced image when game run and game loaded it again it was the same image as before change, not the new one. So are new images loaded after all images loaded exceed fill-rate limit?
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc

Forum with my music: http://luxliev.proboards.com/

Counter Arts
Miko-Class Veteran
Posts: 649
Joined: Fri Dec 16, 2005 5:21 pm
Completed: Fading Hearts, Infinite Game Works
Projects: Don't Save the World
Organization: Sakura River
Location: Canada
Contact:

Re: Do Ren'py support sprites / spritesheets?

#8 Post by Counter Arts »

I think spritesheets are generally used in traditional games since textures have to be a certain size multiple, and then you just choose texture co-ordinates for quads.

The predictive algorithms are in renpy that "look-ahead" to potentially used images are used to load images that are upcoming. If you heard of "branch-prediction" in CPU architecture you'd get a similar idea only with images.

EDIT: I'm going to guess a little bit about the predictive loading in Ren'py. In traditional games, most vary with what they need to load and when. Visual Novel actually have quite similar loading behaviours and not huge amounts of variants in the immediate future.

AAA studios usually load absolutely everything they need in a level into memory (after working 512 MB of RAM for a decade). This is the ensures that the game console won't have to stop the action to load a texture or something.

Then there is something like "load-on-demand" textures and resources where you load something from disk when the game calls for it. You don't quite have to worry as much on fitting everything in RAM. However the game will literally stop, load the texture, then resume everytime a texture is not loaded but needed to draw something.

Ren'py looks ahead in the script around 10-100 lines. It check for any graphical resources and loads them ahead of time. If there is a "branch" then it actually looks ahead all the possible branches and loads a little bit of each of them.

At least my in my guess... this is how I think it works.
Fading Hearts is RELEASED
http://www.sakurariver.ca

User avatar
Luxliev
Veteran
Posts: 242
Joined: Sat Feb 07, 2015 11:01 am
Soundcloud: Luxliev
Contact:

Re: Do Ren'py support sprites / spritesheets?

#9 Post by Luxliev »

Counter Arts wrote:I think spritesheets are generally used in traditional games since textures have to be a certain size multiple, and then you just choose texture co-ordinates for quads.
I think that textures are always square powers of two (64, 128, 256, 512, 1024 etc) correct me if I'm wrong. Normally you don't have to worry about that but if you're making image heavy app or game you should now that it's better to make sprite that's 512x512 pixels big instead of for example 520x520 because now your gpu uses bigger texture size 1024x1024 and you waste most of the space in it.
Counter Arts wrote: The predictive algorithms are in renpy that "look-ahead" to potentially used images are used to load images that are upcoming. If you heard of "branch-prediction" in CPU architecture you'd get a similar idea only with images.

Ren'py looks ahead in the script around 10-100 lines. It check for any graphical resources and loads them ahead of time. If there is a "branch" then it actually looks ahead all the possible branches and loads a little bit of each of them.
That's interesting! I really want to know more. If your prediction is correct then spritesheet seems like better idea than multiple images in for example Turn based RPG battle. Thanks for all answers if anyone knows more how Ren'py works please add reply.
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc

Forum with my music: http://luxliev.proboards.com/

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Do Ren'py support sprites / spritesheets?

#10 Post by nyaatrap »

It's not wise to use 2^n texture in ren'py. http://lemmasoft.renai.us/forums//viewt ... xt#p349564

You can know when images are loaded by showing _image_load_log screen. I always show this screen at splashscreen while I'm developing my game.
I use spritesheet on battle animation in my RPG, because it's easily coded when to loads images before they're used. It's for coding efficiency, not for performance.

User avatar
Luxliev
Veteran
Posts: 242
Joined: Sat Feb 07, 2015 11:01 am
Soundcloud: Luxliev
Contact:

Re: Do Ren'py support sprites / spritesheets?

#11 Post by Luxliev »

nyaatrap wrote:It's not wise to use 2^n texture in ren'py. http://lemmasoft.renai.us/forums//viewt ... xt#p349564
This is really important information I've created new topic so more people could see this. If there are plans to change this I might have problem with my spritesheets.
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc

Forum with my music: http://luxliev.proboards.com/

Post Reply

Who is online

Users browsing this forum: Bing [Bot]