Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does Deus Ex work on UTEngine? #16

Open
GermanAizek opened this issue Sep 23, 2022 · 20 comments
Open

Does Deus Ex work on UTEngine? #16

GermanAizek opened this issue Sep 23, 2022 · 20 comments

Comments

@GermanAizek
Copy link

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?

@dpjudas
Copy link
Owner

dpjudas commented Sep 24, 2022

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.

@GermanAizek
Copy link
Author

GermanAizek commented Sep 24, 2022

@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?

@dpjudas
Copy link
Owner

dpjudas commented Sep 24, 2022

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.

@GermanAizek
Copy link
Author

@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
Copy link
Author

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()

@dpjudas
Copy link
Owner

dpjudas commented Sep 24, 2022

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
Copy link
Owner

dpjudas commented Sep 24, 2022

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. :)

@GermanAizek
Copy link
Author

GermanAizek commented Sep 24, 2022

@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");
}

@dpjudas
Copy link
Owner

dpjudas commented Sep 24, 2022

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.

@GermanAizek
Copy link
Author

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
Copy link
Author

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

@dpjudas
Copy link
Owner

dpjudas commented Sep 24, 2022

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
Copy link
Owner

dpjudas commented Sep 24, 2022

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. :)

@GermanAizek
Copy link
Author

@dpjudas b12ea9d
a big green ion storm logo after start?

@dpjudas
Copy link
Owner

dpjudas commented Sep 24, 2022

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.

@GermanAizek
Copy link
Author

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

@dpjudas
Copy link
Owner

dpjudas commented Sep 24, 2022

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.

@GermanAizek
Copy link
Author

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
Copy link
Author

 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

@dpjudas
Copy link
Owner

dpjudas commented Sep 24, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants