Jump to content

Aprowolf

Members
  • Posts

    70
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Aprowolf

  1. update : well i owe you guys an apology , i thought Grow heap line of Code is typed out exactly like System.out.println() just like the log here : 05-28 20:35:12.869: I/System.out(23870): 524288 (size 1) 05-28 20:35:12.889: D/dalvikvm(23870): GC_FOR_ALLOC freed 258K, 36% free 11984K/18620K, paused 22ms, total 22ms 05-28 20:35:12.894: I/dalvikvm-heap(23870): Grow heap (frag case) to 13.846MB for 1048592-byte allocation 05-28 20:35:12.919: D/dalvikvm(23870): GC_FOR_ALLOC freed 512K, 33% free 12496K/18620K, paused 25ms, total 25ms 05-28 20:35:12.919: I/System.out(23870): 1048576 (size 2) 05-28 20:35:12.939: D/dalvikvm(23870): GC_FOR_ALLOC freed <1K, 33% free 12496K/18620K, paused 20ms, total 20ms 05-28 20:35:12.939: I/dalvikvm-heap(23870): Grow heap (frag case) to 15.346MB for 2097168-byte allocation 05-28 20:35:12.964: D/dalvikvm(23870): GC_FOR_ALLOC freed 1024K, 35% free 13520K/20672K, paused 24ms, total 24ms 05-28 20:35:12.974: I/System.out(23870): 2097152 (size 3) 05-28 20:35:12.994: D/dalvikvm(23870): GC_FOR_ALLOC freed <1K, 35% free 13520K/20672K, paused 19ms, total 19ms 05-28 20:35:12.994: I/dalvikvm-heap(23870): Grow heap (frag case) to 18.346MB for 4194320-byte allocation but apperntly the Grow heap is called before char[] newData = new char[this.data.length * 2], which leaves us back to search for the real cause of this issue >.> i tried to toString.Trim() the xmlReader reader but could not get it to work , gonna try tomorrow again , been working on this for the last 6 hours
  2. Hey Trixt0r, I'm still Trying some stuff here and there to see if i can create an alternative method to the current one, in mean time i submitted a Bug Issue to the libgdx community regarding their class XMLReader since it is the one being used in the library therefore they might be interested in fixing that method in the future for the smart phone devices , the link is here for that topic : http://www.badlogicgames.com/forum/view ... 11&t=14583 feel free to pump it up there so we can show them there are developers like me struggling with this issue XD In the mean time i'm doing more tests , i'll submit a solution in both this forum and theirs if i find a solution or correct way to parse the file properly.
  3. More results : these are the sizes of the arrays being created : 05-28 20:35:12.819: I/System.out(23870): 2048 05-28 20:35:12.819: I/System.out(23870): 4096 05-28 20:35:12.819: I/System.out(23870): 8192 05-28 20:35:12.819: I/System.out(23870): 16384 05-28 20:35:12.819: I/System.out(23870): 32768 05-28 20:35:12.819: I/System.out(23870): 65536 05-28 20:35:12.819: I/System.out(23870): 131072 05-28 20:35:12.824: I/System.out(23870): 262144 the sizes that invokes Growth of Heap: 05-28 20:35:12.869: I/System.out(23870): 524288 (size 1) 05-28 20:35:12.889: D/dalvikvm(23870): GC_FOR_ALLOC freed 258K, 36% free 11984K/18620K, paused 22ms, total 22ms 05-28 20:35:12.894: I/dalvikvm-heap(23870): Grow heap (frag case) to 13.846MB for 1048592-byte allocation 05-28 20:35:12.919: D/dalvikvm(23870): GC_FOR_ALLOC freed 512K, 33% free 12496K/18620K, paused 25ms, total 25ms 05-28 20:35:12.919: I/System.out(23870): 1048576 (size 2) 05-28 20:35:12.939: D/dalvikvm(23870): GC_FOR_ALLOC freed <1K, 33% free 12496K/18620K, paused 20ms, total 20ms 05-28 20:35:12.939: I/dalvikvm-heap(23870): Grow heap (frag case) to 15.346MB for 2097168-byte allocation 05-28 20:35:12.964: D/dalvikvm(23870): GC_FOR_ALLOC freed 1024K, 35% free 13520K/20672K, paused 24ms, total 24ms 05-28 20:35:12.974: I/System.out(23870): 2097152 (size 3) 05-28 20:35:12.994: D/dalvikvm(23870): GC_FOR_ALLOC freed <1K, 35% free 13520K/20672K, paused 19ms, total 19ms 05-28 20:35:12.994: I/dalvikvm-heap(23870): Grow heap (frag case) to 18.346MB for 4194320-byte allocation an array of size 2097152, Tons of RAM w XD yup this method must be re-written sadly , each time we are in the while loop it Creates a char array that twice the size of the previous one , realize we start with char array of 1024 , even if we start with char [1] for debug case the size always keep growing twice previous size which will lead us to 1024 ,2038 etc again in another word , if this line was invoke a hundred times , we will need an array of size : 1.2676506e+30 ahm ahm
  4. Ok i found the little devil that causes Grow Heap to be invoked . in the following method in XmlReader , in the while loop: public Element parse(Reader reader) throws IOException { char[] newData = new char[this.data.length * 2] } i tested that line in 5 SCML files , and it is always the reason for invoking the Growth heap Issue, it allocates tons of space that are being used ONCE , and when this line invoke many times in the while loop it keep invoking the Growth of Heap. (the line invoked growth of heap 3 times in a single file, each call +15mb which causes the 47MB in Ram that i mentioned before) only this method must be re-written , i'm gonna see what else i can do about it and hopefully we will reach an answer
  5. Greetings again , here is my status report after testing the new Library , plz refer to the picture below to see the results of the test on samsung galaxsy s3: The test was done with the project with the following details : SCML Folder: 20images for the entity , each is 1x1 pixel with 3kb each , total 54.5KB .SCML file: size 1,154KB, number of entities : 1 , number of animations = 17 Current Issue: Java Grow Heap (Frag case) is called Multiple times possible issue: com.brashmonkey.spriter.Entity/Animation (sees fit/May) allocate extra heap size growing up to 200~250% of the needed space for the file, is occupies 12.99% percent of total allocated size which remain not used at all by ram and does it everytime a new instance is called, resulting in Java Frag Heap each time eventually leading to RAM being overload and the app exit. (please see first box and 2nd box in the picture) proven : the png images we use in our scml file are NOT(at least not directly) the reason for the "Grow heap frag case" since we used 1x1 pixel image and we still got the same EXACT Grow heap when use normal images up to even 512x512 pixel size. -refer for box 1 and box 2 for exact info result: The Grow (frag case) call is the first and MAIN issue we are facing which causes grabage collector to kick in and remove the huge unnessory data in RAM, we have 47MB of Ram allocated for 54.5kb worth of images ^^; (mind blown) (107MB active ram with 5 diffrent sml files, they occupie 80MB of RAM i total) thoughts : is there somewhere in code you think that you r allocate unnessery huge space in ram? like char[1024] and use only one of them etc,(not obvious like this lol but u get the idea) hope someone would come here and gives you more resultes that may prove useful regarding the issue always appreciate your work Trixt0r , boind
  6. dear Trixt0r, first of all , wow XD u combined my 20+ lines of coding into a single line lol , just blew my mind character.position.x += speed*player.flippedX(); hopefully someday i'll be able to think like that , I actually started programing real late in life..... but lets leave the excuses for the lazy ppl XD back to programming back to programming lol and yup now i got it , thx for clarifiying it for me ^^ always appreciate it when you give me some of your time btw ,I just want to second TFS note on the cons specifically in the part : in the library is leaving a quite a bit of memory (tracked in DDMS) out to hang every frame on 6-8 concurrent animations In the proj that i keep going back and forth in , "3" Spriters files takes up to 45~49MB of RAM when "initiated" (75MB including other resources). the hero scml file takes up at least 30MB of RAM when it is created ,BUT, after leaving the proj running for a while(2~3mins) i came back to find proj occupies 5~7 of ram only which i believe after system.gc() kicks in by itself and does it thing. if there is a way to reach that goal immediately it will be brilliant, coz when i try to create 7~8 spriters the app crashes due to the huge data occupied in RAM. dunno if that info was helpful or not , but i thought i might as well share it since we r on the topic ^^;
  7. Here is a feature that might be intersting for you guys : how about adding more"Transformation" options that can applies to the image bedsides Scale and rotation? Transformations like :Skew, Distort and Perspective can prove very usefull in making a 2d image looks like a 3d during run time , it will also increase the animations capability of Spriter waaaay more aweasome~
  8. A suggestion regarding a "new" feature, if it can be implemented would be nice : - exporting xml/scml sheet that has -ONLY the collision boxes cordinates : location x, y , width and height for each frame exported in the sprite sheet -. normally , when I want to use Collision boxes feature in spriter, i have to load the scml using java generic importer which uses alot of RAM in the android devices compard to using sprite sheets. so if there was A way to obtain collision boxes cordinates using small xml/scml file without loading the original smcl file that has everything in it will save alot of RAM space in iphones/android, as a programmar i'll just have to fix the cordinates with each image in the exported sprite sheet during runtime. I dunno how many ppl needs this feature, but as an android game developer this small feature if it was implemented would means the world to me :) clarification : file > export to PNG > Export as Sprite sheet with SCML for Collision box cordinates"(2 files , spritesheet.png and collision.xml)
  9. Greengnom : i also had trouble with the flip x and Y method messing my animation , but i solved this by creating two methods that fixes the flip and x from : public void flipX() { this.root.scale.x *= -1; } public void flipY() { this.root.scale.y *= -1; } to : public void setDirectionLeft() { if (this.root.scale.x > 0) this.root.scale.x *= -1; } public void setDirectionRight() { if (this.root.scale.x < 0) this.root.scale.x *= -1; } which i use to set the direction manually for my sprites coz I did not know how to implment flipx and y properly. -Trixt0r: very nice feature from the sounds of it , I did not implement and particles yet in my project yet but when i do in the future, i'll give it for sure a go ^^ thx again for your hard work~
  10. nvm , found it~ player.characterMap =player.getEntity().getCharacterMapByName("Blue");
  11. Greetings peeps , regarding the java generic importer , how can i apply the charachter Maps now? i can't seem to find the correct way to do it. thanks in advnace
  12. During testing one of my scmls files and going through the Scml code of that file, i found that when turning the alpha channels for bones to equal zero percent, the scml save the alpha channel as a="nan" instead of a="0" which i had to manually fix for each bone for the general SCML file reader to be able to parse the scml file properly. is there is a purpose for setting the scml file to save the alpha channel for bones as "nan" rather than "0"? if not, can it be fixed in the future releases if possible ^^? I know i could simply fix the SCML file reader to alternate nan to 0,or manually by opening each scml file in text editor , but wanted to bring some light on the topic
  13. Back after two weeks vacation from programming XD; Dear Trixt0r, First of all : I can't express how much i'm happy with this new amazing Library :) it took me sometime to reconstruct my current project to work with it , but it was totally worth it ^^ (And yes , the new loading is amazing XD, noticed at least 50% improvement in terms of speed while loading my SCML file to my android, espcially since spriterplayer class is gone). The new Test hierarchy is brilliant , i used to get lost very easily in the Demo one XD 10/10 really appreciate your hard work, thx again ^^ PS: it is lil late but thx for the Bounding box update , Love it!
  14. Greeting Trixt0r , Thx for the elaboration and the new update!! , i'm going to check it some time this week hopefully :D~ I have one question though: "The next update will maybe cover boxes and control points, but I can not promise" is that the cause of the following error that i get when i have "bounding box object" in my SCML file , or is it because of different error like something is missing in my scml file? Exception in thread "LWJGL Application" java.lang.RuntimeException: Element object doesn't have attribute or child: folder at com.brashmonkey.spriter.xml.XmlReader$Element.getInt(XmlReader.java:642) at com.brashmonkey.spriter.xml.SCMLReader.loadTimelineKeys(SCMLReader.java:314) at com.brashmonkey.spriter.xml.SCMLReader.loadTimelines(SCMLReader.java:281)
  15. Hey BrashAdmin, Really thankful for the fast response and good suggestions :) having 2 bounding boxes will do fine and fast since the second solution suggest that i keep in mind the alpha channel in my swords which means extra unecssory works ^^; Anyhow I really appreciate your help and hopefully we will see more interesting features in Spriter , your program rocks hardcore as well as you ppl :) wishing you a good day~
  16. Greetings ppl , i have reached a blocked road in my project and i'd like some help in my animation , my player switches between two swords , one is a short sword and the other one is a long sword, The switching between them using Char Map is flawless , but , since they vary in length the bounding box surrounding the short sword is not big enough to contain the long one , is there is a away to make the binding boxes changes width and height when char map is activated? if yes could someone tell me plz how ? thanks in advance
  17. ------------------------------------ regarding The new update Trixt0r, AMAZING JOB XD! really well done and so far it looks flawless :) !! it takes as you said 1 line to change the charachter map XD player.setCharacterMap("ChangeSword"); did it for me , i really appreciate what you did :D that should cut the loading time for my scml file to half btw lol , coz i had to make 2 copies of each of my animation in the scml coz the char map was not implemented , but now thats solved it is no longer an issue :) again thank you for the improvments in the library , not the char map only :) ------------------------------------------ More Testing info regarding loading SCML file those who intersted the following are what i came up with so far , while importing the Spriter SCML file and setting the player there is 3 parts of the code that takes high excution time the more keyframes + animations you have in your project , these following part of codes are the following : //1 In SCML reader public static SpriterData load(InputStream stream) { XmlReader reader = new XmlReader(); data = new SpriterData(); try { //The parsing XmlReader.Element root = reader.parse(stream); loadFolders(root.getChildrenByName("folder")); //Loading Entiies takes approx 2/3 of the time you needed to finish the parsing loadEntities(root.getChildrenByName("entity")); } catch (IOException e) { e.printStackTrace(); } return data; } //2 After Trixt0r new library the next part of the code that takes tons of excution time can be found in setEntity in SpriterPlayer [code] public void setEntity(Entity entity) { if (this.entity == entity) return; this.entity = entity; if (!alreadyLoaded(entity)) { //part 1 this.animations = SpriterKeyFrameProvider.generateKeyFramePool( this.data, entity); loaded.put(entity, this); } else this.animations = loaded.get(entity).animations; //Part 2 this.generateData(); } In general the code is PRETTY fast in all areas EXCEPT for the methods i mentioned above, i hope that someday i might get clues in how to generally improve but for the time being , i'm ok so far XD --------------------------------------------------- edit : now it takes 8 seconds only to load my file into android after implementing the char map ^^; new size of scnl file 1.15MB;
  18. hey Trixt0r and thx for reading my question ,I came to the conclusion their might be something wrong with the way i'm exporting my project to android , this is what i came up with so far : ---------------------------------------- regarding my project details are the following : SCML Project 2.21MB -A single entity with 30 animations diffrent animations -the images that makes my animations are 100kb in total ------------------------------------------------------------- it loads extreamlly fast in my pc but in my android it does take ages,,,, what i did is i analyzed the parser further more and while i still get 20 seconds delay , (8 seconds ONLY) are defently from the parser. and 12 seconds are completely unkown to me from where it originates ^^; XD (if 8seconds is fine for 2.21MB file , then i just gotta find the sources for the extra delay) well i gotta do more testing , seems the issue was mainly in my code before it was from the whole thing lol , still though , thx for giving me some of your time ^^
  19. I apologize for my upper comment i just realized i made terrible mistake XD both codes relatively does the same thing (removing readline()) but the real CPU uages comes from the parsing method @SuppressWarnings("unused") public Element parse (char[] data, int offset, int length) { //the long code return root} i still wonder if there is away to parse it fast though ;__; 20 sec to load a single spriter is really long
  20. I really appreciate the amazing amount of effort you put in this generic Importer ^^ you sir desrves a cookie i have one point that i want to point out , you are using the following code to parse the data : public Element parse (InputStream input) throws IOException { return parse(new InputStreamReader(input, "ISO-8859-1")); } Since the parsing occures char by char i assume , is it possible to speed up the parsing if we somehow changed to algorithim to include bufferedreader and invoke the read.line() Method? something like this : BufferedReader BR = new BufferedReader(new InputStreamReader(input, "ISO-8859-1")); //it does not work since we dealing with char by char return parse(BR.readLine()); is it possible to do that? i have a a real big Spriter file and i'm looking for a way to speed up loading it , it takes about 4 sec in desktop to load my spriter file and 20 sec on my android galaxy S3 i would very much appreciate it if you have suggestions to speed up reading and parsing the spriter file :)
×
×
  • Create New...