Closing the game during loading games crashes

Issue: game crashes when closing game during loading animatiomn
Crash (y/n): y
Platform (Windows/Mac/Linux): windows
Description:
after clicking connect you sit thought the loading animation. If you click the x to close the game during this period the game freezes and then crashes to desktop.

MMORPG Tycoon 2
win64
0.12.28-ga206199
Checking supported resolutions…
Available Modes
0: 1600 x 900
1: 1440 x 900
2: 1366 x 768
3: 1360 x 768
4: 1280 x 800
5: 1280 x 768
6: 1280 x 720
7: 1280 x 600
8: 1152 x 864
9: 1024 x 768
10: 800 x 600
11: 640 x 480
12: 640 x 400
13: 512 x 384
14: 400 x 300
15: 320 x 240
16: 320 x 200
Initialising [1024x768] resolution…
Found 1 displays:
Display #0 Generic PnP Monitor (1600x900)

OpenGL Context:
Vendor: NVIDIA Corporation
Renderer: GeForce GT 540M/PCIe/SSE2
Version: 3.3.0 NVIDIA 372.70
Shading Language Version: 3.30 NVIDIA via Cg compiler
== Begin OpenGL limits ==
Max 3D texture size: 2048
Max array texture layers: 2048
Max clip distances: 8
Max samples in a color multisample texture: 32
Maximum atomic counters: 98304
Maximum fragment shader uniform components: 233472
Maximum geometry shader uniform components: 231424
Maximum combined texture image units: 192
Maximum combined uniform blocks: 84
Maximum cube map dimensions: 16384
Maximum samples in a multisample depth or depth-stencil texture: 32
Maximum simultaneous draw buffers: 8
Maximum simultaneous draw buffers with dual-source blending: 1
Recommended maximum number of vertex array indices: 1048576
Recommended maximum number of vertex array vertices: 1048576
Max fragment shader input components: 128
Max fragment shader uniform components: 4096
Maximum texels in the texel array of a texture buffer: 134217728
Maximum supported texture image units in a fragment shader: 32
Maximum texture size (rough estimate): 16384
Maximum uniform buffer binding points: 84
Maximum uniform block size: 65536
Maximum uniform locations: 65536
Maximum varying components: 124
Maximum floating point varying components: 124
Maximum atomic counters in vertex shaders: 16384
Maximum vertex attributes in vertex shader: 16
Maximum active shader storage blocks in a vertex shader: 16
Maximum texture image units in vertex shader: 32
Maximum uniform components in vertex shader: 4096
Maximum output components in vertex shader: 128
Maximum uniform blocks per vertex shader: 14
Maximum simultaneous viewports: 16
Maximum MSAA samples: 32
NVidia-only: Currently available video memory: 2040584
ATI-only: Currently available video memory: 2040584
== End OpenGL limits ==
VSync: ENABLED
TextureUnits: 32 from vertex shader, 192 total
Screen Ratio: 1.333333
– Initialising game "MMORPG"
TextInput was enabled by default; turning it off until we need it!
No joystick found. Using keyboard input.
Shown
Exposed
Event 0: Path event:/UI/window close end: min range 0.000000: max range 0.000000
Event 1: Path event:/UI/button slot deselect: min range 0.000000: max range 0.000000
Event 2: Path event:/UI/button slot desocket: min range 0.000000: max range 0.000000
Event 3: Path event:/old/general click: min range 0.000000: max range 0.000000
Event 4: Path event:/UI/general cancel: min range 0.000000: max range 0.000000
Event 5: Path event:/Title screens/loading screen world appear: min range 0.000000: max range 0.000000
Event 6: Path event:/UI/window open start: min range 0.000000: max range 0.000000
Event 7: Path event:/UI/button slot socket: min range 0.000000: max range 0.000000
Event 8: Path event:/Title screens/loading screen whoosh 01: min range 20.000000: max range 300.000000
Event 9: Path event:/Title screens/loading screen whoosh 02: min range 16.000000: max range 65.000000
Event 10: Path event:/Title screens/loading screen launch: min range 0.000000: max range 0.000000
Event 11: Path event:/UI/general notification: min range 0.000000: max range 0.000000
Event 12: Path event:/Title screens/loading screen white flash: min range 0.000000: max range 0.000000
Event 13: Path event:/UI/button click: min range 0.000000: max range 0.000000
Event 14: Path event:/UI/window close start: min range 0.000000: max range 0.000000
Event 15: Path event:/old/button release toggle on: min range 0.000000: max range 0.000000
Event 16: Path event:/UI/window open end: min range 0.000000: max range 0.000000
Event 17: Path event:/UI/window looping: min range 0.000000: max range 0.000000
Event 18: Path event:/Title screens/loading screen loop: min range 0.000000: max range 0.000000
Event 19: Path event:/UI/button click up new field: min range 0.000000: max range 0.000000
Bus 0: Path ‘bus:/UI/UI_UnD’: Volume: 1.000000
Bus 1: Path ‘bus:/UI’: Volume: 1.000000
Bus 2: Path ‘bus:/UI/UI_d1’: Volume: 1.000000
Bus 3: Path ‘bus:/UI/UI_d2’: Volume: 1.000000
Bus 4: Path ‘bus:/Reverb’: Volume: 1.000000
Bus 5: Path ‘bus:/’: Volume: 1.000000
Param 0: dramaticMIX [0.00-1.00] (default 0.00)
Rebuild front plate mesh
Rebuild front plate mesh
Sending crash report.
Sending crash report.
Platform: win64
Version: 0.12.28-ga206199
Rpt: -------------------

