Sphinx and the Cursed Mummy Wiki
Advertisement

Override the default configuration that is stored in the Registry[]

By creating an Eland.ini file in the same folder as the EuroLand .exe file users can override existing functionality, like the default location of the Euroland project file (Sphinx.elp). Both relative (to the working directory) and absolute paths can be used.

Macro-events that get triggered when starting the program or during other actions can also be overridden. The valid event keys are listed as follows:

[ProgDefaults]
// swy: override the default ELP file path
UseELP=..\..\..\..\..\ServerX\Sphinx\Project\Sphinx.elp

// swy: override the macro-events config, set your own .elm files
//      here to be launched when certain things happen.
//      (if any valid macro event path exists, then signal the app to
//       use the overrides instead of the user settings)
MEV_Start=
MEV_NewDoc=
MEV_OpenDoc=..\..\..\..\..\ServerX\Sphinx\Project\Macros\opendoc2.elm
MEV_SaveDoc=
MEV_CloseDoc=
MEV_End=
MEV_Internal=

View the Eurocom Macro Scripting Language documentation[]

Euroland-macro-help

The macro documentation window.

Euroland automatically generates a documentation window with all the available functions that can be used to create macro files to automate certain repetitive tasks.

Open Euroland without opening any file to show the mainframe menu bar, and click on Tools > New auto. Now the macro text editor will show up and the contextual menu bar will change again. You can now open the window with Help > Documentation...

The program regenerates the HTML help categories for every supported function in the current version. It also comes with a syntax primer. Really useful, even for those who want to know how Euroland works internally.

Jump to a specific position using Bug coordinates[]

Euroland-debug-marker-bug-coordinates

The debug coordinate marker, as it appears.

The menu option Bug coordinates (Utilities > Bug coordinates... in the script editor, Edit > Bug coordinates... in the map editor) can be used to move the viewport to a specific coordinate in 3D space, it is called like that because they used it to paste these numbers from their internal bugtracker (called Eurobrats). The coordinate format is three floating point numbers separated by spaces, tabs or commas. Like this: 1000, 0.6, 0.

The four splitter viewports will immediately be centered around that position after pressing OK and a debug marker will appear. Generally, the only way to remove the marker is restarting the program, the camera will remain in that position if the file is saved.

Change the amount of memory used by the game[]

Sphinx-debug-resource-view-window

Search for the 00 00 80 00 00 00 80 02 hex pattern, that pattern should come up right after the SPeeDRuNSaReFuN block in the game's binary. So it should be easy to find.

There are two internal memory heap sizes: 0x00800000 is the small one (2 MiB) and 0x02800000 the large one (40 MiB). The values are in Little Endian, you can change them by editing the .exe with any hex editor, as long as you stay within the 32-bit limit, which is around 2 GiB. Make a backup of the original binary, just in case.

This tweak is especially useful for testing bigger or unoptimized levels without running out of memory or having to abide by the original limitations. To confirm that the tweak works, launch the game in -dev mode and right-click anywhere to pop up the developer menu, select Debug > Resources. You can pop up the menu bar by right-clicking in the window title once.

Select between Heap 0 (default heap) or Heap 1 (large data heap, this is where the EDB files get loaded) and pay attention to the Heap Size label at the left, or view the visual representation of the free blocks in red. You can hover with your cursor over the allocated memory blocks, highlighting them in yellow.

If you select loaded EDB files, they will display their filename and hashcode in the left side. It's a neat way of viewing their relative sizes and what needs optimizing.

The Resource view also has some useful keyboard shortcuts. You can toggle this window with Ctrl + R, as well as switching between modes using the numeric pad: Pressing 1, 2, 3 and 4 will increase the zoom/diagram detail/block size. You can switch between the Default and the Large Data heaps by pressing 7 and 8.

Hidden mode in the text formatter that shows icons[]

The monster capture code uses plain objectives to set the icon in the HT_Text_MonsterCaptured popup, there's a dynamic code tag type in the text formatter component which was made just for this: <DC 1 0 1>. I don't remember if this is documented anywhere.

The valid objectives are tagged from HT_Objective_TextVar0 to HT_Objective_TextVar9.

The first argument is the type; only 1 is valid, to insert icon images. The other two parameters set the variable offset to retrieve the icon hash and the file hash, respectively, so the 0 in the second parameter means HT_Objective_TextVar0, and the 1 in the third parameter means HT_Objective_TextVar1.

You can set those objective values before printing a message to the correct hashcodes and the text printing function will put some icons in there.

Another interesting thing is that there are two extra hidden parameters, left unused. By default it sets the icon size to 22px, but you can override that with a tentative fourth and fifth parameter. Super neat.

