Game Development Community

a few woes

by rennie moffat · in iTorque 2D · 06/17/2010 (9:30 am) · 181 replies

Hi there, anyone who has been following me this week understands my situation. I built, stupidly, my app in TGB, not iTGB, anyhow, essentially I have simply been transferring all I did into iTGB however I have run into two problems.


1. when I run my game it crashes.

2. my player animation (idling) is of the same size (object is 32x32) however in TGB the actual sprite, at least what was visible was only a quarter of that size. It sat, very quietly in the middle, in other words it did not take up the whole 32x32 space. In iTGB however the object is still 32x32 but the animation is bloated. It is stretched out to fill the entire space. I am not sure why, any suggestions?

edit; cont from pt2.
I have just noticed, as I say, my level, opened up, everything appears to be fine. all objects, positions, sizes are correct. However, when I drag in those same elements into the editor fresh, they are a good 20% larger. I think this may have something to do with resolution, but in the level.t2d's I see no "resolution" or something like that to adjust.


3. Images are not being called.
I have redone every image i needed, created animations, etc. Saved then reloaded my game. All images are gone. They still exist in the folder "game/data/images" but are not called into the editor.

3 cont.
I just created a whole new project and loaded in one image, thinking one of my files may have corrupted the project, but the same thing happened. The message i get is...
Quote:
Invalid Project Data
This project contains 1 invalid datablock. This is likely because a referenced image file was deleted from the project directory.

How can this be? I created the image, simply calling into the editor, pulled it onto the level editor, saved, then reloaded the game just to test.







If anyone can help me out with these pressing issues I would greatly appreciate it.

Thanks.




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.

#141
07/03/2010 (6:20 pm)
That sounds good to me. It seems like each dso is in fact about 10% larger than it's cs file. If that's the case, not only will it save in load up, but in downloading from the app store. Correct?



#142
07/03/2010 (6:24 pm)
Rennie, yes, to test it on your iPod, you just select one of those options from the pull down menu. Then, connect your iPod to the USB port, and then build and run the project and it will automatically download the application to your device.

You just need to make sure that you choose one of the operating systems that matches the one that is loaded on the actual device.
#143
07/03/2010 (6:56 pm)
I just tried, I selected iPhone 3.0 (since it was the lowest, thinking backwards compatibility) and to my iPod Touch, I thought it was the best option but it would not run.

I was getting, and in fact get about a 100 errors now, all basically saying
"<CoreServices/CoreServices.h>"


::???


Should XCode "see" my iPod? Slightly unsure.
#144
07/03/2010 (8:09 pm)
Hmm, not sure, I've not seen errors like that, but it sounds as if you're getting compilation errors, which suggests that there is something badly wrong, and it's not just something simple like selecting the wrong OS. I would just start off using the simulator, and try to get that working, because I think the errors you are seeing have nothing to do with the actual device.

Also, I would actually start off with a very simple example, like one of the examples provided by GG. For example, I would start with the simplest one, which is the "iPhoneExample" project. Try to build that one in XCode for the simulator, as it should work straight out of the box without any problems. If you get a lot of errors with that example, then you must have something messed up somewhere, and at that point I would suggest a re-install.
#145
07/03/2010 (8:15 pm)
I have gotten the simulator working, I just thought I would try to get it on an actual device, that is why the errors, perturbed me.


::::? No worries, tho, will be working on other stuff through the week. I do hope do be able to have it on a device by this time next week.




I do have a question tho regarding performance. I suppose it will be most accurate (how your game performs) but does the computing power of the simulator, does it mimic the computing power of the iDevice or is it simply the power of your computer which runs in the simulator?
#146
07/03/2010 (9:38 pm)
Hey Rennie, if you have it running on the simulator, that's awesome. That means your problems are not so severe, and it should be fairly trivial from now on to get it working on the actual device.

Regarding performance, you're right that the performance on the simulator is determined by the power of the computer that is running the simulator. I do all of my development using a Macbook Pro 2.26 GHz version, and I've found that the simulator runs a little bit faster compared to the device, but the difference isn't that much and they are actually fairly close in my case (maybe 50 frames per second compared to 30 or 35 for example, actually very similar). The simulator performance, however, definitely does not mimic exactly the performance you'll see on the device, and if you have a really powerful computer there will be a bigger difference. I've just noticed that a medium powered Mac book performance in the simulator is fairly similar to the device, but that is just in my case. It might be different with your game, I'm not sure, so you'll have to experiment. But, I doubt you'll see a huge difference, and the simulator will definitely not run 10x faster than the device, or something rediculous like that. I think you'll find that the difference is less than 2x.
#147
07/04/2010 (7:15 am)
Ok I have an iMac 2.4 Ghz Intel Core Duo. I guess that is more powerful than your 2.26, tho I always thought Mac Book Pros were the most powerful. Anyhow, comparable and thanks for the feedback.


Regarding the simulator I selected Release and iPhone Device 3.0 and I have gotten 126 errors. Not sure what to make of that, seeing as I would think, that when I ultimately release the app I will have to chose those settings.
#148
07/05/2010 (10:05 am)
Just a quick question regarding datablocks and levels in iTGB.


The game/managed/datablock.cs, it contains all imageMap, sceneObject, animatedSprites etc, info for all objects throughout all levels? See I am trying to see where the first datablock is created. I know I am to copy datablock info from the the game/managed/datablocks.cs to the levelName_datablock.cs, and I have it working, but starting from scratch to better understand the process, I have set up a new level...


1.The levelName.t2d contains all objects and there info like position, behaviors etc.
2.The levelName_datablock.cs contains where the file is located, size, optimised, cellStride and a bunch of other stuff that I don't understand yet. (probably do not need to for now).
3. game/managed/datablock.cs contains the identical info as any levelName_datablocks.cs So my question regarding this is, does this datablock HOLD ALL INFO of objects used throughout the game?


