Moving in relation to certain conditions

GuaveMediaGuaveMedia Member, PRO Posts: 1,262
edited January 2013 in Working with GS (Mac)
Hey guys,

I need your help please. In my game I have a magnet effect put in. So some collectable items can be magnetized and move then to the main character where they are collected. My items spawn some particles to show some effect for people too.
When there are many items and the effect is turned on, I sometimes get a short lag which really annoys me. It's not like that the game is unplayable but it would be cool if I could somehow fix it.

Item: constrain magnitude to characters position
When effect is on, interpolate self X and Y to playerX and playerY.

When overlaps spawn particles etc. Nuts physics moveable etc. is off!

Is there are better way to do an effect? I thought interpolate something is the best concerning performance.
Any advice would be awesome!

Thanks and cheers!

Comments

  • PixelMetalPixelMetal Member Posts: 283
    You already know how to do it, you've laid out the steps above.

    Make a rule around the player movement rules that checks if the movement rules should be active or not.

    However, there's no way to check for collision with the GS particle system that I'm aware of. You could try spawning an invisible object in the same area as the particles that will check for collision.
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    @PixelMetal

    I know that the code is correct but I was just asking if there is a different way which could save some performance?
  • PixelMetalPixelMetal Member Posts: 283
    edited January 2013
    Are you referring to the particle effect issue or the collectables movement?

    Particle effect: yep, there's sometimes a delay in GS when you start them. How to fix? *shrug* that's GS for ya. Maybe have them off screen and moved in when neede if it's a constant stream of particles?

    Moving objects towards player:
    I'd do it by checking a radius (assuming the magnetic effect has a limit) to x/y global attributes that are constrained to player location. Have the objects check those values instead of player location. You MIGHT get a speed/framerate increase as you no longer have multiple objects checking the player object and instead a set of global variables, but it's just a theory.

    I also realized I totally misread part of your initial post re: physics stuff.
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    I am referring to the movement. I have 2 global attributes which are constrained to playerX and Y. So I already have this. But using interpolate is the best way or? Because otherwise I have to turn on moveable and I don't want to do that.

    Concerning particles, should animate work better? Having an animation?

    @PixelMetal thanks!
  • LumpAppsLumpApps Member Posts: 2,881
    For as far as I know interpolating is the best way performance wise. Spawning actors and particles are the two most process intensive things. Do you have an image in the particles? Make sure it is at the right size. If it is an explosion kind of effect you could get away with half size images. If it is possible to get the same effect with animation it could be better. Animation is less intensive.
    If you have more actors "magnetized" do they all spawn particles? Than is it possible to turn them of on some. So have only 1 or 2 spawning particles

    To test you can click the particle behavior off and see if it is any better.
  • sparkaniasparkania Member, PRO Posts: 300
    You already gave my answer.. to clean up some performance, you might consider animating instead of particles (if you have allot of actors doing this) and set them all to the same FPS
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    @sparkania @LudwigHeijden @PixelMetal

    Guys just one more question, when having a big scene in height, can I somehow load the whole scene. Like I always have the feeling when I move to a new unshown part of the scene there is a short lag. Is there a way to really load all so things do not get laggy.

    thx
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    The thing is, I have many animated actors which appear after and after, and they always cause a short lag when they get in the area which the player sees. When I turn off the animation the game runs smooth as hell. Size is 64x64.

    Any help would be awesome =)
  • LumpAppsLumpApps Member Posts: 2,881
    I never noticed any lag on big scenes. I have a prototype for a game with lots going on and a camera moving fast and there is no lag for as far I can see.
    Perhaps it is something else?
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Thanks but I just turned off the rule of the animated actors, I also use a prototype, and then it was nearly gone. Mhm any ideas?
  • LumpAppsLumpApps Member Posts: 2,881
    How many frames does your animation have?
    Do you have preloading on?
    Is there anything spawned when you are seeing new things?
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    It has 7 frames @LudwigHeijden
    Preloading is on or off/ tried it but didn't make a big difference
    Nothing spawned, all is build before
  • PixelMetalPixelMetal Member Posts: 283
    @GuaveGames I don't get lag on larger scenes, but my framerate is definitely lower - I could see that being perceived as lag.
  • LumpAppsLumpApps Member Posts: 2,881
    You said you turned of the rule ofvthevanimated actors. Do you mean you turned their animation behavior off?
    Do they animate even when they are not in view? Or does the animation start when the get into view?
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Ok guys I found the problem and of course it's solution. I was having a save behavior in the animated items to collect. Every time I hit one it saved attributes. Please don't ask why it was like that. Now it saves, as it should normally, at the end of a level or when you fail. Game runs really smooth now.

    But thx for the help =)
Sign In or Register to comment.