Game Development Community

Non (POT bitmap)? and other fun questions of T2D!

by Leroy Frederick · in Torque Game Builder · 03/29/2005 (7:31 am) · 26 replies

Hello all,

Will this is my first T2D post (although i read them a lot), so i thought i'd add to the praise and say well done to melv and josh on a fantastic game engine (espcially considering it's allegedly in EA ;))

Anyway, here's the Q's,

1. what does this message that appears in the console mean

'Non POT bitmap loaded wasting approx 44944 bytes of video ram!'

example code:
datablock fxImageMapDatablock2D(playershipImageMap)
	{
		mode = full;	textureName = "~/client/images/Test/PlayerWebSave";
	};

i've saved my image in Photoshop CS as a png via save as and save for web, but it still says it?

2. I've a 5 by 3 image (15 frames) and i want to load it as a animated sprite then play it, is the following right?

datablock fxImageMapDatablock2D(playershipImageMap2)
	{
		mode = cell;	textureName = "~/client/images/Test/Player Walk (15 Frames)";
		cellCountX = 5; cellCountY = 3;
	}

Also, the second sprite no longer shows?
$player[0] = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
	$player[0].setPosition("420 300");
	$player[0].setSize( "40 40" );
	$player[0].setImageMap( playershipImageMapB );		
	$player[0].setFrame( (1+(getRandom()*14)) );

I'm migrating from DB Pro, so i'm a virgin c++ script/torquescript coder :), so be gental ;-)

Thanks in advance guys & gals, keep torqueing!
Page «Previous 1 2
#1
03/29/2005 (7:37 am)
The "non-POT" bitmap explanation is actually in the forums somewhere, but to summarize: graphics card expect (require?) bitmap to be in "Powers Of Two", i.e. 32x32, 256x128, 1024x768, etc. If you supply a bitmap not set up this way, T2D automatically expands up to the next power of two in each dimension, but tells you about it (the warning). If you happen to have a bitmap that's like 1025x769, it would make sense to remove the single extra pixel column and row to trim down your bitmap...otherwise, it's not a serious issue for you.
#2
03/29/2005 (8:00 am)
Whoa, that was quick!

Thanks Stephen, i'll have another go,
any ideas on the other Q's?


EDIT: Your right stephen, it is in another post, i was searching for 'POT' as opposed to 'power of two', so it didn't come up

here's the link for anyone that wants it
www.garagegames.com/mg/forums/result.thread.php?qt=27522
#3
03/29/2005 (8:06 am)
The first thing to note is a possible typo in your code. When defing your datablock, you call it: playershipImageMap2 but when setting the imagemap, you reference: playershipImageMapB.

For Cell type graphics, you need to also use CellWidth and CellHeight to define how many pixels each cell is.

If you cells are odd sized, then you should use Key mode and draw a distinctly coloured (like bright pink) 1 pixel grid to split up your sprites.
#4
03/29/2005 (8:32 am)
@Philip:

I noticed the playershipImageMap2/playershipImageMapB thing, but thanks for stating it :).

The cells are 150 by 150 - 750x450 image size (15 frames in all).
I'll try CellWidth and CellHeight. thanks again.

@Every1: I successfully got the POT warning at by, but my image is now 128x128 (as opposed to 150x150), this is fine but it means i won't be able to camera zoom as much without a crusty looking image.

I'm aiming for 15-30 frames per animation (e.g. Walk, Run, Jump etc), baring this in mind, which option do you thinks best?

Do you think it would be best to keep my 150x150 frames images (as Stephen stated, the memory will set aside 256x256 instead, decent zoom levels), have 128x128 (less zoom, but less memory) or go 256x256 (more zoom, bigger png file sizes)?

Thanks in advance!
#5
03/29/2005 (8:41 am)
The "Non POT bitmap loaded" is just a warning... And it refers to the entire image, not each individual cell in the image.

I generall just ignore it.
#6
03/29/2005 (8:43 am)
Like Harold says, its just a warning... meant to be there for additional tweaking if you so choose :)
#7
03/29/2005 (8:50 am)
@Harold & Matthew: So it looks @ 750x450 as opposed to 150x150 individual cells, i understand now.

thanks guys :-).

also, according to melv, it's only neccesary if your aiming @ older/weaker video cards.

@all:
I'm gonna see if i can get my animation playing now ;-), if not, as in the words of arnie, 'i'll be BACK!'
#8
03/29/2005 (12:34 pm)
Ok guys, here's where i'm at,

both sprites are showing, both are set as animated sprites, setframe command works, but $player.playAnimation(AnimatedPlayerMap); doesn't

here's the science bit, first the datablock:

datablock fxAnimatedSpriteDatablock2D(AnimatedPlayerBlock)
	{
		imageMap=AnimatedPlayerMap;	animationFrames=""; animationTime="0.75"; 
		animationCycle=1; randomStart=0;
	};

now the player code:

