Author Topic: [fixed] Strange Lag  (Read 3386 times)

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
[fixed] Strange Lag
« on: 23 December 2012, 04:08:15 »
About every second MG freezes for probably a 1/8 of a second, it's very noticable and annoying.
My framerate is great... and I checked task manager. CPU usage and RAM are a-ok. GPU usage hangs between 20-30 percent, but I have to alt-tab it may be dropping as soon as I leave fullscreen..
This issue doesn't occur when the game is paused but as soon as I unpause it starts happening again.
« Last Edit: 4 January 2013, 06:18:25 by softcoder »
Egypt Remastered!

Proof: Owner of glest@mail.com

tomreyn

  • Local Moderator
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Strange Lag
« Reply #1 on: 23 December 2012, 04:34:31 »
I'm not sure this is what you are seeing (since you say CPU usage is ok - is this the total on all cores, or are all cores ok if oyu look at them individually?), for me this happens when I the CPU core which most of MegaGlest runs on is entirely maxed out. In this case the total CPU load is still mediocre, it's just that the main thread is completely busy, so the processing stops repeatedly for short sequences.

Which faction were you using, what was your game setup? Does this always happen, also on 64x64 maps with just two players playing the same faction?
Is this MegaGlest 3.7.1 on Windows 7?
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #2 on: 23 December 2012, 04:44:34 »
I'm not sure this is what you are seeing (since you say CPU usage is ok - is this the total on all cores, or are all cores ok if oyu look at them individually?), for me this happens when I the CPU core which most of MegaGlest runs on is entirely maxed out. In this case the total CPU load is still mediocre, it's just that the main thread is completely busy, so the processing stops repeatedly for short sequences.

Which faction were you using, what was your game setup? Does this always happen, also on 64x64 maps with just two players playing the same faction?
Is this MegaGlest 3.7.1 on Windows 7?


Windows 8, MG 3.7.1. Playing with my own custom techtree, as tech though. I was on a 256*128 map I think. And I believe one of my cpu cores was maxed out... It always uses my second core and leaves my last 2 doing nothing.

I'll open my save game and gather more info.
Egypt Remastered!

Proof: Owner of glest@mail.com

tomreyn

  • Local Moderator
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Strange Lag
« Reply #3 on: 23 December 2012, 08:01:48 »
This can be an effect of a complex techtree. It would be interesting to know whether you are able to reproduce it with a simple setup, too, such as with a small map and Magitech. Maybe also with your techtree on a small map (and one where pathfinding is not an issue).
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Strange Lag
« Reply #4 on: 26 December 2012, 07:17:22 »
Without having something to actually test ourself its going to be hard to comment on this. Package up the techtree and give a link so that we can see the issue for ourselves.

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #5 on: 26 December 2012, 20:59:43 »
https://www.dropbox.com/s/fjhedrdfghtp0m3/magitech-refit.7z

Get a big game going and you'll come across this issue.
Egypt Remastered!

Proof: Owner of glest@mail.com

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Strange Lag
« Reply #6 on: 26 December 2012, 22:57:14 »
https://www.dropbox.com/s/fjhedrdfghtp0m3/magitech-refit.7z

Get a big game going and you'll come across this issue.
Ahh, must be windows 8, I heard it has problems...
Get the Vbros': Packs 1, 2, 3, 4, and 5!

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Strange Lag
« Reply #7 on: 26 December 2012, 23:22:43 »
Please explain the exact steps to reproduce the issue. Which factions and how many slots etc and what exactly we should look for?

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #8 on: 27 December 2012, 02:09:46 »
How about I upload the save file?

https://www.dropbox.com/s/fjhedrdfghtp0m3/magitech-refit.7z

Get a big game going and you'll come across this issue.
Ahh, must be windows 8, I heard it has problems...

Right now I have Premiere, After Effects, Photoshop, Dishonored, Cheat Engine, Skype, Adobe Bridge, Steam, and Firefox open and at the same time I'm playing Far Cry 3 at high settings. I don't think it's an issue with Win8 or my computer.
Egypt Remastered!

