Please explain image memory usage
Moik
Member, PRO Posts: 257
From what I read somewhere else, images take 4 bytes of memory per pixel, regardless of compression. I'm wondering if there's any frustum culling or anything. Like, if I have a 2048x4096 image on a 2048x1536 screen, am I looking at the background eating 33megs, or would it only be 10? Does having plain actors on a more forward layer reduce the load, or are they 4 bytes per pixel as well? Are transparent pixels still 4 bits (I'm guessing opacity is the fourth byte and there's no simple one-bit alpha channel option)?
Comments
33.5megs. The thought experiment that illustrates this is a moving or growing (in size) image.
Arbitrary terms confuse computer, destroy, destroy, destroy . . . . !
What does 'plain' mean, in this context and what does 'a more forward layer' mean ?
Yes, a transparent pixel would be - depending on the action going on in the colour channels - X,X,X,0 (RGBA).
Plain Actor would be an actor object with no image attached. Like if you were to just go "add an actor" then drag it onto the scene. That scale-able box thing. I'm assuming they're vector shapes rather than raster.
When I right-click on Actors I get some "Move Forward" and "Move Back" options which I take to be layers. If there is an image-less actor in front of an imaged actor, does the memory change in any way (like if the rendering engine starts ignoring the blocked portion of the background image).
Ah ! Yes, gotcha, I was thinking you meant a graphically simple image . . .
Yes, actors without images applied reduce load.
No, it makes no difference, once an image is loaded into RAM then occluding a part of it - or even all of it - will not flush it from memory.
The thinking here - correct me if I'm wrong - is that what is on screen defines memory usage, but in reality memory usage is defied by what's in RAM.
@Socks
Hrm... so, basically I want to make an isometric tarmac (a long airport runway looking thing). Would my best bet would be to use an appropriately shaped & rotated large grey actor and then toss some "landing lights and painted lines" mini-images on top of it?
The large grey actor has a negligible memory footprint?
Yes, a large grey actor (generated within GS) will have a negligible memory footprint.
@Socks
Swag, thanks for the help. I can't skew the actor the right way to get isometric, but at least messing with reshaping it showed me a new way to fit an image in (rather than rotate and skew an image and put it in a square actor, or rotate and skew an actor, I'll skew the image and put it in a rotated actor).
I think there are probably a few tricks you can do (depending on your needs) without the need to import (processor hungry) images - or any images at all.
Example, here's a spawned ISO runway - not very efficient, you could do it far fewer actors but it gives you an idea . . . .
https://www.mediafire.com/?ttnmdlukgiddiro
More efficient version:
https://www.mediafire.com/?j8x0yv84841sfma
. . . . etc etc
@Socks The file uses a Newer Version of Game Salad than I have
I'm on PC (I just asked this on Mac since it's a general question and this forum is more active).
This is what I did to check if the skewed image would look right rotated.
http://s000.tinyupload.com/index.php?file_id=68490681534496473733
(I have no idea of the risk level of this file hosting site)
I don't like that it animated and doesn't just start at the right rotation. No idea how to do that.
Well there is a speed setting in the rotate command you used, you don't have to leave it at 90 (degrees a second) - you could put it on 2,000,000,000 if you want !
But even simpler would be to put a change attribute behaviour in the actor - and set it to 45°
Or even simpler still, just rotate your actor to the angle you want.
In fact you don't need the change image behaviour or the rotate behaviour or the landing strip attribute at all, I'd get rid of all that stuff and just place the actor in the scene how you want.
P.S Isometric tends to be 30° rather than 45° (but of course there are no rules !!)
@Socks OH SNAP.
THERE WAS A ROTATION ANCHOR POINT THIS ENTIRE TIME.
I had moused over the corners looking for it. Didn't think to look in the center. Right in front of my nose... jeeze.
Anyways, 30°? What do you mean? The way I learned to make isometric was to rotate the image 45° then shrink its height to half.
I saw you'd rotated the image by 45° and presumed you were going for a 45° projection.
(you cannot shrink an actor to half its height this way in GameSalad).
I think a 45° line squashed in the vertical access to 50% is around 26° (or thereabouts).
Haha, yeah, I tried a... I forget the command... animate(?) on self.y to be like self.y/2... and when it animated it did a cool flippy spinny thing and ended up in a completely irrelevant \ looking shape. That's why I moved on to skew in image and rotate on actor.
You could divide your image up like this - to make it more efficient:
A and C are the same image, C is just rotated by 180° compared to A . . . B is just a grey block generated inside GameSalad . . . . so all you'd have to import is A, a lot less of a strain on a mobile device's processor than a whole length of runway.
Here's one the above files you couldn't open - runway generated without any images (all generated within GameSalad) . . . . . basically the point is there is a million ways of doing this, you just need to work out something that is (processor) efficient and meets your own particular needs.
@Socks ELEGANT. I LIKE THIS. Using that division system. That's a super neat trick for the runway drawing too.
The 'runway' I'm building out is actually the floorplan for a spacetrucker garage, office, gas bar, and launch pad. It's just laid out in an isometric strip which would resemble a runway if you took the buildings away. Better aesthetics than top-down or side-view, more commercial/professional looking.
It's likely going to be a safe assumption with me that whatever I'm asking about isn't actually what I'm asking_ for_. Like, all my prior randomization questions used RPG metaphors because I expect people will understand those more easily than the "redneck-themed spaceship-dispensing slot-machine" I'm actually making.
In the future when you show up, I'll cut right to the exact use case, and skip the analogies.