Based on request, this thread has been posted to provide the community with WiC game engine's limitations, based on MW Mod's encounters during coding and mod creation efforts. Other modders or would-be modders interested in working with WiC may find this thread helpful (though there aren't that many mods anymore for WiC); you may also post your own findings or questions here.
THIS LIST IS NOT COMPLETED AT THIS TIME. WE'LL CONTINUE UPDATING THIS POST WITH ADDITIONAL DETAILS SOON.
Game Performance and Stability Issues
- Freezes in mid-game. Freezing of game with 100% CPU load (or single core CPU maxed out) can generally be attributed to the most three common causes:
- Commander AI (CAI) analysis bug: The Commander AI provides artificial intelligence for bot players. CAI runs numerous analytic tasks behind the scenes that are NOT moddable (hard coded in wic.exe). When CAI encounters conditions that are unrecoverable (we'll identify some below), it will go into uncontrollable infinite loop, causing the game to freeze with 100% CPU load.
- EX3D Video Performance Instability: This is rare, and is more likely to be attributed to your video card. Try updating your graphics driver, and ofcourse, do consider optimizing your mod's graphical effects.
- Python Scripting Error: If you use lot of python scripting (as in case with MW Mod in particular), ensure that your code is sane and doesn't do a lot of crazy things. The entire python script is often evaluated per frame, meaning, out of control loops and such can either bring down your game's frame rate to unacceptable levels, or cause stability problems or both. Be especially careful to design your python script to do proper multi-tasking (i.e. a form of preemptive multitasking such as event polling, or simply polling for object data using MVC style approach), if you are writing a complex script to process multiple things at once (i.e. targeting and guiding missiles to several targets simultaneously).
- Crash to Desktop: Some common crash to desktop issues can be clued by looking at debug log output (start wic.exe with '-debug -dev' switches). Most CTD's resulting from unhandled exceptions however do not produce sensible log output, so you'll have to spend a good deal of time in debugging. Here are some common causes to game crashes from MW Mod development:
- Python Illegal Memory/Resource Access: WiC's cPython API allows python coders to access numerous game functions (known as EXGame) that are running in C/C++ code within the game engine itself. Python API allows you to change numerous variables, including host unit's location, speed, etc. Attempting to change objects through your python function that belong to virtual memory space which has not yet been mapped to you, will cause a Page Fault (segmentation fault) and instantly crash the game to desktop, without providing a reason in the debug log.
- The most common cPython segmentation fault errors can be produced by the following examples: (1) issuing self.Host.Stop() function while inside Python Shooter object can cause segmentation fault -- this can occur when unit's ice object for shooting a hostile is acquiring a target and game is expecting a status return; abruptly calling Stop() during target acquisition process will cause page fault and crash the game. (2) Attempting to write chat message, access an Agent (including any unit variables) during python's __init__ built-in routine will cause a very obvious page fault and instantly crash the game.
- EX3D MRender32 Errors: If you're getting MRender errors, there is an issue with your model/artwork. Most MRender errors are recoverable, but also depends on your graphics driver's reaction to handling the problem. Some MRender bugs will crash the game instantly. Your mileage may vary. If you catch any MRender errors in debug log, even if the game behaves fine, I strongly suggest you re-create your .MRB files until the error goes away.
- Performance Optimizations: You should aim to achieve minimum of 45 frames per second during most game scenes (with exception of sudden intensive battle moments). Pay close attention to Radius and Remove Distance values on your customized particle effects. You do NOT need to have Remove Distance set to something ridiculous long -- not every details need to be rendered at long distance.
- By default, WiC's built-in EX3D engine will automatically hide rendering of objects at longer distances, based on their LOD or object sizes. You can further optimize this logic by editing juice/globaltweakparams.juice.
- If you are creating a very detailed model, try to stay within 15,000 polygons where possible. If exceeding 15k polygons, you should use careful planning of Detail layer in your 3D model so that lot of polygon-heavy objects can be hidden when viewed at a distance, while becoming fully visible at close-up range.
- Simulating modern firepower is extremely resource demanding task. FLINT Missile Simulator is one big challenge in this regards. You will have to set a fine balance between having a massive WW2 style war game with lot of units fielded, vs. lighter and more intense and detailed combat that portrays modern firepower. Combining both is a great way to crash or freeze your game.
- The game is limited to maximum of 512 units in EX3D World space. This includes every men in your infantry squads. Don't exceed this number; doing so will cause instability issues (but when things go well, game will just stop spawning new units). FLINT missile system particularly makes this a potentially challenging issue, as every flying missile or object is a unit.
Edited by: blahdy