REGoth-project / REGoth

OpenSource-Reimplementation of the zEngine, used by the game "Gothic"
GNU General Public License v3.0
631 stars 62 forks source link

disabled some VM warnings #259

Closed markusobi closed 7 years ago

markusobi commented 7 years ago

Reduced log warning spam to improve performance on windows.

Kukunin commented 7 years ago

I suggest instead of commenting out log calls, organize them. We don't want to have a lot of output on Release builds to avoid slowness. So we want to output only errors and probably warnings. If there are a lot of warnings - we should fix them or move to info. In this particular place, if that's ok to not find NPC (if I got the logic right), we should log at most LogInfo, which can be helpful on Debug builds.

ataulien commented 7 years ago

I've implemented a Log-System at work which may can come in handy here. This system is based around giving your log-calls a type and a severity, like this (C-code):

Log_Write(LOGTYPE_POWERDRIVER, LOGLEVEL_LOW, "Warning: Temperature too high!");

That way, you can choose at runtime (or compile time), which messages you want to see, and how much of them, which I always found quite nice.

markusobi commented 7 years ago

If there are a lot of warnings - we should fix them or move to info.

This a complex topics. Many VM errors/warnings were there, because we had so many bugs in our VM. Now most of the warnings left are because of the shitty gothic compiler, which creates buggy Byte-code. There is no easy/quick fix for this. (The Bytecode does not pop unused expressions from stack. It also does not push the default return value on the stack (0) it leaves the stack empty instead). Some of the warnings might still indicate to issues in the VM.

It would be best to be able to toggle the warnings/errors at runtime (like @degenerated1123 suggested) and distribute the Release version with those disabled. This way the user can toggle on warnings/errors if he is able to reproduce the bug.