Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Saving memory using small upscaled images?  (Read 4836 times)

0 Members and 1 Guest are viewing this topic.

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Saving memory using small upscaled images?
« on: April 09, 2014, 11:04:08 AM »

I have a question about memory usage.
If I use one image several times in the same scene, will it weight as one image in the memory?

Examples:

1- Backgrounds:
In a very wide scene (10000x1080px), I use a repeated image for the background.
My background image is 1000x1080px and is repeated 10 times.
When the scene is loaded, does it load the background image only 1 time, even if it's used 10 times?
Is my scene as light as if it was only 1000x1080px, or as heavy as if it was 10000x1080px?

2- Actors:
My game takes place in Japan so my character is supposed to take off her shoes everytime she enters a house.
My idea is to have 2 main actors loaded in the game.
The first actor has naked feet.
The second actor's sprites reuse the same frames as the first actor. And I add small subframes for the shoes.
So my question is:
If I have 2 actors using the same frames (plus small subframes for the second one), will it be loaded in the computer's memory as 2 actors (loading the frames 2 times) or as 1 actor (loading the frames one time for the 2 actors + subframes)?

I hope my question isn't too muddled... It was difficult to explain in English.
Thank you!
« Last Edit: July 18, 2014, 11:43:17 AM by Atelier Sentô »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Saving memory using repeated images?
« Reply #1 on: April 09, 2014, 05:13:57 PM »

A single image is always loaded only once, no matter how many times it's referenced by various game objects.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Re: Saving memory using repeated images?
« Reply #2 on: April 09, 2014, 05:24:42 PM »

So I can save memory and create very large scenes by repeating an image background and I can have multiple versions of my main actor just by changing some subframes.
It's an excellent news for me!

Many thanks, Mnemonic!
It helps me a lot.
Logged

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Re: Saving memory using small upscaled images?
« Reply #3 on: July 18, 2014, 12:03:51 PM »

Hello,
I have another question about saving memory.

I often use large trasparent png in my game to create lighting effects (sun rays per example).

A friend suggested to resize them 4 times smaller in photoshop and then to attach this code to the entities:
Code: WME Script
  1. this.Scale = 400;
So they will be displayed at the expected size in the game.

I seems to work very well (the HD image is already blurry so there's no visible difference with the small upscalled image).

Is it a good way to save memory in the game?
Should I try to use this trick as often as possible?

Thank you for your help!
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Saving memory using small upscaled images?
« Reply #4 on: July 18, 2014, 12:15:12 PM »

If you don't mind the quality difference then yes, this will save a lot of video memory.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Re: Saving memory using small upscaled images?
« Reply #5 on: July 18, 2014, 12:24:31 PM »

Great ! So I will use this trick everywhere it can't be noticed.
Many thanks for the answer!
Logged
 

Page created in 0.039 seconds with 25 queries.