Sphinx and the Cursed Mummy Wiki
Advertisement
EngineX

The original EngineX logo, made by Eurocom.

EngineX is the custom-built game engine created by Eurocom for Sphinx and the Cursed Mummy. The first game that released based on this technology was Buffy: Chaos Bleeds —in 2003— due to shorter development times. Eurocom reused and expanded it for all of the following projects until its eventual bankruptcy in 2012. The last in-house game using this technology was 007 Legends.

Architecture and internals[]

The engine was made to be generic and extendable from the start, completely decoupling each game's code from the reusable, common EngineX code that works as base and abstracts the underlying platform. Still, some game code was also reused to some degree and expanded between projects. For example, Buffy and Sphinx share most of the HUD code; with the main menu and memory card dialog elements being almost functionally identical.

The entire engine and game is written in a mix of self-contained data-oriented and object-oriented C++ without any external dependencies, C++ Standard Library or middleware other than any required basic platform support for input, graphics, audio, threading or C runtime. It implements its own allocator arenas and data structures like intrusive linked lists[1], RTTI or strings. It supports asynchronous file IO, a virtual hashcode-based filesystem and makes heavy use of singletons, virtual functions and composition. It sports its own stack-based gamescript bytecode interpreter.

Sphinx and EngineX are both big pieces of software. The entire codebase without external dependencies or EuroLand code is around 1,256,936 lines of actual code, not counting comments or whitespace. Much bigger than some other games at the time, and with comparatively few comments to understand what is going on. To put the numbers in context, cloc shows that Doom 3 amounts to around 593,899 lines[2].

Supported Platforms[]

The original version of the engine at the time of Sphinx supported the following platforms:

  • PlayStation 2
  • Windows (DirectX 7, internal)
  • GameCube
  • Xbox

After the THQ Nordic acquisition the original version was partially rewritten and expanded to work on the following platforms:

  • Windows (OpenGL Core / SDL2 / OpenAL Soft), Linux, macOS
  • Nintendo Switch

EngineXT[]

A more modern version of EngineX —reddubbed EngineXT— was the final incarnation used from 2005 onward. It was incrementally updated to support 7th generation consoles, as well as proper Windows support:

  • Wii
  • PlayStation 3
  • Xbox 360
  • Windows (Direct3D 9)
  • PSP
  • Wii U

Games[]

The following is a non-comprehensive list of the games that are known to use this in-house technology.

The GeoFile revision number is used to ensure that data is exported with a specific version of EuroLand that matches the current EngineX version. They need to be in sync so that the inner structures and format of the writer and reader are compatible. Debug versions of the game will politely ask to re-export the EDB file with a newer EuroLand version.

Year Title Filelist version EDB/GeoFile version Hashcodes Platforms
Shipped with game Public PS2 XB GC PC Wii PS3 X360 PSP Wii U
2003 Sphinx and the Shadow of Set Demo Disc 4 156 No
2003 Buffy the Vampire Slayer: Chaos Bleeds 5 170 No
2003 Sphinx and the Cursed Mummy 182 Yes
2004 Athens 2004 6[3] 218 Yes
7 239
2004 Spyro: A Hero's Tail 240 No
2005 Robots 248 Yes
2005 Predator: Concrete Jungle 250 No
2005 Batman Begins 251
2006 Ice Age 2: The Meltdown 252 Yes
2007 Pirates of the Caribbean: At World's End Yes
2007 9 10144 (PCNG) Yes
2008 Beijing 2008 10 190 (BJNG) No
2008 The Mummy: Tomb of the Dragon Emperor 7 253 Yes
2008 007: Quantum of Solace 255
2009 Ice Age: Dawn of the Dinosaurs 260 No
2009 G-Force 259 No Recr.
2009 Dead Space: Extraction 262 Yes
2009 Spider-Man 4 (cancelled prototype) 263 Yes
2010 GoldenEye 007 263 No
2010 Contra Evolution (vertical slice)[4] 10 256 (D2XT) Yes
2010 Vancouver 2010 239 (VACN)
2011 Rio 12 282 (T75B) No
2011 Disney Universe 13 244 (DIUN)
2011 GoldenEye 007: Reloaded 263 (BN11)
2011 DemoXT (internal) 315 (XTDM) Yes
2011 Harry Potter for Kinect 333 (POTR)
2012 007 Legends 11 335 (B11B)
2012 Dead North (cancelled prototype)[5] 335 (DNTH) Yes

EuroLand[]

Main article: EuroLand

EuroLand —sometimes stylized as Euroland— was the internal all-in-one editor used by the company, it was tightly integrated with custom Maya and 3ds Max plugins to edit maps and geometry. After Sphinx, the company started a new iteration called EuroLand 2, with a revised scene format and improved tools.

The original 2003 version of EuroLand as used to export Sphinx levels was released as part of of the Authoring Tools DLC in early 2018, together with a Redux version, recompiled and tweaked from source during the THQ Nordic port, adding PNG support as well as many other improvements. This version originally exported gamescripts incorrectly, causing several EDB levels not to load. Albeit it was later fixed in a subsequent DLC update.

After re-saving an ELF with Redux the original tool will not be able to load them due to MFC serialization differences, throwing spurious out of memory errors.

Hashcodes[]

Hashcodes are an integral part of how EngineX works. Instead of referencing objects by name or path, almost every object is tagged with an unique hexadecimal number. To make this number easier to read, they have a constant label starting with the HT_ prefix.

Euroland-hashtable-editor

The hashcode editor in EuroLand, being used to tag MC_Sphinx.elf with HT_File_Sphinx.

Both EngineX, EuroLand, and the game itself load and parse a header file called hashcodes.h, where all these special numbers are defined in order. Hashcodes can be created directly from EuroLand.

A number is always made out of a section number (the prefix) and a self-incrementing ID. Here is an example:

Every EuroLand file is tagged with a hashcode of the HT_File section. If we open Grafix/Animations/Main Player/MC_Sphinx.elf in EuroLand and click on Project to open Project Options > Hash Table we can see that it uses HT_File_Sphinx.
Once we export that file via App Targets > PC > right-click menu > Output (Optimised) the .EDB will retain the tag. An entry in Filelist.bin will map it to its exported .EDB counterpart. So when the game finds the hashcode in LevelData it will redirect it to _bin_PC/MC_Sphin.edb and the game will load it.

But not only .EDB files use hashcodes; from individual entities, textures, to animation datums, bone names or music tracks. All of them have their own unique tags (either manually-typed or generated).

And while a few of them are hardcoded to be used internally by the engine, some of them are not.

References[]

  1. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html
  2. https://fabiensanglard.net/trespasser/index.php
  3. Version 6 seems to be only used by the PS2 version. It's like version 7 but without scrambled filenames.
  4. Build reportedly dated February 10, 2010.
  5. Build reportedly dated Nov 23, 2012; the last day before the studio closure.
Advertisement