Game Development Community

good on paper::Animation Datablocks Invalid(SOLVED!!?!!)

by rennie moffat · in iTorque 2D · 05/11/2011 (10:27 am) · 41 replies

Hi,
I am getting this message. I dont get it. The animation in question is in my level datablock and managed datablock. Anyone ever come across this before?

t2dAnimationController::playAnimation() - Invalid t2dAnimationDatablock datablock

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.

#21
05/15/2011 (12:26 pm)
Hate to be the bearer of badd news but it still won't play. Same invalid animation datablock message. ??! weird. Again, I am going to rebuild the project and see what happens.



:(((
#22
05/16/2011 (12:31 pm)
I think I found the answer.


I had placed my animation datablocks ahead of, or before the actual imageMapDatablock. This is what caused it!!!!!


ps. @Michael. A full, pice by piece creation of a new project seems to have beaten the XCode issue.
Thanks.

#23
05/16/2011 (2:42 pm)
Hi Rennie

If you're serious about software development, you need source control :)

Here's my setup:

1) I have 3 machines: I work primarily in a Windows box. When I have changes in the code, I commit to the repository, that it's located in another machine, running Linux.

2) When I want to deploy to the Mac, I do a code update from the server.

Probably the best source control software you can get is a combination of svn (source control) and trac (web interface). Trac allows you to see all your code changes in a web browser. Tortoise svn is a good windows svn client. Some prefer git as source control.

check this out

trac.edgewall.org/wiki/0.11/TracOnUbuntu
#24
05/16/2011 (3:23 pm)
Thanks. How big are your projects Pedro? And why is it that you bounce between (or work in progression) machines?



Ps. I have only an iMac I do everything on except for Illustrator art, which is done on a laptop.
#25
05/16/2011 (3:46 pm)
I am developing a game for the iPhone, so I need a Mac. Most of the game code logic is in C++, some in script. I just use my favorite tools for productivity reasons, Microsoft Visual Studio and Torsion, both of which allow debugging, but are for Windows only.

If you want to know more about the project, it's something like this

tdn.garagegames.com/wiki/TGB/Tutorials/The_Game_of_Life

Basically a C++ array of objects interacting with each other on a grid, then rendered as tiles in Torque script.
#26
05/16/2011 (4:21 pm)
For version control, I use:

For an SVN server repository:
http://www.myversioncontrol.com/

For an SVN client:
http://www.syntevo.com/smartsvn/index.html

SmartSVN is by far the best SVN client I've found on the Mac so far, and it's worth the money. To work without version control is a big mistake.
#27
05/16/2011 (5:52 pm)
@ Richard,
So this is like a "time machine" software? I am just trying to get a better image of the use of these platforms. I can not see the difference between these and me just saving a project, with a new title every little while.




@Pedro
Quote:
Basically a C++ array of objects interacting with each other on a grid
I have been trying to better understand arrays, tho have not had the time. Can you better explain what you mean by this?
#28
05/16/2011 (7:09 pm)
An array is a data structure that stores consecutive elements of the same type. Elements are organized by dimensions. For a two-dimensional array, like a spreadsheet of rows and columns, the C syntax is

int array2d[ROWS][COLUMNS];

en.wikipedia.org/wiki/C_syntax

best book about the C programming language

en.wikipedia.org/wiki/The_C_Programming_Language



#29
05/16/2011 (7:32 pm)
So I am currently thinking of how I could build a grid, like Farmville or Trading Nations. Where you can drag and place objects around an area. Create a town. Would arrays be of no use here as this is more if a way to store and call objects? Sorry if that sounds random, just off the top of my head.
#30
05/16/2011 (8:19 pm)
Yes, if you have a grid game, you'll probably need a 2D array to organize your data in some way. Torque script has arrays, C syntax like.

If you go to the tutorial link above, all the game is centered around a grid, defined in the C++ part. The Torque script runs the game with a schedule call, and input can be done with mouse from script, like dragging tiles on the grid, that are translated to the C++ grid and back.
#31
05/16/2011 (9:18 pm)
Cool. So any location pt is a member object of the array, but one thing, if you can answer it great. What if the grid is on an angle of 45 degrees off axis and as would be the case for most town building type games. Would it just be a simple case of rotating the array?
#32
05/17/2011 (12:25 am)
Rennie, no problem. There are 2 different things here (this is the case of my example in the tutorial):

1) the array definition; this is just how data is stored, it does not know anything about where to draw.

