Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#449 closed defect (fixed)

Crash when starting a new game

Reported by: Erik Johansson Owned by:
Priority: Should Have Milestone: Pre-Alpha 1
Component: Core engine Keywords: crash, bug
Cc: Jan Wassenberg, philip Patch:

Description

When starting a new game Pyrogenesis crashes. It seems to be loading the map and all as I get ~ a second before the game crashes when I can see the game, and hear the music, it's at most a second though as the game crashes almost immediately and the music start to repeat the first < second or so. See below for call stack + output from VC++

Call stack:

 	wrap_oal.dll!0b641d5a() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for wrap_oal.dll]	
 	winmm.dll!76b454e3() 	
 	winmm.dll!76b5adfe() 	
 	winmm.dll!76b5aee9() 	
 	winmm.dll!76b5af02() 	
 	kernel32.dll!7c80b729() 	
>	pyrogenesis_dbg.exe!CreateDirectories(const boost::filesystem::basic_path<std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >,boost::filesystem::wpath_traits> & path={...}, unsigned int mode=0)  Line 116 + 0x13 bytes	C++

Output from VC++:

TIMER| common/global.xml: 17.62 ms
GAME STARTED, ALL INIT COMPLETE
First-chance exception at 0x0b641d5a in pyrogenesis_dbg.exe: 0xC0000094: Integer division by zero.
Unhandled exception at 0x0b641d5a in pyrogenesis_dbg.exe: 0xC0000094: Integer division by zero.
The program '[116860] pyrogenesis_dbg.exe: Native' has exited with code 0 (0x0).

Please tell me if there's anything else you want to know. I've attached my system_info.txt.

Attachments (1)

system_info.txt (4.9 KB ) - added by Erik Johansson 14 years ago.

Download all attachments as: .zip

Change History (16)

by Erik Johansson, 14 years ago

Attachment: system_info.txt added

comment:1 by Jan Wassenberg, 14 years ago

hm, this definitely looks to be sound-related (wrap_oal is part of OpenAL, and winmm also contains sound stuff). However, I don't like seeing CreateDirectories on the call stack. It's probably a mistake, but could you please run with -quickstart (which should hide this issue) to ensure it really is due to sound?

There has recently been another report of divide-by-zero on the forum: http://www.wildfiregames.com/forum/index.php?showtopic=12634 (no resolution yet).

It might not help, but have you tried updating your sound driver or switching to a "real" sound card, if you have one available? Other things we can try are updating the wrap_oal itself (I remember reading about a bug on the openal-dev list) and auditing our code to ensure that all source fields are set, but I'll not have time today and this weekend will be pretty hectic.

comment:2 by Philip Taylor, 14 years ago

Would using the symbol server help make the stack less bogus? Presumably doesn't help with symbols for wrap_oal.dll, though.

comment:3 by Erik Johansson, 14 years ago

Is there a way to run with -quickstart in VC++? To get the call stack I mean. I did run with -quickstart earlier and it worked, so it should work this time as well, but it would be good to be sure.

And I don't have a "real" sound card, so that could explain some of the problem. I do think I've been able to run 0 A.D. on this computer before though, so I'm not sure whether that's the main issue.

comment:4 by Philip Taylor, 14 years ago

Find "pyrogenesis" in the project explorer list on the left of the screen, right-click, "properties", "debugging", "command-line arguments", if I remember correctly.

comment:5 by Erik Johansson, 14 years ago

You do remember correctly. And the game run fine, played for some minutes and no crashes or so.

There was an error:

scripts/entity_functions.js(2245): ReferenceError: getActiveGui is not defined
ERROR: JavaScript Error (scripts/entity_functions.js, line 2245): ReferenceError: getActiveGui is not defined

But not only am I sure it's unrelated, I do also guess it was due to me clicking on a "create new unit" button when I was at the population limit (i.e. I hadn't built enough houses). At least it happened at the time I did that.

comment:6 by Philip Taylor, 14 years ago

The getActiveGui thing is unrelated; should be fixed in r7277 (untested).

