Author Topic: Animated background and lag  (Read 3472 times)

Animated background and lag
« on: November 04, 2017, 11:04:25 am »
hello

i have created a small mod whicih seems to cause huge performance issues and i cant find out why
i am curious if it is an engine limitation or i did something wrong
https://i.gyazo.com/f1ea69d577600d2613519c49e01a2137.mp4
i basically created 86 low-quality jpeg files, each around 40kb and 1440x900 resolution, then loaded them as main menu background using .fofrm format
now the problem is that using this mod FOnline.exe eats up around 1000mb of ram  instead of the normal 240
based on the number and the size of the JPGs i used, if i calculated correctly the difference in RAM usage should be around 4mb
reducing the amount of pictures used also reduces the ram usage but still insane values

Offline Slowhand

  • Go for the eyes, Boo! Go for the eyes!
Re: Animated background and lag
« Reply #1 on: November 04, 2017, 02:11:34 pm »
I do not know the answer, just have some ideas:

- The idea is interesting, expand on the main screens to be able to use animations.
- Your design skills seems to match mine (this is not a compliment, mine suck)
- 1440 * 900 * 4 * 86 ~400MB, hm, let's say that the engine decompresses the JPG files to Bitmaps in memory and then uses those, the increases in memory requirement seems close to valid.
- Try to make another .fofrm with Bitmaps and see it that changes anything lag and memory wise. (If it decompresses the JPG real time (and does not cache it, but then why the huge memory drain), and is really shit at it, maybe that explains the FPS lag?

Re: Animated background and lag
« Reply #2 on: March 10, 2018, 04:23:44 pm »
I think it's possible to create a special object class that will represent the sprites you are using to "animate" the screen, that will move itself each frame by some delta in some direction, until they reach some screen position and then destroy it when it's time to. Ask the client to load your sprite you want to being drawn when the client is on login screen, it might probably solve the lag issue and you wont have to create a fully animated background picture for different resolutions on top of that.

Offline Wipe

  • Rotator
  • Random is god
Re: Animated background and lag
« Reply #3 on: March 11, 2018, 03:34:18 pm »
Why destroy? Just change object position when it's out of view ;)
« Last Edit: March 11, 2018, 03:47:57 pm by Wipe »
Games are meant to be created, not played...