2) where to draw; in the tutorial I used a tile layer, that has a rectangular regular layout by definition.

If I wanted do draw the array another way, like that 45 degrees case, I could have instantiated a 2D array of sprites and associate each one with an index of the C++ array. In this case each x and y coordinate of the sprite (t2dStaticSprite) would have to be changed at each iteration to another x and y that corresponds to "up", "down", "left" or "right", that could be anywhere on screen really.

See the function that draws the tiles

function CaGame::DrawGrid(%this)
{
   for ( %x = 0; %x < %this.WallSizeX; %x++)
    {
       for( %y = 0; %y < %this.WallSizeY; %y++)
       {
          %value = %this.model.get_value( %x, %y );
          if ( %value >= 0 )
          {
             %this.WallTileLayer.setStaticTile( %x, %y, CaImageMap, %value );
          }
          else
          {
             %this.WallTileLayer.clearTile( %x, %y );
          }
      }
    }
}

For the tiles each x and y in the iteration is applied "directly" to the tile draw call. For the sprite case the best would be to define another 2D array that has the x and y coordinates of each model index (the C++ array).

Does it make sense ?
#33
05/18/2011 (11:51 am)
@Pedro,
sorry for the late reply. I have been of line for 24 hours and will post a more in depth question later tonight, however, from the "for" statement you have, you are using it to simply place objects around, into a grid. Am I correct?


Having said this. What would be the difference of placing a few dozen sprites via this method or by hand via the editor? Sorry if that sounds simple I am just trying to further grasp the power of the array. Also, I have an old C++ for dummies book I am going thru.

Cheers.
#34
05/18/2011 (1:48 pm)
I use setStaticTile of t2dTileLayer to draw a tile at index (x,y) of the array. when we define a t2dTileLayer it has an implicit array in itself.

That is not the case for t2dStaticSprite, so you have to define one.
You can also define another array for the positions, something like

%my_sprite[ 0, 0 ] = new t2dStaticSprite();
%my_position_array[ 0, 0 ] = "100 100";
%my_position_array[ 0, 1 ] = "200 200";
//etc
for ( %x = 0; %x < %this.WallSizeX; %x++)
  {
     for( %y = 0; %y < %this.WallSizeY; %y++)
     {
        %my_sprite[ %x, %y ].setPosition( %my_position_array[ %x, %y ]  );
     }
  }
#35
05/18/2011 (1:56 pm)
Thanks Pedro. I am jut thinking actually of the best way to
a. create the land. where land is ground, that will hold all objects purchased in a store. Think of it as propery. The idea is not to far off Farmville or Trad Nations. So the game, visually will be titled at the axis. Again, would this be something I should do with a tileSet and arrays? I am currently thinking I could just do it with groundObjects spaced evenly. Since my objects, making up points in the ground are not in the 10s of thousands this might be useful... however WHERE does the array come into this? Just for setting each groundObject's (or tiles) position?


If I wanted to create a grid of standard, repeated objects that make up the "ground". On load up I could just use a for statement adjusted accordingly so that each piece is spread out perfectly?

Is this the MAIN power of the array?



Thanks for helping.




edit: so just thinking, the power of the array, in this case is not only that the computer can map out the objects into position, but that it can do it PERFECTLY. As in, precise measurements.


#36
05/18/2011 (2:37 pm)
I think for that type of game I would use t2dTileLayer. If you want not to draw all the tiles in a rectangular shape (in a diamond shape for example) you can just avoid to draw the tiles at the edges.

for this case the array definition array[x, y] could be used to store information to draw or not the tile at [x,y]; for example array[2,2] is 0 means do not draw at (2,2), array[2,2] is 1 means draw.

#37
05/18/2011 (2:44 pm)
first off I am not sure what you mean by "draw"?
and yes, I would want my "pieces" that make up the land to be diamond shape, tho I do not believe, unless I do use a t2dTile that they be diamond shape. I think I can use the array for placement. I am more comfortable, with out further convincing that to just place sprites out via a for statement will do the trick.



#38
05/18/2011 (3:32 pm)
by draw I mean call setStaticTile to make the tile at x, y visible; either tile or sprite would work for that game, just choose the approach that works best :-)
#39
05/18/2011 (4:00 pm)
yes will do.




thanks.