Game Development Community

Not understanding the level datablock stuff for animation

by Michael Cozzolino · in iTorque 2D · 02/15/2010 (6:58 pm) · 8 replies

This is my animation datablock in level_datablocks

new t2dAnimationDatablock(penguinPlayerAnimation) {
      animationCycle = "1";
      animationFrames = "2";
      animationTime = "1";
      canSaveDynamicFields = "1";
      imageMap = "penguinPlayerImageMap";
      randomStart = "0";
      startFrame = "0";
};
[code]

This is my .t2d

[code]
new t2dAnimatedSprite(playerPenguin) {
      animationName = "penguinPlayerAnimation";
      canSaveDynamicFields = "1";
      class = "player";
      Position = "-0.000 10.000";
      WorldLimitMin = "-98.144 -71.268";
      WorldLimitMax = "98.181 72.908";
      CollisionActiveSend = "1";
      CollisionActiveReceive = "1";
      CollisionPhysicsSend = "0";
      CollisionPhysicsReceive = "0";
      CollisionCallback = "1";
      CollisionResponseMode = "KILL";
      BlendIgnoreTextureAlpha = "0";
         mountID = "2";
      _behavior0 = "FollowMouseBehavior";
   };

Can someone give me an example of setting this up.

I keep getting
2/15/10 5:50:55 PM [0x0-0xe50e5].com.garagegames.torqueGameBuilder[8691] t2dAnimationController::playAnimation() - Invalid t2dAnimationDatablock datablock (penguinPlayerAnimation)

I haven't really found an example of setting this up.

Thanks.

About the author

Indie Developer in the Albany NY area. iOS, PC, Mac OSX development. http://itunes.apple.com/us/artist/michael-cozzolino/id367780489


#1
02/15/2010 (7:16 pm)
There could be many reasons for the error. We need more information.

I'd first make sure that level_datablocks.cs is located in "game/data/levels/datablocks/level_datablocks.cs" and that the .t2d file is called level.t2d .

I'd also make sure that the penguinPlayerImageMap is also located within level_datablocks.cs and is a cell type imageMap.
#2
02/16/2010 (3:20 am)
penguinPlayerImageMap does not exist at the time of that getting executed, make sure it exists first.
#3
02/16/2010 (2:29 pm)
Thanks guys. I didn't have the penguinPlayerImageMap existing. For future reference is this stuff not updated in TDN yet? Is there a source where I can find these little things? I feel like I'm missing things that used to be easy to find? I thought I read all of the docs that came. Maybe I inadvertently skipped a section? I don't like asking questions until I have done a full search.

Thanks :)
#4
02/17/2010 (4:41 am)
I think these are just things you learn along the way. There are still the normal TGB docs that come with as well, which may contain information as the newer iphone docs are specific to the platform.
#5
03/19/2012 (11:31 pm)
are "level datablock files" still not automatically created ?
aka: I have to manually edit the file with thousands of lines to make an average game-scene work ?

//edit;
I found the button for moving them..I don't like that but it's better than nothing.
#6
05/07/2012 (9:24 am)
What's this "button for moving them"? I'm having an issue with some images I've added in a project being visible and others not and there are definitely no datablock files being generated in "game/data/levels" when I create a new level.
#7
05/11/2012 (12:59 am)
No level data blocks are not automatically created as that would defeat their point in allowing you to optimize whats loaded when and more importantly: What is NOT unloaded when ;) (you don't want to unload level datablocks taht will be used on the next level again for example as that will cut down loading time a lot - many 2d games can likely load the level datablocks once in a 'pre play level' level and then just keep them alive for the rest of the runtime and run at very short loading times.
Thats a thing that wouldn't be possible with automatic datablocks as they would naturally also require to automatically clean it all up at the end of the level as levels are no 'linear construct' which prevents the engine from predicting what it needs to keep
#8
05/11/2012 (12:06 pm)
While we do not want to automate everything to the point of making level datablocks worthless, I have made some tweaks in our R&D branch that do help a little. For example, if the sprite is in the scene you are editing, and you click play, it will automatically get added to the level datablocks file.

This is working under the assumption that you wanted to see it, so we will show it to you. This will not add ALL the datablocks from your editor, just what you wanted to test. Manual unloading is still a requirement. There are a few other test cases our QA caught and we fixed:

* ImageMaps are automatically added before animation datablocks
* The required ImageMap will automatically be added if it's just the animated sprite in the scene
* Persistent objects are included in the automation. Oh, yeah, persistent objects work again in our R&D build.
* ImageMaps used for tilemaps will be automated on a per-level basis