Lag spike and critical game errors

Hey @grazer,
For once, I actually really need help, pretty badly.

I was testing some basic enemies and a sudden lag spike ruined the whole game.
What happens is, even during lag, everything but the timers go slow.
The timers continue to tick the same, and emit enemies, background, and change directions.
It is because of this single lag spike, that stars will begin to overlap and multiply, there will be 50
enemies within the minute, and the enemies don’t follow their designed paths because they move slower,
but the timer still switches out their directional change anyway.

Here is what I mean. Xediga Vade, click anywhere, then click a ship, spacebar is shoot.
Keep in mind, I have only put in maybe 15 hours into all this, and there is a lot of errors,
like how the purple ship doesn’t emit blue if it gets emitted, only if it’s already in the level.
The collision and proximity doesn’t detect emitted objects for whatever reason.
Emitted objects also do not match rotation, so that may be another issue.
I had to make the attached flames shoot the lasers, because the ships emit shots sideways for no reason.

http://flowlab.io/game/play/72812

Hey, I played it for quite some time and couldn’t get it to lag. I can see how a really long lag spike could cause the types of glitches you describe. From your description it almost sounds like there was some sort of bug being triggered, like a stuck loop if it lasted for several seconds or more.

As for the collision issues, collisions can fail to fire if two objects are small enough and moving quickly enough that they never actually touch, like so:

bullet: =>
enemy: O

frame 1: => O
frame 2: => O
frame 3: O =>

                         ^^^ never actually touch

Not sure if my ascii art is very helpful, but in general if you are having trouble with collisions, you can try enlarging the hit area of one object or the other. FWIW, I didn’t notice any missed collisions while I was playing

Anyway, maybe you can help with some more details?:

  • Can you trigger the lag spike reliably? Is there something specific I can do to reproduce it?
  • What do you mean by “the ships shoot sideways”? Do you mean they just shoot in some arbitrary direction?

Alright, probably my computer lagged because chrome was using a lot of data after all day, but now it doesn’t lag. Maybe if you don’t shoot any enemies, lag will start. OH, wait there was a way. Open a new tab, wait a bit, go back to the game and you will see a mass of overlapped stars. That doesn’t really matter too much though, maybe it was a one time thing.

The ships don’t shoot up, I have no clue why. If I make an emit on the ship, it doesn’t shoot up, it shoots left or right, no matter what I do. So I made the Flame have the emit.

The last thing is notice the silver and purple ship have blue flames, but if I emit that ship, the collision and proximity for Flame and Flame 2 no longer trigger. This applies to all emitted ships and enemies.

Well I tried to cause lag, and nothing. It’s a beautiful lag free game with even 50 enemies on the screen. Still though, I increased the radius, and the ships flames still aren’t changing animation. Maybe I will just make new objects. How many objects am I limited to?

I was also wondering if there is a way to make the background and level move, without you actually going anywhere. See, I want the player to be able to move up/down/left/right but the level, barrier, and enemies remain going the same speed up the level. Since I can’t figure out a way, (I thought motor, but motor keeps increasing speed over time) I guess I can just keep emitting background for now. Still, it’s a pain when you want to emit enemies and background at the same time so they look like they are on the ground, but hey, timers are fine, if you have time to wait to check each time.

I found a simple way to keep barriers and stuff going at the same speed up the level, as for the character, it can move freely across the screen without going off it. Also, if you have a separate object in the level to scroll the background, anything emitted could just extract that objects velocity so they are always the same speed. The character also follows the level’s speed until you decide to move.

http://flowlab.io/game/view/70406

Hey Mhx,

Great logic on the blue metal butterfly ships. Get a real sense you’re playing a well constructed game.

Interesting structure leon. The only issue is “extraction” won’t work for enemies, because they are emitted without specific numbers. That makes me curious how this will all turn out.

Thanks muddy, they were actually going to be wasps, but I figured, whatever, make them glow blue, y’know? I need to make tons more stuff, and I’m not really looking too forward to it. Still though, it’s coming along alright.

Alright, I found a simple simple major simple solution.
I made a bundle with Always — number -2 — +y position
Then I gave the bundle to all enemies and objects I wanted to hover stationary.