Replace the original by <DC 1 0 1 300 500> and see what happens.

Tools programmer test function[]

There is a pseudo-hidden Extra Development command in the various Euroland sub-editors.

  • The one in the map editor does nothing.
  • The one in the entity editor is called Radiosity Test for good reasons; it will automagically add global illumination and indirect color bleeding to the current entity's vertex colors.
  • The one in the animation editor dumps a c:\weights.txt file with the vertex bone weights for the current animation (well, skin).
  • The one in the script editor does nothing.

Cool little secret. It appears in the global hotkey list as Tools programmer test function, you can also find it here.


Merging polygons[]

For optimization reasons, sometimes is needed to merge polygons. EuroLand gives you some tools to do this. To do it manually you can use the tool called Merge, located in the polygon section in the entity editor:

Merge tool

To use it you only have to select the polygons that you want to merge and click the button, or you can also use the hotkey (shift + z).

Sometimes, is not possible to merge polygons, in this case, first you have to weld points. There's a tool that do this, is located in the tools section, by default the button is disabled, you have to select the points that you want to weld to enable it. Once the points been welded you will be able to merge the polygons.

Blend per-layer vertex colors together[]

There is a not very well known operator in the entity editor. It can be accessed from the Face Layers menu > Blend layers...

«Blend RGB»
This function does weighted blending/averaging by taking the opaqueness factor into account, by premultiplying by alpha before summing each channel, and then dividing the sum of premultiplied RGB components by the sum of alpha channels. It overwrites the RGB channels of each of the target layers with the same RGB value and marks it as intentionally painted on, if any. If any of the channels doesn't have a proper RGB layer it gets ignored and the summed divisor takes that into account automatically. It ends up working out.
Essentially, the more opaque a vertex color layer is, the more it counts in the final mixture. For this operator, blends are computed per-vertex.
«Copy RGB»
It just averages RGB colors without taking the alpha into account (sums everything and divides by the count). Other than that, same as before. Only RGB channels are ever written.
«Copy Alpha»
Just averages the source channels' alpha and copies the same value into the target layer (or layers). Only the A channel is written/updated. RGB components are ignored. Sum all the source alphas and divide them by the source layer count. That's your result.
Note: It uses integer division with an extra +0.5, to compensate the rounding down a bit and make it correct.


Resource view[]

In the sounds mode there are three possible letters for the listed sounds: ATL; the initials stand for Active, Tracking, Looping. Respectively.

The Items mode of the Resource view is stubbed and doesn't work. There's a separate Item Update view under DebugWnd.


How to combine scripts with map timer and counter triggers[]

In our script, we need to add a Run Control command: EuroLand-ScriptsEditor

In the options, we will ensure that the option Trigger is checked:

EuroLand-RunControlCommandProps

This command will be the section that will loop until the trigger doesn’t receive a “Close” message from another trigger.

The script that we can see in this screenshot will do the follow:

  1. At the start the script is waiting for a hit, can be from the player or form an enemy
  2. Will “activate” the links that this trigger has in the references section, sending the messages that has in the reference’s values.
  3. Will start looping until doesn’t receive a “Close” message.
  4. At the end, the script will return to the start, waiting for a hit again.

At the map, we will create two triggers:

Trigger Timer: This one will have specified the time that the object will be waiting/looping.

In this case, we will check the flag Loop to reset the counter after it’s counted down.

EuroLand-TriggerPropertiesValues

In the references section we will have a link to all objects that has the script that we have created, and we will also add a link to the counter trigger:

EuroLand-TriggerPropertiesReferences

In the references values section we will set these messages:

EuroLand-TriggerPropertiesReferencesValues

The Close message to break the script and make it go to the start again, and the ZeroCounter message to reset the trigger counter when the delay ticks has been completed.

Trigger Counter: That will keep the track of how many objects has been hit, in the references tab, we can link the door that will be opened or something else.

EuroLand-TriggerCounterPropertiesValues

In the trigger object that use our script, we will add a link to these two triggers in the references tab:

EuroLand-TriggerObjectReferences

In the References Values tab we will set Activate for the trigger timer and Open for the trigger counter:

EuroLand-TriggerObjectReferencesValues

Here you can see this mechanic in action in a level of the Shadow of Set PC mod.

https://youtu.be/ZAtagdjHSCc?t=172


Hardcoded text sections as used in Sphinx for memcard/savedata text[]

Some text sections should not be used for levels as part of the Text Section column in LevelData.xls because they are conditionally loaded depending on the platform and are used for the memory card dialogs. Skip these and use from HT_TextSection64 onward or it may cause incompatibilities and problems.

