Improve performance for drawing lines

orien2v2orien2v2 Member, PRO Posts: 55
edited November -1 in Working with GS (Mac)
I managed to get things work by following Orbz's tutorials for drawing lines but performance seems to be bad. It works with mouse but once I tried it on my device it slows and always lags behind my finger.

I already tried destroying the segments after 0.1 seconds to create a short trail rather than a long path so I think it isn't about having too many segment actors in the scene. Could it be the calculation for the each segment slowing things down? Any way to improve this? Have you come across a game with smooth performance like Fruit Ninja?

Edit: I tried it on iPod touch 2G and a 3GS. I understand the 2G has some low spec but the 3GS should at least have something more decent right.

Comments

  • ArtieChokeArtieChoke Member Posts: 30
    Hey, I am looking for the exact same answer. Could you provide the link to the tutorial if possible? Sorry for being off topic.
  • orien2v2orien2v2 Member, PRO Posts: 55
    ArtieChoke said:
    Hey, I am looking for the exact same answer. Could you provide the link to the tutorial if possible? Sorry for being off topic.

    Hey sorry I don't mean tutorial I just tested it on GS and look into it for some time so eventually I got it. It's basically like: when mouse is down, it spawns a segment actor. The rotation for the segment(which basically is a line) can be calculated based on where the mouse is pressed and released (which are two attributes). It also calculates how long the line is based on this. It's easy to understand if you look into it. Took me about 30 minutes as I'm still kinda new.

    Here's a link for the demo: http://gamesalad.com/game/play/79364
    You could search for 'drawer orbzample' from the 'New' section in GS and look into the project file.
  • ArtieChokeArtieChoke Member Posts: 30
    Thanks for this mate, worked perfectly!
  • orien2v2orien2v2 Member, PRO Posts: 55
    ArtieChoke said:
    Thanks for this mate, worked perfectly!

    No problem. But who can help me out? Anyone have a smooth performance for line drawing games??? I don't mean smooth lines, I meant the performance as in the line wouldn't spawn behind my finger but at my finger.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    If you are looking to do a fruit ninja effect and you don't need a line to stay on the screen you should search for fruit ninja in the new section of the gs creator start screen. I modified toastkitten's demo to make my jump 'n slash game.
  • orien2v2orien2v2 Member, PRO Posts: 55
    scitunes said:
    If you are looking to do a fruit ninja effect and you don't need a line to stay on the screen you should search for fruit ninja in the new section of the gs creator start screen. I modified toastkitten's demo to make my jump 'n slash game.

    Yes but I need a line to stay on the screen to make it more intuitive rather than having the slash effect appear only when I touch a fruit. I want to show a trail even if it's really short. My game is only 1.8MB and it takes around 45MB of memory. Is that normal?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    orien2v2 said:
    Yes but I need a line to stay on the screen to make it more intuitive rather than having the slash effect appear only when I touch a fruit. I want to show a trail even if it's really short. My game is only 1.8MB and it takes around 45MB of memory. Is that normal?

    again, have you tried toastkittens fruit ninja demo? It will form a cool looking slash every time, whether you hit anything or not.
  • orien2v2orien2v2 Member, PRO Posts: 55
    scitunes said:
    again, have you tried toastkittens fruit ninja demo? It will form a cool looking slash every time, whether you hit anything or not.

    yes I did but I didn't see a slash even if I hit something. Rather I see a trail of glowing light balls slowly fading...is that the right one?
  • MotherHooseMotherHoose Member Posts: 2,456
    @orien2v2

    in your gameSalad New section search for Fruit Ninja...both Toastkitten's and Tshirtbooth's (which uses Orbz's demo) should show up...

    open and play with both them... you can change things to you get the effect you want...
    in TK's just replace/delete the circle image and make that actor 100W 2H white...

    or maybe use constrainAttribute self.Position.X To: touch1.Positin.X (same for the Y coordinate)
    or magnitude to maintain the X of line to the X of touch...

    keep playing around... and you'll get it completely... and tell the rest of us how to! ;)

    MH
  • orien2v2orien2v2 Member, PRO Posts: 55
    MotherHoose said:
    @orien2v2

    in your gameSalad New section search for Fruit Ninja...both Toastkitten's and Tshirtbooth's (which uses Orbz's demo) should show up...

    open and play with both them... you can change things to you get the effect you want...
    in TK's just replace/delete the circle image and make that actor 100W 2H white...

    or maybe use constrainAttribute self.Position.X To: touch1.Positin.X (same for the Y coordinate)
    or magnitude to maintain the X of line to the X of touch...

    keep playing around... and you'll get it completely... and tell the rest of us how to! ;)

    MH

    I did that and the problem is still the same. I even used the same name for attributes. I even combined both (sort of) and still got the same result. I wonder if is it the spawning of two more actors after the main actor is 'slashed' and destroyed is causing the lag. Or it could just be my iTouch 2G. My game does seem to run smoother on my 3GS but only about 10% improvement.

    Anyone with iPhone 4 or with a newer gen iTouches interested in helping me to test and see if the lines are smooth or it still lags behind the finger?

    I wonder why is this happening. Fruit Ninja is in 3D and it runs much much smoother than my 2D slasher. That's just weird. I even optimized my png with ImageOptim and delete unused images and actors.
Sign In or Register to comment.