Help! Loading is taking 2-3 minutes :( - Any help would be greatly appreciated!

ChakkuChakku Member Posts: 1,513
edited October 2012 in Working with GS (Mac)
The loading for one of my scenes is taking more than two minutes! So, what I'm trying to do is have it update the levels score to display in a "total score".

So what used to happen was I'd get 100 points for level 1, then I'd replay level 1 and get a 100 AGAIN, then it would say my total score was 200, and it kept adding my score. What I wanted it to do was only update my score, so if I kept getting a 100, then got a 125, it would change the score to 125 rather than keep adding all of the 100's. So its similar score system to Angry Birds.

What I did was:

tableCellValue( game.Score, Stars and Dollars ,1,1)+tableCellValue( game.Score, Stars and Dollars ,2,1)+tableCellValue( game.Score, Stars and Dollars ,3,1)+tableCellValue( game.Score, Stars and Dollars ,4,1)+tableCellValue( game.Score, Stars and Dollars ,5,1)+tableCellValue( game.Score, Stars and Dollars ,6,1)+tableCellValue( game.Score, Stars and Dollars ,7,1)+tableCellValue( game.Score, Stars and Dollars ,8,1)+tableCellValue( game.Score, Stars and Dollars ,9,1)+tableCellValue( game.Score, Stars and Dollars ,10,1)+tableCellValue( game.Score, Stars and Dollars ,11,1)+tableCellValue( game.Score, Stars and Dollars ,12,1)+tableCellValue( game.Score, Stars and Dollars ,13,1)+tableCellValue( game.Score, Stars and Dollars ,14,1)+tableCellValue( game.Score, Stars and Dollars ,15,1)+tableCellValue( game.Score, Stars and Dollars ,16,1)+tableCellValue( game.Score, Stars and Dollars ,17,1)+tableCellValue( game.Score, Stars and Dollars ,18,1)+tableCellValue( game.Score, Stars and Dollars ,19,1)

***All that means is that change "total score" to "score for level 1"+"score for level 2"+"score for level 3"...and so on.

I'm also doing the same thing for stars and dollars. The thing is that it's all loading on the same scene, which makes that scene take 2-3 minutes to load!!

Now I'm certain that there's a better way to do this, with less loading, as all GS-made games that have levels with points/stars/dollars have to be able to do this. I don't know, is there a way display the value of an entire column? I know for a fact it's possible...

Any help would be greatly appreciated.

Comments

  • famekraftsfamekrafts Member, BASIC Posts: 834
    are you spawning the items?

    try to make size of your screen 1536 x 768, use only 1024.

    remaining area, place all your items, when ever changes happen simply call these items to your scene area using attribute true and false and then send them back to the out of stage area. This will save you loading time and memory leaks.

    spawning and destroying causes loads of problems, use tables to simple shift them on and off scene, will be troublesome but saves loading time.



  • ChakkuChakku Member Posts: 1,513
    No, it has nothing to do with that. All I'm asking is how to have a total score for all levels display, with a smaller attribute rule, as that is killing loading @wickedsunny
  • famekraftsfamekrafts Member, BASIC Posts: 834
    edited October 2012
    Are you sure? try switching them off in the behaviors and then load on ipad and test once. I am using hell lot of attributes, yet my game loads in 2-4 secs.

    and my graphics are for retina 2048 size.
  • ChakkuChakku Member Posts: 1,513
    no the attribute is fine, its just that the rule is super long...



    tableCellValue( game.Score, Stars and Dollars ,1,1)+tableCellValue( game.Score, Stars and Dollars ,2,1)+tableCellValue( game.Score, Stars and Dollars ,3,1)+tableCellValue( game.Score, Stars and Dollars ,4,1)+tableCellValue( game.Score, Stars and Dollars ,5,1)+tableCellValue( game.Score, Stars and Dollars ,6,1)+tableCellValue( game.Score, Stars and Dollars ,7,1)+tableCellValue( game.Score, Stars and Dollars ,8,1)+tableCellValue( game.Score, Stars and Dollars ,9,1)+tableCellValue( game.Score, Stars and Dollars ,10,1)+tableCellValue( game.Score, Stars and Dollars ,11,1)+tableCellValue( game.Score, Stars and Dollars ,12,1)+tableCellValue( game.Score, Stars and Dollars ,13,1)+tableCellValue( game.Score, Stars and Dollars ,14,1)+tableCellValue( game.Score, Stars and Dollars ,15,1)+tableCellValue( game.Score, Stars and Dollars ,16,1)+tableCellValue( game.Score, Stars and Dollars ,17,1)+tableCellValue( game.Score, Stars and Dollars ,18,1)+tableCellValue( game.Score, Stars and Dollars ,19,1)




    so how to make it smaller/faster, and get the same result? @wickedsunny

    Thanks
  • ChakkuChakku Member Posts: 1,513
    edited October 2012
    @wickedsunny
    ok I think my initial explanation of my problem was too long/complicated.

    All I'm asking is how to display a "total score", as in the score of level 1+the score for level 2+ the score for level 3...

    In other words, how to display the value of ALL of the cells in 1 column without having a super long loading-time-lengthening rule? I'm sure that this is possible as all level-based games have it.

    can anybody help?
  • MobileRocketGamesMobileRocketGames Member Posts: 128
    edited October 2012
    @wickedsunny
    ok I think my initial explanation of my problem was too long/complicated.
    Holy crap yes. Your secondary explanation was also not very specific.

    From what I understand, You want ONLY the highest score for any given level to save.
    So if you play the same level and you get scores of 89, 125 and 100 respectively, It will display 125.

    If you can achieve this then you will abandon adding all the scores together?
    Well then to do that all you need to do is create a rule that fires when each level is complete that says:

    Attribute WhateverHoldsLevelScore is > LastLevelScore:
      Change Attribute LastLevelScore to WhateverHoldsLevelScore
    What this does (obviously) is change the old score to the new score only if the new score is higher.
    If that isn't what you needed, you will need to be more clear as to what you are trying to achieve. Because this:
    @wickedsunny
    All I'm asking is how to display a "total score", as in the score of level 1+the score for level 2+ the score for level 3...
    Doesn't make sense. Why would you want to display a score for the totals of all the levels? How would that lessen the loading time? Also, adding a bunch of values from a table shouldn't take more than half a second (whether the values come from a table or a number you input, it is still just saying add x+x+x+x+x+x+x with each x having a target in a table, behavior or memory). I would look at other culprits in your level for lag, such as timers, errant spawners, etc.

    Also, as a side note i just tried creating an expression adding 12 values from a table together and displaying them as text and there wasnt an extra second of noticeable loading time. Your lag problem lies elsewhere.
  • famekraftsfamekrafts Member, BASIC Posts: 834
    loading problem mainly happens when spawning and destroying actors or using a lot of timers or if the preload option is selected among each actor. Try to deselect that from all the actors and it will load fast.
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    The problem is not that rule. I have a similar one in a project and I have no problems with loading times. Try to check the rules of the other actors.

  • ChakkuChakku Member Posts: 1,513
    edited October 2012
    @MobileRocketGames

    Thanks for the reply. I think using specific examples will help describe my problem. What I have is a total score display that shows the TOTAL score of the entire game so far (I'm thinking about maybe adding a GameCenter Leaderboard for most total points). So what I want is that if I got 120 on level 1, then replayed level 1 and got a 150, then played level 2 and got a 115, then replayed level 2 and got a 125, I want the TOTAL score to display 275, which is the highest score for level 1+ the highest score for level 2. But the game adds 120+150+115+125, and displays a total score of 500.

    So my question is how can I get the TOTAL score of each level's HIGHEST score OR how can i display the TOTAL value of all the cells in a column?

    Also- I know this sounds confusing so if you don't understand me please let me know so I can post a video

    Thanks

    @MarkOnTheIron and @wickedsunny, Thanks for your reply, but it has nothing to do with the other actors, as it is in a level-select scene with nothing but display-text actors and change-scene actors. Also, loading was fine until I fixed the problem that added all scores for a level rather than keeping the highest score. But I fixed the loading with a super-long attribute which greatly lengthened the loading time from a few seconds to a few mins.
  • ChakkuChakku Member Posts: 1,513
    @MobileRocketGames

    Is there a way to get the total value of all the cells in a column?

    Can anyone help?
  • ChakkuChakku Member Posts: 1,513
    Ok, so I see that more people are viewing, but none are commenting, meaning the problem is still described in a too-hard-to-understand wording.

    So basically all I'm asking is how to display the total score, as in the sum of the highest score from each level.

    I'm convinced that this is likely to be a stupid question, so sorry for wasting people's time.

    Thanks

    And let me know if you want a video of my problem

    @MobileRocketGames @wickedsunny
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    If you have the highest score for each level stored in a cell in a table, then summing all the cell should give you the total score of all the levels.

    One problem that I see in the expression you posted in your first post is that it seems like there are 4 values separated by a comma in the tableCellValue() Probably because you named the table "Score, Stars and Dollars". I'm not sure if this is causing your issues, but try to rename the table without non alphanumeric characters, something like "ScoreStarsDollars".
  • ChakkuChakku Member Posts: 1,513
    @MarkOnTheIron

    Thanks for the reply

    Yes! That is exactly what I did- make a rule that added up all of the levels' score, and that super long rule is what made the loading so long.

    *****So my question is, is there an alternative way to doing that, which is not as long of a rule*****

    I will try your suggestion about renaming the table, but I doubt it will change anything, as the table name is highlighted blue anyway.

    Thanks
  • ChakkuChakku Member Posts: 1,513
    @MarkOnTheIron

    I tried your name-change idea, but it did not work.
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    Have you already tried to delete your actors one by one to determine which one is causing the huge loading time? Because it's impossible that it's caused by the long expression you posted.

  • ChakkuChakku Member Posts: 1,513
    Yes, I tried that- it has nothing to do with that.

    Ok so here is my only question: How do I update the TOTAL score of the games progress so far, as in the sum of the score of EACH individual level, BUT how to make it UPDATE the score rather than adding a higher score? @MarkOnTheIron and @wickedsunny
  • famekraftsfamekrafts Member, BASIC Posts: 834
    edited November 2012
    Make a total score attribute and at the end of each level simply add total score = total score + score, save total score and when new stage starts simply load the total score again and repeat the whole process at end of stage.

    I hope it's that simple instead of saving score in table for each individual level. I am still not sure what exactly is the problem you are facing. Hope this helps.
  • CluvCluv Member Posts: 229
    Do what wickedsunny says, but if you have a level attribute, subtract the level you are replaying, score value before (or after) adding the new value and then save. I don't think you need an expression that long to solve your problem. You could also use this if the level has never been played by putting zeros in your table to start off. This way, you will subtract zero from your total then add your new score to that. Then you can save your individual scores and your high score separately, no problem.
  • CluvCluv Member Posts: 229
    Or in other words:

    Total score - current level score (replace your level # with the variable for your current level) is equal to total score. Save.

    Change table score to new current level score. Save.
Sign In or Register to comment.