UTEngine icon indicating copy to clipboard operation
UTEngine copied to clipboard

Does `Deus Ex` work on `UTEngine`?

Open GermanAizek opened this issue 3 years ago • 20 comments

Hello @dpjudas, will it be possible to run game on Unreal Engine, example as Deus Ex and have 100% open source, or is there still a big difference between the UTengine and Deus Ex engines?

GermanAizek avatar Sep 23 '22 14:09 GermanAizek

There are some differences - how big they are I don't know. In any case, UTEngine would have to be able to run UT itself properly before it makes any sense to add more games to it.

dpjudas avatar Sep 24 '22 12:09 dpjudas

@dpjudas, I tried to download today, setup reading ini, files, but there is a problem he cannot find the 'gameinfo' class in function LoadMap() "DeusEx.DeusExGameInfo" which is specified in 'DefaultGame' I have brought up a list packages and I cannot get 'UObject' and classes from 'DeusEx' package (DeusEx.u file in System) But from 'DeusExSounds.u' package I can read classes, why so?

GermanAizek avatar Sep 24 '22 13:09 GermanAizek

It is probably because in PackageManager::GetIniValue it assumes the .ini file is called UnrealTournament.ini. Even if it did manage to read that it will probably run into trouble with the meshes as I believe DeusEx changed the vertex format. At least I think I remember seeing something like that in the UShock codebase once.

dpjudas avatar Sep 24 '22 13:09 dpjudas

@dpjudas I removed the mention of UnrealTournament and UnrealI and UnrealShare

if (File::try_open_existing(FilePath::combine(path, "System/DeusEx.ini")))
	{
		folder.name = "DeusEx";
		folder.launchInfo.folder = path;
		folder.launchInfo.engineVersion = 226;
	}
if (iniName == "system" || iniName == "System")
		iniName = "DeusEx"/*unreal1 ? "Unreal" : "UnrealTournament"*/;
	else if (iniName == "user")
		iniName = "User";

I also tried to run with 'Engine.GameInfo', which led to fact that there is no native function

Script execution error:

Unknown native function LevelInfo.InitEventManager

Call stack:

LevelInfo.PreBeginPlay line 178

GermanAizek avatar Sep 24 '22 14:09 GermanAizek

LevelInfo.InitEventManager reference documention: https://beyondunrealwiki.github.io/pages/levelinfo-dx.html

LevelInfo contains information about the current level. There should be one per level and it should be actor 0. UnrealEd creates each level's LevelInfo automatically so you should never have to place one manually.

The ZoneInfo properties in the LevelInfo are used to define the properties of all zones which don't themselves have ZoneInfo.

    UT has nativereplication on the class
    UT property VisibleGroups()
    UT property bLowRes()
    DX property EventManager()
    DX event ServerTravel() changed
    DX new function InitEventManager()

GermanAizek avatar Sep 24 '22 14:09 GermanAizek

I pushed an update where it detects Deus Ex and loads its meshes. But yeah next thing it bailed on was calling LevelInfo.InitEventManager

dpjudas avatar Sep 24 '22 14:09 dpjudas

Fixing that made it miss DeusExPlayer.CreateDumpLocationObject. So probably a few native classes that needs to be defined for it to even try do anything. :)

dpjudas avatar Sep 24 '22 14:09 dpjudas

@dpjudas Did I understand correctly that I need to restore InitEventManger function? because when exporting native functions, I have it

void NLevelInfo::InitEventManager(UObject* Self)
{
	throw std::runtime_error("LevelInfo.InitEventManager not implemented");
}

GermanAizek avatar Sep 24 '22 15:09 GermanAizek

If you throw an exception in the function then when unrealscript calls it UTEngine will shut down. I opted for making it do nothing instead. Then it complains about another missing native function on the DeusExPlayer class.

dpjudas avatar Sep 24 '22 15:09 dpjudas

in this project, function InitEventManager was ignored, but how efficient it is I do not know https://github.com/Dx-Reborn/_DXR/blob/0f934fe91773463da9d0f649e9c8d758e2615d14/DeusEx/Classes/DeusExLevelInfo.uc#L32