$player = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
	$player.setPosition("40 300"); $playerShipSpeed=60;
	$player.setSize( "40 40" );	
	$player.setImageMap( playershipImageMap );
	$player.fireLinkPoint = $player.addLinkPoint( "0.45 0.2" );
	$player.setWorldLimit( clamp, "0 0 800 600" );
	$player.setFrame("10");
	$player.playAnimation(AnimatedPlayerMap);

so,
1. Why isn't may animation playing? and
2. Looking at the manual/reference, how do you tell when a command is a sprite.command or a datablock command
#9
03/29/2005 (12:45 pm)
In your animation datablock you need to specify your frames.
As far as I know it doesn't default to all of them.

It should be a space separated list of values, i.e. "3 5 7 9" if you wanted to play every other frame for the animation.

Also, as far as I know there aren't any datablock functions, I'm pretty sure all a datablock is is data, in a block. =)
#10
03/29/2005 (12:55 pm)
Thanks Joseph, i'll try that.
#11
03/29/2005 (12:55 pm)
@Leroy
In concern of your POT errors and your sprite size. I personally, would create my sprite at 256 x 256 if you feel it is necessary to get the appearance you want. Then use the .setSize() function (is that a function, a property maybe?) to set the Sprite's size in game units. This should allow you to get the visual detail you seek, while maintaining a small physical size on screen, with the ability to zoom in and it look decent.
#12
03/29/2005 (1:07 pm)
@Michael: Originally, my image was at 200x200, but i brought down to 150x150 and i'm using the setsize() function to set it at 40x40, giving it around a 2-3 times ratio of zoom potential.

My only concern with doing a 256x256, is with the amount of animations i may have (run, jump, etc), it may get a little too large disk space wise, espcially if my original 30 frame animation looks dodgy as a 15 framer and thus i'd have to resort back to 30 frames and even larger file sizes :O.

Thanks for your thoughts/advice :-)

@all:

I'll let you guys know how i get on with getting my ani playing.
#13
03/29/2005 (1:14 pm)
@Joseph:

regarding specifying the frames, according to the reference manual it says:

NOTE:- If this is left blank then ALL frames from the image-map are used.

Anyhow, i tried as follows

animationFrames="1 2 3 4 5";

and guess what, nothing < :-(- > !?

@all:

Any other ideas?

Thanks in advance!
#14
03/29/2005 (1:15 pm)
Everytime i press refresh, it keeps posting again?

anyway, above message, not here!
#15
03/29/2005 (2:10 pm)
Is $player a fxStaticSprite2D still? Or did you change it to be an fxAnimatedSprite2D?

Also as far as I know (don't trust anything I say, already proven I know next to nothing) fxAnimatedSprite doesn't have a setImageMap, it's image is determined solely by the animation you play.
#16
03/29/2005 (5:39 pm)
$player.playAnimation(AnimatedPlayerBlock);
#17
03/31/2005 (7:26 am)
Did that work for you ? Lol ok you got me curious :)
#18
03/31/2005 (9:13 am)
Sorry guys, i went a bit AWOL checking out the DB beta patch, emails etc. Thanks for all the help thus far though!

@Matthew: You'll have to stay curious a little longer, i'm trying it now ;)

I'll be back.
#19
03/31/2005 (10:36 am)
Nope, it didn't work, i find this all too confusing. The intro tutorial is very good, better then any previous TGE tuts, although the collision part lost me.

At this rate, i think i'll have to stick to db for the moment, it all seems a bit cryptic.

For instance, take db, you put your commands in gosub's and functions (this carry variables in a similar way), you have a 'do Loop' command, put your if's here and there, when the case is true your command is ran.

Wanna load an image, you 'Load Image,ImageNum,Filename$,TextureStyle' simple, whats all this is it a datablock, is it a function run around.

Sorry, im sounding a bit defeatest, i just wanna get my head around it :-s

SetFrame() doesn't work with fxanimatedsprite2D? Strange, besides, i thought that command was for large sprites, tile and scrolling backgrounds, that chunked thing?

And i have read the torqueScript documentation, but the datablocks part still lost me. I'm not scared of torques C++ like syntax or c++ for that matter, but the way it goes about is business is really baffaling me! :(

Anyway, enough ranting:

1. Is fxAnimatedSprite2D for big sprites/tiles/scrolling?

2. I attempted to make a simple static sprite player, because i can use the set frame command with fxstaticsprite2D and increment it over time

I put it in CreatePlayer function, but it only goes in once, where is T2D's loop function/section (e.g. I could only get it to work lamely in the player movement) so it runs my function?

3. the $player.playAnimation(AnimatedPlayerBlock) comes up as 'invalid fxAnimationSpriteDatablock2D' in the console, and the sprite isn't on the screen after changing the Static to Animated?

Thanks in advance guys and gals!
#20
03/31/2005 (10:38 am)
Torque 2D Unofficial F.A.Q.

compare it to the example I have in the FAQ... #6
Page «Previous 1 2