Error occurred on Tuesday, September 20, 2016 at 08:40:28.

MT2.exe caused an Access Violation at location 00000000006A6933 in module MT2.exe Reading from location 0000000000000010.

AddrPC Params
00000000006A6933 0000000000000000 0000000200000000 0000000000000230 MT2.exe!Size [/tmp/build/9ecbd07c/code/vectorstorm/VS/Graphics/VS_Font.cpp @ 385]
00000000006A920C 00000000241331F8 0000000000000000 000000004206DA60 MT2.exe!CreateString_InDisplayList [/tmp/build/9ecbd07c/code/vectorstorm/VS/Graphics/VS_FontRenderer.cpp @ 263]
00000000006A99E0 0000000024133018 0000000024133048 00000000241331C8 MT2.exe!DisplayList2D [/tmp/build/9ecbd07c/code/vectorstorm/VS/Graphics/VS_FontRenderer.cpp @ 329]
0000000000654E06 0000000000000020 0000000000AED9C0 0000000014FBFE20 MT2.exe!mmoScreen::SetTitle
000000000064A5D2 0000000014FBFE40 00000000120F4B10 0000000014FBFE20 MT2.exe!mmoBusiness::mmoBusiness
00000000004A0535 00000000120FAFE8 0000000000000000 0000000000000000 MT2.exe!mmoGameState::Finish
0000000000571FB5 0000000000000000 0000000000000000 0000000000000000 MT2.exe!mmoModeInGame::DoInit
00000000005AB91E 0000000000000000 0000000000000000 0000000000000000 MT2.exe!mmoTaskWorkerThread::Run
00000000006F948A 0000000000000000 0000000000000000 0000000000000000 MT2.exe!DoStartThread [/tmp/build/9ecbd07c/code/vectorstorm/VS/Threads/VS_Task.cpp @ 25]
00007FFFE3D38644 0000000000000000 0000000000000000 0000000000000000 KERNEL32.DLL!BaseThreadInitThunk
00007FFFE4A66141 0000000000000000 0000000000000000 0000000000000000 ntdll.dll!RtlUserThreadStart