And which datablock should I see objects automatically created in by the level builder if any? As I say, upon starting from scratch (in iTGB 1.3) I am just trying to better understand the datablocks flow of information and how to best manage it.



Thanks!









#149
07/05/2010 (11:50 am)
Rennie, managed datablocks is used by the level editor when you are making your game. It contains all your game assets - you may not necessarily use them all but they will all be here.

The per level datablocks contain the actual game assets that are required for that level. Different levels will probably have different game assets and probably share some common stuff. You assign (via the datablocks editor) which game assets appear in which level. If you don't assign any then you will have an empty game.

If you are in 1.3 then you have to manually copy the parts of the datablocks from managed into the per level datablocks file - don't be tempted just to copy everything - this will be very wasteful in terms of resources on the iDevice - only copy what is needed for that particular level.

Once the game is running (TGB or iDevice) the managed datablocks file is no longer used.
#150
07/05/2010 (1:31 pm)
So a quick question, is there only one managed/datablocks file or one per level?



Re; Assigning via the datablocks editor.
Since I am using 1.3, in your professional opinion, do you think the beta is working good enough to switch back over, just for the datablock editor? If I am to simply copy and paste (which I have been) is this only damaging to memory & how do I know what is necessary and what is not?


One thing is, I am experiencing a problem with one item and it's 2 subs.
1. object1, owner of behavior, object2, object3 are subs of object1 and it's behavior.
2. objects 1, 2 and 3 do not have names assigned in the level.cs file though they are named in the editor (levelBuilder), I think this may be affecting the behaviors lack of functionality. Is there any explanation that springs to mind as to why an object, is not named in the levelName.cs file? A common trouble shoot? Would this have to do with me copy and pasting potentially unnecessary info from the managed datablock to the level datablock?



#151
07/05/2010 (1:57 pm)
Its only one file and its for the editor only, the game doesn't use it.
#152
07/05/2010 (2:43 pm)
@Marc, you mean there is only one managed/datablock.cs file?




and it contains all relevant info on all objects, or just sprites animations? I ask because I seem to have had t2dSceneObjects, when simply pulled into the editor, exist when tested and also not exist. So what exactly in terms of objects, must be added to the managed/datablocks.cs & the level datablocks?
#153
07/05/2010 (2:58 pm)
There is just one datablock file, right. Thats the one used by the editor and it contains all the datablocks that show up on the editor to be dragged into the scene.


stuff you drag into the scene is stored in the levels file, not there as it is something that exists in the level only, not on a global level.
but level files can't hold "declaration datablocks" (image, sound datablocks), those are handled through the per level datablock files.
#154
07/05/2010 (6:14 pm)
So the level datablock will hold all "declaration datablock", images, sounds etc.

The level file will hold all objects that are in the level, their position, physics, behaviors etc.

and the managed datablock holds all things that are in the "create panel".


And as habit I should copy (only necessary info) of each datablock needed form the managed datablock, to the level datablock. But how do I know what information is necessary?

///managed datablock example
///sprite
   new t2dImageMapDatablock(templeCollisionCellsImageMap) {
      imageName = "~/data/images/templeCollisionCells.png";
      imageMode = "CELL";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "128";
      cellHeight = "128";
      preload = "1";
      allowUnload = "0";
      compressPVR = "0";
      optimised = "0";
      force16bit = "0";
   };
///animation
   new t2dAnimationDatablock(tRUAnim) {
      imageMap = "templeCollisionCellsImageMap";
      animationFrames = "0 1 2 3";
      animationTime = "0.173913";
      animationCycle = "0";
      randomStart = "0";
      startframe = "0";
      pingPong = "0";
      playForward = "1";
   };

So what, from the managed datablocks, is not necessary in the level datablock? What should be added in, if anything?





#155
07/05/2010 (6:57 pm)
the level datablock hold dublicates of what you have in the managed datablock and which is used in this explicit level.

level datablocks are only used in the game, managed datablock only by the editor.


and since 1.4 you don't need to copy them manually anymore, there is a datablock editor at the top that lets you 1 click transfer them :)


as for what is necessary: Well its you who places stuff in the level, isn't it? So its also you how knows which images are used in the level :)
#156
07/05/2010 (11:40 pm)
Thanks Marc.

Two questions,
1. Scott, mentioned NOT COPYING and Pasting everything from managed to level datablocks as all info is unnecessary, so if this is true, @Anyone, what (in post 154 for example) would be necessary in the level datablock and what would not?

2. How is iTGB 1.4? I only used it for a bit, before I had a grasp on the datablocks etc. Is it bug free? Only difference is the Datablock editor? In other words, should I use it? Would it make my life easier?


#157
07/06/2010 (12:04 am)
1. The things that are necessary are the datablocks you use in the level. Copy those but only those and don't forget to delete the ones you no longer need at the end of the level

2. Its a beta and has some bugs. And no there are quite a few more differences than just the datablock editor :)
#158
07/06/2010 (6:01 am)
1. ok I thought he meant information of each could be cut back. thanks.


2. Suppose it is just easier to stay with 1.3 for now eh?




edit. 3 questions I had, regarding sceneobjects disappearing, and behaviors not functioning are solved.


#159
07/06/2010 (1:26 pm)
One question regarding the managed datablocks.

Any sprite or animation should be added, automatically to the datablock, by iTGB when I create it, correct? That is what I thought, however one new animation and it's image map, I can not find in the managed datablock and thus it is not in my game.



:::? puzzling.



#160
07/06/2010 (2:06 pm)
Unsure what you mean with your formulation but: the stuff in the managed datablock will not show up in the game, only the editor