comment:7 by Erik Johansson, 14 years ago

A question: Is sound in the menu handled differently from in-game? Since it works fine there I mean. I guess it doesn't need to work the same way as it's just the music (at least for now), but it'd still be nice to know :)

comment:8 by Jan Wassenberg, 14 years ago

There are slight differences between (menu) music and sounds - whether the source has the "listener relative" attribute, and also the lack of distance attenuation. At a guess, this is probably another issue along the lines of: we're not resetting a particular bit of state before reusing the source, and some OpenAL implementations don't like that.

Interestingly, I am now seeing (this|a similar) crash after upgrading to the most recent OpenAL version. That'll hopefully help track it down.

comment:9 by Jan Wassenberg, 14 years ago

Still investigating, but out of time for today. Interestingly, commenting out the line that sets AL_LOOPING causes a null-pointer dereference inside wrap_oal. Maybe we are better off using OpenALsoft on Windows, or at least providing the option?

comment:10 by Philip Taylor, 14 years ago

Providing options means more code paths to test and to contain bugs, so I'd prefer to avoid options unless they're really useful.

In this case, if OpenAL Soft works decently on Windows then it might be best to always use that: it avoids the variability of vendor-provided OpenAL driver implementations and versions (which appear to be causing us problems here), and it doesn't lose any really useful features (I assume the difference is just the lack of hardware acceleration and EAX effects, but CPUs are fast and nobody has Creative sound cards anyway so it doesn't matter).

comment:11 by Jan Wassenberg, 14 years ago

I agree that it's best to use only one codepath if possible. Since Linux users are apparently happy with OpenALSoft (I think the problems reported thus far all had to do with the PulseAudio backend), it's likely we can use that on Windows, too. However, I'll need to try it out; no telling when that can happen (this week is very full again).

BTW, concerning "nobody has Creative sound cards" - I checked the Steam hardware survey and was surprised, only ~4% are Creative. That really is surprisingly low among gamers - however, 1/3 of the cards are unreported/unknown for some reason, not sure how that is to be interpreted.

comment:12 by Philip Taylor, 14 years ago

Yeah, the Linux problems were with PulseAudio and should be fixed in a future version of Ubuntu (which seems to be where most PA users come from). Lots of Linux games use OpenAL so these problems will get noticed and eventually fixed without us having to do anything.

I didn't have any good data about Creative market share, I was just making that up based on not seeing why anybody would want an external sound card (particularly with all the stuff about Vista removing DirectSound 3D hardware support) and not personally knowing anyone with one. Other than the Steam survey, the only data I can find is that Creative says "Sales of audio products, which consist of Sound Blaster audio cards and chipsets, [...] represented 13% of sales in fiscal years 2008 and 2007." and total sales in 2008 were $737M so that's about $100M of audio products, and if they're all cheap $50 sound cards (a totally bogus assumption) and that's all counted as sales then that's 2M unit sales per year, which out of many tens (hundreds?) of millions of PC gamers is not a huge percentage. So I think I deduce that I don't have any good data, but it's a long way from the market dominance of the 90s, probably :-)

And, anyway, even if lots of people had advanced audio hardware, we don't want to use fancy effects (because they'd take effort and are unnecessary and it's better to work on things that all players will experience) so software mixing seems just as good (if it works).

comment:13 by Jan Wassenberg, 14 years ago

Resolution: fixed
Status: newclosed

Nice, a bit of deduction :)

Fortunately (but unsurprisingly, since it's used on Linux already), OpenALSoft appears to work fine. I've downloaded the binary distribution and renamed soft_oal.dll to OpenAL32.dll (as recommended by its developer - this is to override any system-provided OpenAL32). Since I was able to duplicate the crash and this fixes it, the ticket will be closed - but please feel free to reopen if you still see this or other issues.

comment:14 by (none), 14 years ago

Milestone: Unclassified

Milestone Unclassified deleted

comment:15 by historic_bruno, 12 years ago

Milestone: Pre-Alpha 1
Note: See TracTickets for help on using tickets.