Too many players being spawned.

RosalinaGalaxer

  • Posts: 239
Hi.

So, I got my checkpoints to work properly after a while of fiddling around. However, after dying and respawning several times, the game begins to lag a lot. I believe that this is because I am spawning more than one player every time. Does anyone know how to help? I am attaching the screenshot of my code.
Ģ̷̓l̴̥̒͑̕͝ì̷̘͈̬͈̖̂͂̔̕t̷͔͇̯̥̬̀̽̓͜͝c̵͇̦̼̮̉̐̈́̕͝ͅͅḣ̵̡̫̞͚̐̅ͅë̶̗̦̪̖͚̜́͊̄͑s̵̺̹̖̼̥̃.̴̮̫͐ ̶̛̓̇̾̎

“I have never seen a more heated discussion about context, jazz, and cats.” - VanillaButterz

colburt187

  • *
  • Posts: 2403
The when actor is killed block should only trigger once, so you shouldn't get more than one actor spawned.

Try clicking the log viewer and see if you have any null errors etc happening in the background.

RosalinaGalaxer

  • Posts: 239
Hi,

First, thanks for the response!

I've messed around with it a bit, and it only starts spawning more players if there is more than one checkpoint in the scene.

I did not find any errors in the log viewer.
Ģ̷̓l̴̥̒͑̕͝ì̷̘͈̬͈̖̂͂̔̕t̷͔͇̯̥̬̀̽̓͜͝c̵͇̦̼̮̉̐̈́̕͝ͅͅḣ̵̡̫̞͚̐̅ͅë̶̗̦̪̖͚̜́͊̄͑s̵̺̹̖̼̥̃.̴̮̫͐ ̶̛̓̇̾̎

“I have never seen a more heated discussion about context, jazz, and cats.” - VanillaButterz

RosalinaGalaxer

  • Posts: 239
Maybe each checkpoint is spawning a player? If there are only two checkpoints the lag does not come as quickly as three checkpoints.
Ģ̷̓l̴̥̒͑̕͝ì̷̘͈̬͈̖̂͂̔̕t̷͔͇̯̥̬̀̽̓͜͝c̵͇̦̼̮̉̐̈́̕͝ͅͅḣ̵̡̫̞͚̐̅ͅë̶̗̦̪̖͚̜́͊̄͑s̵̺̹̖̼̥̃.̴̮̫͐ ̶̛̓̇̾̎

“I have never seen a more heated discussion about context, jazz, and cats.” - VanillaButterz

colburt187

  • *
  • Posts: 2403
ah yes, if the spawn code is attached to the checkpoint then the could all be spewing actors. Although, how many actors do you have on the scene? It should take quite a few before things start lagging?

RosalinaGalaxer

  • Posts: 239
Actor in the actual meaning of the word, I have 5 not counting checkpoints. 2 are invisible things that prevent getting all your powerups by dying.

Actor by meaning player, I only have one.

I think I need to code it so that only one checkpoint will spawn them, but I have no clue how to start...
Ģ̷̓l̴̥̒͑̕͝ì̷̘͈̬͈̖̂͂̔̕t̷͔͇̯̥̬̀̽̓͜͝c̵͇̦̼̮̉̐̈́̕͝ͅͅḣ̵̡̫̞͚̐̅ͅë̶̗̦̪̖͚̜́͊̄͑s̵̺̹̖̼̥̃.̴̮̫͐ ̶̛̓̇̾̎

“I have never seen a more heated discussion about context, jazz, and cats.” - VanillaButterz

colburt187

  • *
  • Posts: 2403
that shouldn't be causing lag, you should be able to have like 60-100 actors on the screen before lag happens. If you want to send me the game file I could have a quick look through to see if anything obvious is causing it.

in terms of the checkpoints, do you hit them in order or is there a possibility to return to a previous checkpoint?


RosalinaGalaxer

  • Posts: 239
Since it is supposed to be a large Metroidvania game, you can go back to checkpoints several times.

I just realized that there is only one checkpoint in this file, I can send another with more if you don't find anything.
Ģ̷̓l̴̥̒͑̕͝ì̷̘͈̬͈̖̂͂̔̕t̷͔͇̯̥̬̀̽̓͜͝c̵͇̦̼̮̉̐̈́̕͝ͅͅḣ̵̡̫̞͚̐̅ͅë̶̗̦̪̖͚̜́͊̄͑s̵̺̹̖̼̥̃.̴̮̫͐ ̶̛̓̇̾̎

“I have never seen a more heated discussion about context, jazz, and cats.” - VanillaButterz

JeffreyDriver

  • *
  • Posts: 2168
All of your checkpoints are spawning actors when you die, so you quickly end up with dozens of actors. As all of these are registering collisions, than why the game slows down so quickly.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

RosalinaGalaxer

  • Posts: 239
Yeah, I realized that I had messed around a bit before I sent the game, and didn't put it back to normal. There are three checkpoints, but not working right.

Basically, the same thing is happening, but all the players are being spawned at the EXACT same place.

If I attached the spawning code to the player, would that help?
Ģ̷̓l̴̥̒͑̕͝ì̷̘͈̬͈̖̂͂̔̕t̷͔͇̯̥̬̀̽̓͜͝c̵͇̦̼̮̉̐̈́̕͝ͅͅḣ̵̡̫̞͚̐̅ͅë̶̗̦̪̖͚̜́͊̄͑s̵̺̹̖̼̥̃.̴̮̫͐ ̶̛̓̇̾̎

“I have never seen a more heated discussion about context, jazz, and cats.” - VanillaButterz

JeffreyDriver

  • *
  • Posts: 2168
You could approach it like this:

When a player hits a checkpoint you record the X and Y values of the player in that position.
When the player dies, don't kill the actor, but instead move it back to the last X Y value recorded.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

RosalinaGalaxer

  • Posts: 239
I just redid the code a bit and it works well now. Thanks a lot for your help guys! Much appreciated!
Ģ̷̓l̴̥̒͑̕͝ì̷̘͈̬͈̖̂͂̔̕t̷͔͇̯̥̬̀̽̓͜͝c̵͇̦̼̮̉̐̈́̕͝ͅͅḣ̵̡̫̞͚̐̅ͅë̶̗̦̪̖͚̜́͊̄͑s̵̺̹̖̼̥̃.̴̮̫͐ ̶̛̓̇̾̎

“I have never seen a more heated discussion about context, jazz, and cats.” - VanillaButterz