HT_MemCardTextSectionPC HT_TextSection60
HT_MemCardTextSectionPS2 HT_TextSection61
HT_MemCardTextSectionXB HT_TextSection62
HT_MemCardTextSectionGC HT_TextSection63


Additionally, when loading a level, these text sections are always resident in memory, no matter what.

Default, all-levels text HT_TextSection01
Lenny's text HT_TextSection02
Martin's text HT_TextSection03
John's text HT_TextSection04
Static game text (disabled in the final version) HT_TextSection05
Stuart's text HT_TextSection06
Andy's text HT_TextSection07


All the other HT_TextSection_* hashes can be freely used for text in a level, until HT_TextSection255.

Change the 2D impostor fade-out distance from a submap portal, set skyboxes, reverb and fog[]

I finally found a few mysterious EuroLand secrets that I wanted to unravel. Had to read the source code to find these menus. Darn, it was hard.[1]

Euroland-portal-screenshot-a

Turns out that the fade-out distance for portals (internally known as 'depth') is encoded in the Z-Order field of the portal faces, this is a special case of reusing a thing that is already there for something unrelated. This functionality is normally used to sort the translucent triangles manually by priority to avoid visual glitches. For example, the skybox clouds should always be rendered behind any other translucent object (i.e. a waterfall or window glass). Ideally everything translucent should be sorted every frame and drawn back to front using the painter's algorithm, but doing it in the editor by the scener was cheaper, performance-wise, for old games.

Euroland-portal-screenshot-b

Also, portals are just normal polygon faces marked with a special flag. You can change the flags of any polygon from the Entity Editor > 'Eurocom' menu mode > 'Flags' modal dialog.

Euroland-portal-screenshot-c

That's how water or the special blue collision cards are marked. This is really important.

Another thing I have just found out that had me scratching my head for months is how to setup map-specific zone settings. There are things like fog/ambient light, audio reverb zones, and skyboxes that constantly get cycled or reconfigured but they seemingly don't have a menu or EuroLand entry of any sort.

Euroland-portal-screenshot-d

Well, they seem to be using something called 'Identifiers', and this is what caught me off guard: they also work like Entity flags, even if they are part of a map they don't get configured in the map itself.

Euroland-portal-screenshot-e

The fog values and reverb are set in things like the portal polygons themselves and switched every time you enter a new zone.

Same thing for the skies, when you go through a curved underwater passage the sky gets disabled. When you reach the other end a new sky is put in place.

Probably the most noticeable reverb in the game. Here's the portal that makes it work. (Reverb: 40)

Euroland-portal-screenshot-f
Euroland-portal-screenshot-g

And this is what happens when you remove the 'Portal' flag from the blue thingie, it shows the 2D impostor that kicks in when Sphinx is far away.

Euroland-portal-screenshot-h

In this case the fade-in/out distance is 75 meters.

I think now I understand it better, I remember having a hard time finding where and how those got rendered while porting the graphics back-end to OpenGL. You could see the holes in the entrances of the disabled zones until a few months before release, discovered it while implementing the debug-drawing functions.

--

In this case the map mesh is in Entities\EAST\HEL-LAND-EAST-02. To change the portal 2D impostor distance, go to Polygon > Transform and use the Surface button (or just press Q) with the portal face poly selected.

First enable Eurocom > Z-Order. If you click on the 75 entry it will select the portal geometry. Then press Q to open the face properties dialog, change the 75.0 to something bigger, save. That should be it.

Euroland-portal-screenshot-i-2023-addendum

The polygons I added to the map don't show up in-game, if I enable debug portals and submaps in the Watcher there is a box surrounding them[]

Euroland-identifiers

Turns out new entity polygons that are used as static map geometry get auto-assigned to identifier 0 (segregated into its own unconfigured submap), and the ones in any particular submap may be grouped into something like 1-20. You can view, select and reassign the active identifier groups right from the Eurocom menu bar > Identifier tool bar. There is an Assign button and you can right-click in the list to configure fog and sound reverb under Properties > Effects. [2]

Submap visibility editor[]

Euroland-map-visibility

This window, available in the map editor under View > Visibility, overrides the default visibility portaling system that dictates which far away chunks or areas of a level are loaded and active at any given time, when viewed from the area the player is in. You can mark as occluded any neighboring level pieces that you know aren't ever going to be visible from certain spots, hence saving processing time at runtime and improving performance.[3]

Each area is surrounded by its own hull or bounding box. Clicking on it will highlight it in white, any other areas marked as occluded from that viewpoint will be highlighted in a dark orange color. Unmarked areas that will otherwise use the submap connectivity information for culling will appear in pure black.

Keep in mind that any mistake during tagging here will cause possible void outs, or suddenly popping map geometry until the player actually moves into the submap.

Advertisement