Character is slowing down an enire room

Started by bx83, Mon 04/10/2021 06:26:28

Previous topic - Next topic

bx83

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: ags
//----------------------------------------------------------------------------------------------------------------------
// 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
}



bx83

#1
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?


Crimson Wizard

Quote from: bx83 on Mon 04/10/2021 09:03:25
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?

Quote from: bx83 on Mon 04/10/2021 09:03:25
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

* 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

Crimson Wizard

Quote from: bx83 on Mon 04/10/2021 09:54:08
* 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

It doesn't animate all the time, just when it's talking.
Slow-down occurs all the time.

bx83

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

Reduced size - frame rate is up to 40/sec :)

Crimson Wizard

Quote from: bx83 on Tue 05/10/2021 02:25:51
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

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.

Crimson Wizard

Quote from: bx83 on Tue 05/10/2021 03:40:49
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

#11
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

Crimson Wizard

Quote from: bx83 on Tue 05/10/2021 05:46:19
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

#13
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?

Crimson Wizard

#14
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.

bx83


Crimson Wizard

Quote from: bx83 on Thu 07/10/2021 01:14:36
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

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:


SMF spam blocked by CleanTalk