GermanAizek avatar Sep 24 '22 15:09 GermanAizek

I noticed that you added commits, now I will take them.

GermanAizek avatar Sep 24 '22 15:09 GermanAizek

Seems at least these bindings has to be added as well:

// native Functions native(1099) final function string GetDeusExVersion(); native(2100) final function ConBindEvents(); native(3001) final function name SetBoolFlagFromString(String flagNameString, bool bValue); native(3002) final function ConHistory CreateHistoryObject(); native(3003) final function ConHistoryEvent CreateHistoryEvent(); native(3010) final function DeusExLog CreateLogObject(); native(3011) final function SaveGame(int saveIndex, optional String saveDesc); native(3012) final function DeleteSaveGameFiles(optional String saveDirectory); native(3013) final function GameDirectory CreateGameDirectoryObject(); native(3014) final function DataVaultImageNote CreateDataVaultImageNoteObject(); native(3015) final function DumpLocation CreateDumpLocationObject(); native(3016) final function UnloadTexture(Texture texture);

There are probably more of them. Too bad my --extract-nativeobj helper crashes so we can't get a complete dump of them easily.

dpjudas avatar Sep 24 '22 15:09 dpjudas

I pushed another update that adds empty handlers for all the native functions in new classes from the DeusEx.u package. Question now is how many of them actually have to be implemented (or do nothing) for the game to actually start up. :)

dpjudas avatar Sep 24 '22 15:09 dpjudas

@dpjudas https://github.com/dpjudas/UTEngine/commit/b12ea9d155d0ef65d69adae9b10bb7e7ba7d90d0 a big green ion storm logo after start?

GermanAizek avatar Sep 24 '22 16:09 GermanAizek

Pretty much! :)

On the plus side it boots the game and plays the music. It probably doesn't render the right thing due to those native functions not doing anything (in particular the ones that return null when they were supposed to return an object).

As you can see, UTEngine is pretty close to be able to render/run this game, and yet at the same pretty far with all that Deus Ex specific native code they added.

dpjudas avatar Sep 24 '22 16:09 dpjudas

Are there debuggers .uc scripts? How realistic it is to restore objects that should return DX functions?

GermanAizek avatar Sep 24 '22 16:09 GermanAizek

Originally my plan was to write a simple debugger where I could set break points in the scripts and step through it (that editor thing you see when it aborts on Windows, or select View Log in UT). I've kind of concluded at this point it is a bit too much work to do that.

Maybe a better approach would be to output trace info into the console or a log file. For example it might be useful to see which functions it is calling in what order. I'm not sure.

For viewing the .uc scripts themselves for UT there's the unreal editor (or you can export them all to text files). I'm not sure if Deus Ex has such an editor or if the UE editor can be used. I'm overall pretty unfamiliar with Deus.

dpjudas avatar Sep 24 '22 17:09 dpjudas

For viewing the .uc scripts themselves for UT there's the unreal editor (or you can export them all to text files). I'm not sure if Deus Ex has such an editor or if the UE editor can be used. I'm overall pretty unfamiliar with Deus.

https://www.moddb.com/games/deus-ex/downloads/sdk-v1112fm ?

GermanAizek avatar Sep 24 '22 17:09 GermanAizek

 Armed with the SDK, users can:

    Create standalone Deus Ex missions
    Build 3D maps from scratch, using Deus Ex textures and sounds
    Modify existing Deus Ex maps

GermanAizek avatar Sep 24 '22 17:09 GermanAizek

Okay I guess you can use that for reading the uc script files. Right now problem is that you have the script files and then this:

image

There are no hints of what went wrong except what the scripts wrote to the console. The only real option at the moment is to recompile the scripts in the SDK with log lines trying to trace where something went wrong. That takes a lot of time so we could really use something a lot more efficient for tracing down the root cause of the bugs.

dpjudas avatar Sep 24 '22 17:09 dpjudas