MT2.exe
ntdll.dll 6.2.14926.1000
KERNEL32.DLL 6.2.14926.1000
KERNELBASE.dll 6.2.14926.1000
msvcrt.dll 7.0.14926.1000
SHELL32.dll 6.2.14926.1000
libcurl-4.dll
ADVAPI32.dll 6.2.14926.1000
sechost.dll 6.2.14926.1000
cfgmgr32.dll 6.2.14926.1000
OPENGL32.dll 6.2.14926.1000
RPCRT4.dll 6.2.14926.1000
windows.storage.dll 6.2.14926.1000
USER32.dll 6.2.14926.1000
WLDAP32.dll 6.2.14926.1000
combase.dll 6.2.14926.1000
win32u.dll 6.2.14926.1000
ucrtbase.dll 6.2.14926.1000
GDI32.dll 6.2.14926.1000
bcryptPrimitives.dll 6.2.14926.1000
WS2_32.dll 6.2.14926.1000
gdi32full.dll 6.2.14926.1000
shlwapi.dll 6.2.14926.1000
kernel.appcore.dll 6.2.14926.1000
GLU32.dll 6.2.14926.1000
shcore.dll 6.2.14926.1000
powrprof.dll 6.2.14926.1000
profapi.dll 6.2.14926.1000
exchndl.dll 0.8.1.0
WSOCK32.dll 6.2.14926.1000
PSAPI.DLL 6.2.14926.1000
libphysfs.dll
SDL2_image.dll 2.0.0.0
SDL2.dll 2.0.3.0
mgwhelp.dll 0.8.1.0
fmodstudio64.dll 0.1.8.4
IMM32.dll 6.2.14926.1000
VERSION.dll 6.2.14926.1000
ole32.dll 6.2.14926.1000
libpng16.dll
OLEAUT32.dll 6.2.14926.1000
dbghelp.dll 6.3.9600.17298
msvcp_win.dll 6.2.14926.1000
fmod64.dll 0.1.8.4
WINMM.dll 6.2.14926.1000
MSACM32.dll 6.2.14926.1000
WINMMBASE.dll 6.2.14926.1000
steamclient64.dll 3.60.97.73
CRYPT32.dll 6.2.14926.1000
MSASN1.dll 6.2.14926.1000
imagehlp.dll 6.2.14926.1000
IPHLPAPI.DLL 6.2.14926.1000
SETUPAPI.dll 6.2.14926.1000
Secur32.dll 6.2.14926.1000
vstdlib_s64.dll 3.60.97.73
tier0_s64.dll 3.60.97.73
SSPICLI.DLL 6.2.14926.1000
CRYPTBASE.DLL 6.2.14926.1000
gameoverlayrenderer64.dll 3.60.97.73
userenv.dll 6.2.14926.1000
uxtheme.dll 6.2.14926.1000
ltc_help64-115528.dll 1.0.0.1
WINTRUST.dll 6.2.14926.1000
dwmapi.dll 6.2.14926.1000
clbcatq.dll 2001.12.10941.16384
dinput8.dll 6.2.14926.1000
HID.DLL 6.2.14926.1000
DEVOBJ.dll 6.2.14926.1000
XInput1_4.dll 6.2.14926.1000
MSCTF.dll 6.2.14926.1000
nvoglshim64.dll 21.21.13.7270
nvoglv64.DLL 21.21.13.7270
WTSAPI32.dll 6.2.14926.1000
ntmarta.dll 6.2.14926.1000
WINSTA.dll 6.2.14926.1000
MMDevApi.dll 6.2.14926.1000
PROPSYS.dll 7.0.14926.1000
wdmaud.drv 6.2.14926.1000
AVRT.dll 6.2.14926.1000
ksuser.dll 6.2.14926.1000
AUDIOSES.DLL 6.2.14926.1000
wintypes.dll 6.2.14926.1000
msacm32.drv 6.2.14926.1000
midimap.dll 6.2.14926.1000
dxgi.dll 6.2.14926.1000
d3d11.dll 6.2.14926.1000
nvumdshimx.dll 21.21.13.7270
nvinitx.dll 21.21.13.7270
detoured.dll 2.1.0.207
nvd3d9wrapx.dll 21.21.13.7270
nvdxgiwrapx.dll 21.21.13.7270
nvwgf2umx.dll 21.21.13.7270
bcrypt.dll 6.2.14926.1000
nvspcap64.dll 2.11.4.0
WINHTTP.dll 6.2.14926.1000
nvapi64.dll 21.21.13.7270
CRYPTSP.dll 6.2.14926.1000
rsaenh.dll 6.2.14926.1000
gpapi.dll 6.2.14926.1000
cryptnet.dll 6.2.14926.1000
WINNSI.DLL 6.2.14926.1000
NSI.dll 6.2.14926.1000
ltc_game64-115528.dll 1.0.0.1
WININET.dll 11.0.14926.1000
iertutil.dll 11.0.14926.1000
ondemandconnroutehelper.dll 6.2.14926.1000
mswsock.dll 6.2.14926.1000
DNSAPI.dll 6.2.14926.1000
urlmon.dll 11.0.14926.1000
mdnsNSP.dll 3.1.0.1
rasadhlp.dll 6.2.14926.1000
fwpuclnt.dll 6.2.14926.1000

Windows 6.2.9200
DrMingw 0.8.1

Clearing crash data.

Frames rendered: 8143

Average FPS: 58.107010

Frames missed: 0

My experience has been that there are different things that can happen if you close the game in the middle of the loading screen. Sometimes it works, sometimes it crashes; it all seems to depend on exactly what is going on at the time that you close the game.

With that said, it should never actually crash, and this needs to be fixed. This is really just a note to me (or anyone who’s interested), that this probably won’t be a 100% repro bug; try it at different points during the load until you find a time at which it does cause the crash; the crash absolutely is a problem.

I believe this has been fixed (ages back; I just forgot to mark it as fixed). Certainly I can’t seem to reproduce it any more!

If anybody gets a crash by closing the game during a load, please post here or otherwise let me know!

Hitting esc immediatly after creating a new mmo causes a hang but the game recovers and continues to load. Closing the game during load causes a hang for a few moments but game closes without error

Right now the game can’t actually quit while it’s in the middle of parsing the save file, so everything freezes up until that finishes. Depending on the size of your save file (and speed of your CPU), that can be anything from about 1 second to about 5 seconds.

Ordinarily we draw the animated loading screen during that time (and during the stuff that happens later during the loading process), but if you’ve told the game to close, we stop everything until that part of the load finishes, and then exit. Everything after that initial save game parsing supports exiting in the middle.

If I switch the save file format to be a binary file instead of a text one, that should load a lot faster. Or alternately, I might try switching to a high-quality parser, instead of my dodgy hand-coded one.

For the tech-heads out there, MMORPG Tycoon 2’s save files are using precisely the lexer and parser that are in VectorStorm’s Github repository right now, primarily in VS_Record.cpp and VS_Token.cpp. I have an alternate parser built which was created using GNU Bison, which theoretically ought to be a lot faster. But I haven’t actually integrated it into the VectorStorm library yet or tested its speed. Alternately, a binary format should be even faster (and much smaller!) than that, but would mean that you couldn’t go into your save file with a text editor to mess with it. Or would make that harder, anyway.