My program doesn't have bugs. It just develops random features.

Legacy:Torin/Decoration Problems In UEd2

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

28 May 2005

Torin: I found something interesting while looking at decorations; it appears that in UnrealEd2 a duplicate class name will be at least partially 'overridden' by an existing class name EVEN IF they subclass different classes. So the class definitions below will clash. Picking Actor->Decoration->ut_Decoration->Boulder1 from the Actor Class Browser will select the UnrealI.Boulder1 class, not the Botpack.Boulder1 class.

class Botpack.Boulder1
//=============================================================================
// boulder1.
//=============================================================================
class Boulder1 extends ut_Decoration;
class UnrealI.Boulder1
//=============================================================================
// Boulder1.
//=============================================================================
class Boulder1 extends BigRock;
 
function SpawnChunks(int num)
{
	...

Note: Anywhere in this where you see "UnrealI" the last two letters are l as in light and I as in index (or Lima Indigo if you like, or maybe 'ell' 'aye')

Likewise for Boulder1 it's an 'ell' in the middle and a 'one' at the end.

Oh, for pity's sake, this is a techie wiki! Why can't we use fonts where the number '1' and the lowercase 'l' and the uppercase 'I' all look different? Oh! I forgot the '

T-1: SECONDED.

If you look in UnrealTournament.ini in the [Editor.EditorEngine] section you will notice that the order is:

{{{1}}}

If you comment out "EditPackages=UnrealI" the Actor->Projectile->BigRock->Boulder1 class is not shown in the Actor Class Browser. It is part of UnrealI! The Actor->Decoration->ut_Decoration->Boulder1 now shows the expected Botpack definition.

If you move the "EditPackages=UnrealI" somewhere after the "EditPackages=Botpack" then the Actor Class Browser shows both Boulder1 classes with the Botpack.Boulder1 definition.

How about usage in a map? Does the game engine know the difference?

OK, so we start with the "EditPackages=UnrealI" commented out. (I wanna see the Botpack.Boulder1 <grin>) Fire up the editor and make a 1024 cube subtraction for the room. Put in a Playerstart in one corner, the utDecoration->Boulder1 in the diagonally opposite corner and a light in the middle. The boulder shows up half buried in the floor, but that would be normal for a boulder.

Rebuild, Save, Play.

You don't have to hide under that rock, you can get right inside it!

OK, now close the editor (if you used the editor's autoplay), put "EditPackages=UnrealI" back where it belongs. This is an .ini file that gets modified by the game engine, so the game (including the editor) needs to be OFF when you modify it.

Now start up UnrealEd2, Load up the test map and add in the UnrealI.Boulder1 from Actor->Projectile->BigRock->Boulder1 near the light and about halfway to the ceiling so we can see it before it breaks <grin>.

Rebuild, Save, Play.

And voila! we see a big boulder in the corner and some rock chunks flying around. The game engine has no problem knowing the difference between our two "Boulder1" classes. Even rebuilding the map is not a problem, though if you right click on the Botpack.Boulder1 mesh in an editor view and select "Edit Script" you will be shown the script for "UnrealI.Boulder1".

Finally, try exporting the map (File->Export) and check out the boulder situation.

Oops! No mention of the source of the class at all! So depending on which EditPackages lines you have and their order in UnrealTournament.ini, if you import the .t3d file you might get two UnrealI.Boulder1 objects or two Botpack.Boulder1 objects!

We can manually add in the source of the class for each Boulder1 in the .t3d file. The UnrealI.Boulder1 was moved so find the actor with Location and OldLocation values that are different and change the "Begin Actor Class=Boulder1" to "Begin Actor Class=UnrealI.Boulder1 ". By process of elimination the other "Begin Actor Class=Boulder1" has to be "Begin Actor Class=Botpack.Boulder1". Now it will Import properly.

Summary:[edit]

  1. The "Actor Class Browser" can properly build the class tree view with two classes with the same name but from different packages and different subclassing. :D
  1. The "Actor Class Browser" can NOT select both objects from the class tree view with two classes with the same name but from different packages and different subclassing. The class from the package whose EditPackages= line is listed first in the [Editor.EditorEngine] section of UnrealTournament.ini will be accessible at both locations on the class tree view. :tdown:
  1. The "Edit Script" context menu item in the "Actor Class Browser" can NOT select both objects from the class tree view with two classes with the same name but from different packages and different subclassing. The class from the package whose EditPackages= line is listed first in the [Editor.EditorEngine] section of UnrealTournament.ini will be accessible at both locations on the class tree view. :tdown:
  1. The "Edit Script" context menu item for an actor object in the map views can NOT select both objects from the class tree with two classes with the same name but from different packages and different subclassing. The class from the package whose EditPackages= line is listed first in the [Editor.EditorEngine] section of UnrealTournament.ini will be shown. The window title will show the correct name for the object selected. :tdown:
  1. The "Actor Properties" context menu item for an actor object in the map views will correctly show the properties for the object when the class tree contains two classes with the same name but from different packages and different subclassing. :D
  1. The "Select All <name>" context menu item for an actor object in the map views will select all objects of both classes for a class tree with two classes with the same name but from different packages and different subclassing. :tdown:
  1. A map which was built with only one of the two packages available will correctly rebuild with two classes with the same name but from different packages and different subclassing, regardless of the order of the EditPackages= lines in the [Editor.EditorEngine] section of UnrealTournament.ini :D
  1. Exporting a map which uses two classes with the same name but from different packages and different subclassing to a .t3d file does not differentiate between the two different classes. The package names are NOT exported, only the class name. :tdown:
  1. Importing a .t3d file on an UnrealEd2 installation with two classes with the same name but from different packages and different subclassing will use The class from the package whose EditPackages= line is listed first in the [Editor.EditorEngine] section of UnrealTournament.ini :tdown:
  1. Importing a .t3d file on an UnrealEd2 installation with packages specified for individual objects will succeed. If a .t3d file is manually edited so that object classes are specified as "Begin Actor Class=<package>.<class> Name=<name>" the correct objects will be inserted in the map. (Assuming that the packages are actually available.) :D

Conclusion:[edit]

While the game engine appears to support two classes with the same name but from different packages and different subclassing, the editor does not in several ways. Since an existing map can in all cases tested be rebuilt without harm in spite of the problem, fixing the errors should not cause compatibility problems.

Now, if I could just get my hands on the code... ;)