Author Topic: Character is slowing down an enire room  (Read 841 times)

bx83

  • benjamin.rich@protonmail.com
Character is slowing down an enire room
« on: 04 Oct 2021, 06:26 »
I have a room which is noticeably slower than usual It only runs at <15 frames per second (out of 40 frames). When I locate a game character in it to another room, it speeds up to normal once again.



What is causing this? Has anybody heard of this problem before?

There's nothing of her in the code, eg. doing something 1200 times a second in repexec():

Code: [Select]
//----------------------------------------------------------------------------------------------------------------------
// room36.asc
// Room 36 (E Village - Dark Seeds, inside)
//----------------------------------------------------------------------------------------------------------------------

function room_FirstLoad()
{
  BeenToDarkSeeds=true;
 
  cGothGirl.Transparency = 0;
  cGothGirl.Clickable = true;
  cGothGirl.SetIdleView(35, 5);
}

//----------------------------------------------------------------------------------------------------------------------
// Room Load
//----------------------------------------------------------------------------------------------------------------------

function room_Load()
{
  cJulius.ScaleVolume = true;

RandLoopShirt=Random(1);
cGothGirl.Loop=RandLoopShirt;
  cGothGirl.SetIdleView(35, 5);
}


//----------------------------------------------------------------------------------------------------------------------
// Room After Fade In
//----------------------------------------------------------------------------------------------------------------------

function room_AfterFadeIn()
{
//Display("randloopshirt %d", RandLoopShirt);//cheat

  if (cJulius.PreviousRoom==RM_E_VIL_DARKSEEDS_OS) cJulius.Walk(527, 584, eBlock, eWalkableAreas);
}

//----------------------------------------------------------------------------------------------------------------------
// Room Repeat Exec
//----------------------------------------------------------------------------------------------------------------------

function room_RepExec()
{
 
if (ConversationIsOn) ConversationIsOn=false;
 
//walk of the shop facing away from camera, not down-left
  if (cJulius.x<=645) {
    if (cJulius.Loop==6 || cJulius.Loop==1) {
      cJulius.Loop=7;
    }
  }
 

if (BeenToAssayer && !dGothGirl.HasOptionBeenChosen(13)) {
cGothGirl.SetProperty("convodone",0);
  }
 
}

//----------------------------------------------------------------------------------------------------------------------
// Room Leave Left
//----------------------------------------------------------------------------------------------------------------------

function room_LeaveLeft()
{
  cJulius.FaceDirection(eDirectionUpLeft);
  cJulius.Walk(312, 530, eBlock, eWalkableAreas);
  cJulius.ChangeRoom(RM_E_VIL_DARKSEEDS_OS, 500, 430, eDirectionDownLeft);                             // dark seeds, outside
}

« Last Edit: 04 Oct 2021, 06:31 by bx83 »

bx83

  • benjamin.rich@protonmail.com
Re: Character is slowing down an enire room
« Reply #1 on: 04 Oct 2021, 09:03 »
The room has two characters.

When I remove 1 character, it goes fast; same if I remove the other.
They both overlap; I've tried making them non-solid, and separating them so they don't overlap -- no change, still slow speed.

The 2nd character has a huge area (about 1/2 screen size), BUT 80% of that is blank space.

What am I doing wrong here? Is it the characters or some other factor?

« Last Edit: 04 Oct 2021, 09:08 by bx83 »

Re: Character is slowing down an enire room
« Reply #2 on: 04 Oct 2021, 09:46 »
When I remove 1 character, it goes fast; same if I remove the other.
They both overlap; I've tried making them non-solid, and separating them so they don't overlap -- no change, still slow speed.

So, to clarify, the slowdown is only caused by 2 characters being in one room, not matter how they are located in relation to each other?

The 2nd character has a huge area (about 1/2 screen size), BUT 80% of that is blank space.

I need to note, that there's no such thing as "blank space" in terms of sprite's bitmap, blank space is still pixels, and having transparent areas requires engine to do roughly same work as if they had a visible color.

Because AGS stores sprites as raw bitmaps, it have to convert them into textures for display, sometimes "on the fly". Constantly updating a high high-resolution bitmap may slow the game down. I cannot tell whether this is a case or part of case here, that depends on other things.

* Does the big character animate?
* Which renderer are you using when running the game (software, Direct3D, OpenGL)?
* Do you have any large transparent GUI over your room? If so, may you also tell which version of AGS are you running?

bx83

  • benjamin.rich@protonmail.com
Re: Character is slowing down an enire room
« Reply #3 on: 04 Oct 2021, 09:54 »
* Does the big character animate?
Yes.

* Which renderer are you using when running the game (software, Direct3D, OpenGL)?
OpenGL

* Do you have any large transparent GUI over your room?
No.

If so, may you also tell which version of AGS are you running?
3.5.1.8

Re: Character is slowing down an enire room
« Reply #4 on: 04 Oct 2021, 10:01 »
* Does the big character animate?
Yes.

Does it animate all the time, if yes then how fast frame change; also does slowdown occur when it animates, will it still be happening when it does not?

bx83

  • benjamin.rich@protonmail.com
Re: Character is slowing down an enire room
« Reply #5 on: 04 Oct 2021, 10:05 »
It doesn't animate all the time, just when it's talking.
Slow-down occurs all the time.

bx83

  • benjamin.rich@protonmail.com
