The right settings for spawning actor. It's falters at 176 spawning actors

Hello Everyone,

I need some help with 176 spawning actors in one scene. It will be maybe more than that, I think like 300. I want to move upside, but then there must be spawned actors that's spawns any "obstacles" (different shapes in png images) from left to right and from right to left, but then every time on 160p in height.

So actually I want that the spawned actors only spawn when they are -700p and +800p in the Y (height). I placed 176 spawn actors in every 160p outside of the screen.

How can I figure this out without faltering in the game?

Please need your help over here...

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Please define faltering? Are you talking lag? Failure to keep spawning?

  • murat.sogukcesmemurat.sogukcesme Member, PRO Posts: 37

    @Lost_Oasis_Games said:
    Please define faltering? Are you talking lag? Failure to keep spawning?

    Hi there, thanks for your comment. I put some videos in of it. So you can see then what I mean with faltering.

  • murat.sogukcesmemurat.sogukcesme Member, PRO Posts: 37

    I want an attribute or setting, if the player controller comes near by a spawn actor, between +700 and -700 of the player, then it have to spawn an obstacle. But if the spawn actors are place under -700 or above +700 then it stops spawning. This to prevent faltering in the game.

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited April 2016

    Constrain the players X and Y position in some global attributes i.e.

    (on your player actor)
    Constrain Attribute: game.playerX = self.Position.X
    Constrain Attribute: game.playerY = self.Position.Y

    On your spawning actors have a rule like this:

    If game.playerX >= (self.Position.X - 700) and game.playerX <= (self.Position.X +700) and game.playerY >= (self.Position.Y - 700) and game.playerY <= (self.Position.Y + 700)
    ...Spawn an obstacle (you will probably need to put this in a timer if you want it to constantly happen while the player is close by)

    That should work

  • murat.sogukcesmemurat.sogukcesme Member, PRO Posts: 37

    @KevinCross said:
    Constrain the players X and Y position in some global attributes i.e.

    (on your player actor)
    Constrain Attribute: game.playerX = self.Position.X
    Constrain Attribute: game.playerY = self.Position.Y

    On your spawning actors have a rule like this:

    If game.playerX >= (self.Position.X - 700) and game.playerX <= (self.Position.X +700) and game.playerY >= (self.Position.Y - 700) and game.playerY <= (self.Position.Y + 700)
    ...Spawn an obstacle (you will probably need to put this in a timer if you want it to constantly happen while the player is close by)

    That should work

    Hey Kevin, thanks for your response. I've tried to setup the attributes but it didn't worked out. Is it maybe possible if I put a sample of this project as attachment, so that you can set these attributes up in the project. And the other issue is the falltering in the game, You can see it, if I send it to you.

    The game is in portrait position.

    Is this possible?

  • KevinCrossKevinCross London, UKMember Posts: 1,894

    @murat.sogukcesme said:
    Hey Kevin, thanks for your response. I've tried to setup the attributes but it didn't worked out. Is it maybe possible if I put a sample of this project as attachment, so that you can set these attributes up in the project. And the other issue is the falltering in the game, You can see it, if I send it to you.

    The game is in portrait position.

    Is this possible?

    Hi, give me a moment and I'll see if I can throw together a basic project for you. I won't have the actors spawning obstacles but will instead have them change colour when the player is near. From that you can add in your own code to spawn obstacles etc.

  • murat.sogukcesmemurat.sogukcesme Member, PRO Posts: 37

    @KevinCross said:
    Constrain the players X and Y position in some global attributes i.e.

    (on your player actor)
    Constrain Attribute: game.playerX = self.Position.X
    Constrain Attribute: game.playerY = self.Position.Y

    On your spawning actors have a rule like this:

    If game.playerX >= (self.Position.X - 700) and game.playerX <= (self.Position.X +700) and game.playerY >= (self.Position.Y - 700) and game.playerY <= (self.Position.Y + 700)
    ...Spawn an obstacle (you will probably need to put this in a timer if you want it to constantly happen while the player is close by)

    That should work

    Must the attributes in parentheses, I mean the self.position.x-700)..

  • murat.sogukcesmemurat.sogukcesme Member, PRO Posts: 37

    @KevinCross said:

    @murat.sogukcesme said:
    Hey Kevin, thanks for your response. I've tried to setup the attributes but it didn't worked out. Is it maybe possible if I put a sample of this project as attachment, so that you can set these attributes up in the project. And the other issue is the falltering in the game, You can see it, if I send it to you.

    The game is in portrait position.

    Is this possible?

    Hi, give me a moment and I'll see if I can throw together a basic project for you. I won't have the actors spawning obstacles but will instead have them change colour when the player is near. From that you can add in your own code to spawn obstacles etc.

    Thanks Kevin, I am looking forward to your sample project.

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited April 2016

    Here you go. Hope this is close to what you were after.

    Drag the white box around the screen and move them towards the yellow boxes. If you get within 100 pixels of a box that box will change colour. I didn't go with 700 pixels as 700 pixels is bigger than the scene so the boxes would always be red.

    This will work the same if you're moving the player around with your keyboard or controller etc. I only chose dragging as it's quicker to implement.

    It's a Windows project but you should be able to open it on a Mac (you might have to search the forums on how to do that) I think you just need to add an extension .gameproj to the folder (after you've extracted the folder from the zip file)

    Where I'm changing the colour you can add in your timer to spawn obstacles. You don't need any code in the else block as it will only spawn when the player is near it. I wanted to change the colour back to yellow which is why I put in the change attributes in the else block.

    Edit: And no you don't need to put the parenthesis in the rule. I just put them in so it's easier to read/understand on the forum.

  • murat.sogukcesmemurat.sogukcesme Member, PRO Posts: 37

    @KevinCross said:
    Here you go. Hope this is close to what you were after.

    Drag the white box around the screen and move them towards the yellow boxes. If you get within 100 pixels of a box that box will change colour. I didn't go with 700 pixels as 700 pixels is bigger than the scene so the boxes would always be red.

    This will work the same if you're moving the player around with your keyboard or controller etc. I only chose dragging as it's quicker to implement.

    It's a Windows project but you should be able to open it on a Mac (you might have to search the forums on how to do that) I think you just need to add an extension .gameproj to the folder (after you've extracted the folder from the zip file)

    Where I'm changing the colour you can add in your timer to spawn obstacles. You don't need any code in the else block as it will only spawn when the player is near it. I wanted to change the colour back to yellow which is why I put in the change attributes in the else block.

    Edit: And no you don't need to put the parenthesis in the rule. I just put them in so it's easier to read/understand on the forum.

    Thanks Kevin, I go to check it now. Let you know about it.

    I appreciate that.

  • murat.sogukcesmemurat.sogukcesme Member, PRO Posts: 37

    @murat.sogukcesme said:

    @KevinCross said:
    Here you go. Hope this is close to what you were after.

    Drag the white box around the screen and move them towards the yellow boxes. If you get within 100 pixels of a box that box will change colour. I didn't go with 700 pixels as 700 pixels is bigger than the scene so the boxes would always be red.

    This will work the same if you're moving the player around with your keyboard or controller etc. I only chose dragging as it's quicker to implement.

    It's a Windows project but you should be able to open it on a Mac (you might have to search the forums on how to do that) I think you just need to add an extension .gameproj to the folder (after you've extracted the folder from the zip file)

    Where I'm changing the colour you can add in your timer to spawn obstacles. You don't need any code in the else block as it will only spawn when the player is near it. I wanted to change the colour back to yellow which is why I put in the change attributes in the else block.

    Edit: And no you don't need to put the parenthesis in the rule. I just put them in so it's easier to read/understand on the forum.

    Thanks Kevin, I go to check it now. Let you know about it.

    I appreciate that.

    Do you which attribute I can set for setting the spawn actor on on/off? Is there any option or attribute for it?

  • KevinCrossKevinCross London, UKMember Posts: 1,894

    If you mean spawning your obstacle actors when the player is near then just put a timer inside the rule and a spawn actor behaviour inside that timer. The timer should only work when the player is near the spawner. When it moves away the timer should stop and no more actors should spawn

  • murat.sogukcesmemurat.sogukcesme Member, PRO Posts: 37

    @KevinCross said:
    If you mean spawning your obstacle actors when the player is near then just put a timer inside the rule and a spawn actor behaviour inside that timer. The timer should only work when the player is near the spawner. When it moves away the timer should stop and no more actors should spawn

    Kevin, Thanks for your help. I think I got it now. I let you know in a short time.

Sign In or Register to comment.