Author Topic: Silly question about leaving a game  (Read 864 times)

uncle

  • Guest
Silly question about leaving a game
« on: 19 February 2012, 21:34:10 »
What does MG do after I leave the game? Why it takes so long until I am able to use the menu again?

What happens if I just close the MG window without terminating it correctly?

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: Silly question about leaving a game
« Reply #1 on: 20 February 2012, 00:28:55 »
it closes.
WiP Game developer.
I do danish translations.
"i break stuff"

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Silly question about leaving a game
« Reply #2 on: 20 February 2012, 10:16:19 »
What does MG do after I leave the game? Why it takes so long until I am able to use the menu again?

I don't know the details, but I can try a guess:

It does garbage collection, making sure it deallocates any memory which has been in use during the last game, to allow for reallocating thi memory during its further runtime (in case you start another game). It's not just MegaGlest which needs to do stuff here. Once it deallocates memory the operating system is in charge of managing this free memory again and may do various stuff, such as move memory areas it uses itself around in an attempt to defragment RAM. Also the GPU may do similar (which depends on how the drivers manage it).

What happens if I just close the MG window without terminating it correctly?

This depends on your operating system (and you video drivers) and how well it can handle the case where an application doesn't deallocate RAM it was using. Since the operating system knows which RAM areas are in use by an application, it should be able to forcefully deallocate them when it is killing an application process and this usually works well enough. However, the applicaion does not expect to exit at this point, which could lead to data loss. For example, once MegaGlest will gather statistics on how plaers performed during a game, it will want to report them to a central server by the end of a game. If you would, however, close the game there this could result in these stats not being reported. Similarily, and already now, when a game server process is killed and thus exits out of the expected code flow, it may fail to report back to the masterserver that a game has ended, which may cause the game to be listed there as 'in process' for longer than neccessary.

The main reason the garbage collection is done is most likely to make this memory available for a new game or other data MG may need to store in RAM.
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 · · ·

uncle

  • Guest
Re: Silly question about leaving a game
« Reply #3 on: 20 February 2012, 16:31:18 »
Thank you for your answer, that's exactly what I wanted to know. :thumbup:

 

anything