Re: Character is slowing down an enire room
« Reply #6 on: 04 Oct 2021, 10:17 »
Another interesting thing is that this game runs fine (no slowdown) on Mac, when compiled with 3.5.1.8 Mac engine (also running opengl).
But when run on an emulator OR on a genuine PC, this sort of slowdown happens in 2 rooms.

bx83

  • benjamin.rich@protonmail.com
Re: Character is slowing down an enire room
« Reply #7 on: 05 Oct 2021, 02:25 »
Reduced size - frame rate is up to 40/sec :)

Re: Character is slowing down an enire room
« Reply #8 on: 05 Oct 2021, 03:09 »
Reduced size - frame rate is up to 40/sec :)

I'd rather wish this was thoroughly investigated, because it's not normal for 1 sprite to cause such slowdowns.

There was something causing non-stop updates for unknown reasons. If you say that it does not animate all the time, and that this only happens when there's another character in same room, regardless of where it's position, then something unusual is happening.

bx83

  • benjamin.rich@protonmail.com
Re: Character is slowing down an enire room
« Reply #9 on: 05 Oct 2021, 03:40 »
Possibly it was some crap left over from a previous version; I’ve had the game upgraded every version from like 3.4.Whatever was popular in 2017. I can send you the room if you want? It’s still untouched in the main version, this was all done in the demo version.

Re: Character is slowing down an enire room
« Reply #10 on: 05 Oct 2021, 04:21 »
Possibly it was some crap left over from a previous version; I’ve had the game upgraded every version from like 3.4.Whatever was popular in 2017. I can send you the room if you want? It’s still untouched in the main version, this was all done in the demo version.

Could you send me the actual demo game instead? I would run it to see what's going on. Because this is a very curious problem.

bx83

  • benjamin.rich@protonmail.com
Re: Character is slowing down an enire room
« Reply #11 on: 05 Oct 2021, 05:46 »
Okay, but it’s the fixed version…

Go to my ad in AGS Games in Production, download demo there.
‘Lost on Cow Island’

https://www.adventuregamestudio.co.uk/forums/index.php?topic=57420.0

Go into cave; use knife with flowers by the lake; use it again with flowers, yielding sap; go out to beach, use sap on quicksand; keep walking left until you reach the outside of Dark Seeds; go inside.

For an older version of the demo with slowdown, go to:
https://bluekeystudios.com/filez/hsUfu7234rth/ohHQj7g-10B5.rar
« Last Edit: 05 Oct 2021, 05:54 by bx83 »

Re: Character is slowing down an enire room
« Reply #12 on: 05 Oct 2021, 18:28 »
For an older version of the demo with slowdown, go to:
https://bluekeystudios.com/filez/hsUfu7234rth/ohHQj7g-10B5.rar

I tried this and did not notice any slowdown in the room with the plant.

However, there's definitely a slowdown while the Save/Load menu is on screen. I believe this is a problem addressed by a recent patch in 3.5.1.
Quote
- Further improvement to GUI perfomance: don't redraw GUI when the mouse cursor is hovering over or interacting with controls not leading to an actual visual change.


It's  quite easy to see where the game is slower if you run it with "--test --fps" command line arguments. Engine will display fps counter in the bottom-left. Press "Ctrl +E" to toggle "infinite fps mode" , in which engine runs as fast as it can. This way you may notice even slightest downfall in perfomance.

bx83

  • benjamin.rich@protonmail.com
Re: Character is slowing down an enire room
« Reply #13 on: 05 Oct 2021, 19:16 »
Have a look at the trailer in the northern village (travel upwards at the the crossroads). This room has a large sprite, and major slowdown.

What kind of PC do you have?
« Last Edit: 06 Oct 2021, 07:35 by bx83 »

Re: Character is slowing down an enire room
« Reply #14 on: 06 Oct 2021, 16:15 »
I was able to notice change in fps with the "infinite fps" mode (as described above).

It roughly is like this: in a random room it runs at 550-600 fps, when I enter a trailer it's down to 520 fps, and there's also an interesting effect that when I move cursor around the big character it goes down to 420 fps. The latter is maybe related to tooltip gui keep redrawing itself.

There's also something strange with the "red kettle", when I hover cursor over it fps drop down to 300...

PS. I noticed that in the trailer there's a clock with a moving pendulum, wonder if it's the one causing this regular fps drop, as the character itself does not move much.

I don't see much slowdown in the "Dark Seed" house still.


My computer is Intel Core i5-6500 (3.2 GHz) with 16 GB RAM.
« Last Edit: 06 Oct 2021, 16:22 by Crimson Wizard »

bx83

  • benjamin.rich@protonmail.com
Re: Character is slowing down an enire room
« Reply #15 on: 07 Oct 2021, 01:14 »
What graphics card?

Re: Character is slowing down an enire room
« Reply #16 on: 07 Oct 2021, 07:18 »
What graphics card?

I don't think graphic card will be a problem with AGS, because in AGS engine most job is done by CPU due to how engine works; at least it should not appear because of a few big sprites on screen.

But for the reference it's Nvidia GTX 960 (2 GB)

bx83

  • benjamin.rich@protonmail.com
Re: Character is slowing down an enire room
« Reply #17 on: 11 Oct 2021, 01:09 »
Well I think I cracked it...
In game-setup, I used to have some options turned off; now they're turned on. Everything's fixed and the slowdown has disappeared completely!
So either:
1) I had shitty options, which are now fixed by trial and error
or
2) some bit of config crap was wiped away, this hidden error is now overwritten with new options and corrected, and all is merry :)

So another bizarre ending to a problem posted by me.

Here are the game options I remeber changing: