[FIXED] Performance Issues (Game too big?)

Been working on this project for a while for a festival and also for my own enjoyment. I’ve spent quite a while working on it and created a rather large game world in my opinion. Today, all of the sudden my game will barely or load the editor or the player when I try to play it. Used multiple different computers. Even when I can convince the game to run, it experiences very bad lag spikes when the character moves, which has not a problem previously. My only concern is that I made the game too big and used too many blocks. Didn’t add any code or behaviors between broken and fixed state. Any help would be very appreciated.

UPDATE: I exported it as a windows application, and the game itself loaded after a bit of loading, and as with in browser, it still plays slow and laggy


So the more objects in the game, the longer the loading will take - so that’s probably normal. The lag is unexpected though, so I’ll check that out and see what’s going on there.

Thanks for reporting.

I guess SB4 will be simpler then. Jk

Instead of a fourth sequel I might just make a spinoff

Currently my game editor will not load. The editor displays the background color and the GUI Labels I set in the main character, and the grid detects when there is a block present or not. But other than that nothing is visible. When I click and hold to move a block, the block then is visible but then when placed back down again, is once again invisible.

Hope I don’t come across as whiny

@CrimsonBlackGames at this point wishing I would have made my game simpler

I knew someone else would run into something like this one day. I was always hitting massive lag issues in my games, but nobody else ever would make a game that big. Now here we are lol.

Ahem… SB3, SB2, Crimson Hunters, and a few others of mine.

@CrimsonBlackGames did those hit terminal lag to where the game didn’t load or move? Maybe there were other cases. I know SB2 lagged with lasers.

3 has a different system, so it shouldnt be as bad as 2

Hey @18CALLRED - you’re not coming across as whiny :slight_smile:

Your game level is for sure getting big enough (28,000 objects) to cause the engine to start struggling. This is actually good though - it is causing the bottlenecks to show up where they can get fixed :slight_smile:

The good news is that it’s fixable, I see four main hot spots that I need to address:

  1. The initial behavior loading (loading)
  2. The game object setup (loading)
  3. The object run loop (lag)
  4. The physics engine loop (lag)

The only one of those that seems like a really difficult fix is #4. I have an idea of how to fix the other 3 already.

The bad news is that some of these changes will be risky, so I’ll need to work carefully and do lots of testing, so it’s going to take a little while to get them fixed.

@grazer You are phenomenal. I am glad that I can be of a ‘help’…?

I found something interesting, however. Whenever I use Flowlab with Google Chrome it seems to experience more problems and sometimes wont load unless I get lucky. I’ve used Internet Explorer and Firefox instead and they actually seem to work better for me (Definitely unexpected). Maybe my browser is a possible cause? Unsure, most of this is beyond my knowledge.

Thanks again for the help.

Chrome can lag, it runs a lot of processors for unnecessary junk, and eats up ram if you don’t have a lot, but it runs fast in loading the game in /embed. I hear Opera is the current fastest browser. Maybe give it a shot.

Hey @18CALLRED - I just deployed an update that should fix your problems with freezing on load or failing to load. This update doesn’t contain all the optimizations, so there are still some more to come. In particular:

  • Playing the game is a little better, but still laggy. I have some fixes queued up that will help. In particular I think you could take advantage of the “pause offscreen objects” setting I’m adding to get rid of any lag.

  • Switching between edit & play mode still has a nasty delay. Hopefully I can improve this.

@grazer is the “pause off screen object” going to be an optional checkmark? If it applies to all games and all objects, it will ruin most people’s games, especially boss fights and possibly messaged doors or objects. I remember it messing up a game I made way back, where the enemies would ignore the collision trigger to flip (like Mario red koopas), and would fall off platforms off screen, and you would come back to chaos of desynced special commands.

Yep, it’s an optional setting for exactly that reason. I don’t love the idea of adding kind of arbitrary settings like that, but I think it’s probably a useful enough feature that it’s worth adding. It will default to “off” for exactly the reasons you described.

When it’s on, though, it would make a larger level (like the game in this thread) run much faster.

@18CALLRED - the new optimization update makes your game run significantly faster. Try it out and let me know what you think.

It does not include the pause all objects option we discussed, since I’m trying to avoid having the extra setting if possible.

@grazer Hello. Sorry for the late reply

The game and the editor both run very well, and all of my discussed problems have been solved. I have even expanded my game to about 68k objects, and it runs flawlessly. Whatever you did fixed it! Thanks!

Two bugs in your game I wanted to point out.
The Jojo song plays over top of itself, so I had about 15 Jojo theme songs looping at once.
The other issue is I got the god essence and my browser crashed. Not sure why, but something in your god essence caused a heavy load and the tab had to be force closed.