Wrapping it up

GSoC is almost over, less than a week now. Time to wrap things up and have a look at what has been done and what is still missing.

The overall goal was to bring the 3d functionality of the original Wintermute Engine to ResidualVM after the 2d parts had already been ported to ScummVM during previous GSoC events (based on Wintermute Lite instead), using OpenGL. Major steps include:

Rendering of 2d sprites using OpenGL. Also adding some of the 2d transformations supported by WME. Some functions are still not implemented although it is not clear if a 3d game is actually using them.

https://github.com/residualvm/residualvm/pull/1643

https://github.com/residualvm/residualvm/pull/1651

https://github.com/residualvm/residualvm/pull/1674

https://github.com/residualvm/residualvm/pull/1678

https://github.com/residualvm/residualvm/pull/1679

Loading of scene geometry and camera settings from a .3ds file and being able to display it for debugging purposes. A lot of the code here was taken from the original engine and adjusted where necessary. The .3ds loader was written from scratch as well as all OpenGL code.

https://github.com/residualvm/residualvm/pull/1647

Loading of models from a .X file, rendering and animating such models. In the first PR, again a lot of code was integrated from WME with minor adjustments (changing the math code or everything related to coordinate systems, for example). Most of my work consisted of the .X loader and everything mesh related like rendering and animation updates of the mesh. The first PR also contains some work related to path-finding. Again, a lot of the code was imported here but parts of it had to be changed.

https://github.com/residualvm/residualvm/pull/1649

https://github.com/residualvm/residualvm/pull/1662

https://github.com/residualvm/residualvm/pull/1663

https://github.com/residualvm/residualvm/pull/1665

https://github.com/residualvm/residualvm/pull/1666

https://github.com/residualvm/residualvm/pull/1668

https://github.com/residualvm/residualvm/pull/1670

https://github.com/residualvm/residualvm/pull/1672

https://github.com/residualvm/residualvm/pull/1676

https://github.com/residualvm/residualvm/pull/1680

https://github.com/residualvm/residualvm/pull/1681

https://github.com/residualvm/residualvm/pull/1682

https://github.com/residualvm/residualvm/pull/1683

https://github.com/residualvm/residualvm/pull/1684

https://github.com/residualvm/residualvm/pull/1686

https://github.com/residualvm/residualvm/pull/1687

https://github.com/residualvm/residualvm/pull/1688

https://github.com/residualvm/residualvm/pull/1689

Object selection and attachment of items to 3d actors.

https://github.com/residualvm/residualvm/pull/1653

Lighting and shadows. Lights are loaded from a .3ds file and set accordingly to script input. Stencil shadow volumes have been implemented and seem to be very stable. Shadow mapping, as supported by the original engine is still missing. Simple shadow textures which are displayed at the position of an actor are implemented but potentially buggy.

https://github.com/residualvm/residualvm/pull/1657

https://github.com/residualvm/residualvm/pull/1669

https://github.com/residualvm/residualvm/pull/1691

https://github.com/residualvm/residualvm/pull/1692

https://github.com/residualvm/residualvm/pull/1671

A shader based renderer has been implemented and the a 3d renderer interface was added to make the rest of the code independent of the specific renderer. Plenty of shader related stuff can be found in the above mentioned PR’s as missing function were implemented or bugs fixed only after the renderer was added.

https://github.com/residualvm/residualvm/pull/1659

Persistence for the ported 3d classes was implemented in a way that there would be compability between savefiles of ScummVM and ResidualVM.

https://github.com/residualvm/residualvm/pull/1655

Some somewhat unrelated PR’s, mainly smaller fixes and cleanup of the code.

https://github.com/residualvm/residualvm/pull/1660

https://github.com/residualvm/residualvm/pull/1661

https://github.com/residualvm/residualvm/pull/1664

https://github.com/residualvm/residualvm/pull/1667

https://github.com/residualvm/residualvm/pull/1677

https://github.com/residualvm/residualvm/pull/1690

https://github.com/residualvm/residualvm/pull/1693

https://github.com/residualvm/residualvm/pull/1697

https://github.com/residualvm/residualvm/pull/1698

https://github.com/residualvm/residualvm/pull/1699

The following PR did not go directly in ResidualVM, but first into ScummVM and was then synchronized as the fixes touched the common code between the two Wintermute ports.

https://github.com/scummvm/scummvm/pull/2345

This PR was just about integrating the existing ScummVM port into ResidualVM, so none of this code was actually written by me. It is included here for completeness sake.

https://github.com/residualvm/residualvm/pull/1644

Displayable results

The Wintermute games “Alpha Polaris” and “Mental Repair” have been successfully completed with the current port. The graphical output matches the original, at least to my current knowledge.

Known issues

Shadow mapping is used by a lot of games instead of shadow volumes and was not implemented, as mentioned above.

Sorting of rendered objects does not work correctly in some games, meaning that objects appear in the wrong order on the screen. At least in one case this seems to be related to viewport settings and 2d <-> 3d coordinate transformation. Also there seem to be issues with general 3d object transformations, leading to models being placed incorrectly on the screen or in the wrong position.

One game uses an unknown blend mode.

Viewport settings are still incomplete and don’t handle mismatches between requested dimensions by games and actual window sizes. The original has some code here which should be ported as well.

Future plans

I plan to tackle the above issues after taking a break from the code base for a few weeks and depending on how much spare time I will have available. Complete support for all Wintermute 3D games will probably be a more long term task, although I kind of like the idea of maintaining such a project.