Proof: Owner of glest@mail.com

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Strange Lag
« Reply #9 on: 29 December 2012, 00:39:50 »
Arch please upload the saved game at the point where performance is bad. Explain exactly what i am looking for also.

Thanks

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #10 on: 29 December 2012, 04:46:36 »
Quote from: myself
About every second MG freezes for probably a 1/8 of a second, it's very noticable and annoying.

Download
Egypt Remastered!

Proof: Owner of glest@mail.com

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Strange Lag
« Reply #11 on: 29 December 2012, 06:55:08 »
That link requires me to 'have permission' to access the file which i do not have.

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #12 on: 29 December 2012, 07:21:11 »
Crap, let me fix that.

Download
Egypt Remastered!

Proof: Owner of glest@mail.com

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Strange Lag
« Reply #13 on: 1 January 2013, 20:57:07 »
I've made a small improvement allowing AI decisions to be multi-threaded. This does not get rid of the lag but seems to make it less noticeable.

Try out svn.

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #14 on: 1 January 2013, 20:58:54 »
Quote
Try out svn.

How?
Egypt Remastered!

Proof: Owner of glest@mail.com

MightyMic

  • Technician
  • ****
  • Posts: 150
  • To mod, or not to mod...
    • View Profile
Re: Strange Lag
« Reply #15 on: 1 January 2013, 21:12:38 »
This is the easiest way http://w32.nightly.megaglest.org/nightly/

Edit: That's just binaries, Full Download

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Strange Lag
« Reply #16 on: 1 January 2013, 21:16:30 »
There is a windows build available here every time we commit code into svn (as already mentioned in the megaglest forum):

Code: [Select]
http://w32.nightly.megaglest.org/nightly/
The build for windows has not been working for a month so i am fixing it, don't download unless the date has todays date, then you will know it is fixed.

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #17 on: 1 January 2013, 21:19:16 »
Oh, then I'm gonna wait..
Egypt Remastered!

Proof: Owner of glest@mail.com

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #18 on: 3 January 2013, 01:08:15 »
I installed the latest nightly build.

On my I7-740qm processor I get the same issue, it maxes out multiple threads(not all at once, it's kinda chaotic), particularly my 2nd thread in the 2nd core. Overall usage is very consistently 25%.
Egypt Remastered!

Proof: Owner of glest@mail.com

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Strange Lag
« Reply #19 on: 3 January 2013, 01:25:21 »
Try adding this to glestuser.ini

Code: [Select]
MaxPathfinderNodeCount=1000
(the default is 2000, so try smaller #'s and see if that improves performance in this case)

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #20 on: 3 January 2013, 01:47:05 »
I tried values from 1-20000, no difference. Is there some world time setting that I might have messed up?
Egypt Remastered!

Proof: Owner of glest@mail.com

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Strange Lag
« Reply #21 on: 3 January 2013, 17:18:20 »
I finally chased down the performance problem, has to do with calculating things related to fog of war.I have a cache for this but disabled it before 3.7.0 release due to some memory consumption concerns. I'll revisit this (when i turn on the cache i no longer see your saved game playing with lag).

Update: I re-enabled the cache and committed the changes to svn rev# 3988 and let me know what you think.
« Last Edit: 3 January 2013, 17:33:32 by softcoder »

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #22 on: 3 January 2013, 23:41:59 »
Ooo sounds good, I'll download now. :o
Egypt Remastered!

Proof: Owner of glest@mail.com

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Strange Lag
« Reply #23 on: 4 January 2013, 00:07:56 »
Much improved! There is still a tiny almost unnoticable lag, but it's much much better! The 'ok' button in the options menu works as well!
Egypt Remastered!

Proof: Owner of glest@mail.com

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Strange Lag
« Reply #24 on: 4 January 2013, 00:28:25 »
So this shows how expensive calculating fog of war is, anyway glad you confirmed its improved.