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:
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?
Also, the second sprite no longer shows?
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!
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!
#23
I completly forget about the faq, forgive me. Kinda of a stupid mistake really, considering the datablock is spelt that way in the documentation also, but i guess i thought it was spelt right because there was no errors in the console (those red texted sections).
<<<<<
1. Why is this, can you make your own datablocks and therefore that's why it wasn't read as an error?
2. Where is T2D's do loop function/section (e.g. It seems to go through a function once, then thats it?) so it runs my functions?
>>>>
I'm gonna have a closer inspection of the faq
Thanks to all again ;-)
03/31/2005 (12:03 pm)
YES! Finally, it worked, nice one Matthew, Thanks much! I completly forget about the faq, forgive me. Kinda of a stupid mistake really, considering the datablock is spelt that way in the documentation also, but i guess i thought it was spelt right because there was no errors in the console (those red texted sections).
<<<<<
1. Why is this, can you make your own datablocks and therefore that's why it wasn't read as an error?
2. Where is T2D's do loop function/section (e.g. It seems to go through a function once, then thats it?) so it runs my functions?
>>>>
I'm gonna have a closer inspection of the faq
Thanks to all again ;-)
#24
As you might think, creating about 24 animated sprites for each unit is kind of masochistic. And so, I decided to use setFrame(); with a fxStaticSprite2d image map with mode "CELL". Then, I used an algorithm to locate the correct frame on my sprite sheet.
Does the above method waste too much memory? Should I use animated sprites, or is my method ok?
@Leroy:
2. Are you referring to having a function (such as a main update loop) repeat? Try the schedule() command, perhaps?
03/31/2005 (12:30 pm)
On a somewhat related note, my current project is an RTS. Each unit has 8 directions (or 16, in the case of the vehicles) and the frames for each animation vary.As you might think, creating about 24 animated sprites for each unit is kind of masochistic. And so, I decided to use setFrame(); with a fxStaticSprite2d image map with mode "CELL". Then, I used an algorithm to locate the correct frame on my sprite sheet.
Does the above method waste too much memory? Should I use animated sprites, or is my method ok?
@Leroy:
2. Are you referring to having a function (such as a main update loop) repeat? Try the schedule() command, perhaps?
#25
Yep, that works, thanks, is that how torque does it huh, bit weird at first (i guess thats why they got it for the createEnemy() function in the tut)
Regarding your question, Obviously, im not a pro @ T2D yet, but IMO i would guess that your approach makes more sense for the task you want.
i couldn't tell whether it's gonna impact memory or speed wise as i image your gonna have a lot of sprites using this function for an RTS.
But, every1 keeps saying how fast an engine it is, thus it should take a lot before t2d has problems in those stakes, so you should be fine, but take my advice with a pinch of salt due to my (lack of) experience with the engine :)
03/31/2005 (2:34 pm)
@Ted:Yep, that works, thanks, is that how torque does it huh, bit weird at first (i guess thats why they got it for the createEnemy() function in the tut)
Regarding your question, Obviously, im not a pro @ T2D yet, but IMO i would guess that your approach makes more sense for the task you want.
i couldn't tell whether it's gonna impact memory or speed wise as i image your gonna have a lot of sprites using this function for an RTS.
But, every1 keeps saying how fast an engine it is, thus it should take a lot before t2d has problems in those stakes, so you should be fine, but take my advice with a pinch of salt due to my (lack of) experience with the engine :)
#26
I use the schedule command for an update loop, and it works without any problems.
03/31/2005 (4:40 pm)
I don't forsee any real problems, I was just wondering. The only way it would cause problems would be if changing the frame of a fxStaticSprite2d is significantly slower than running an animation of a fxAnimatedSprite2d.I use the schedule command for an update loop, and it works without any problems.
Torque 3D Owner Matthew Langley
Torque
to