Improbable Icon

Theory, how can this be done. Unity + UE4 or C#/Java tools combined

unity
ue4

#1

So I want to know how this can be done, I guess you could say its impossible :slight_smile:

I want to combine Unity and UE4 together, like Unity physics, networking, but like UE4 graphics, combined both, etc in a single game.

Since the workers spin up many instances wouldn’t it be possible to do both?

How can I do this?

Thank you!
Xalo


#3

Hi @Xalo,

Most of this should in theory, be possible. Since everything you are running on the server and clients are separate, it is definitely possible to use a different engine for each. The one part of your statement that isn’t possible is using Unity networking, as technically the SpatialOS stack replaces this step (which is how you can have total abstraction between your servers and clients that would allow this to be possible in the first place).

If you look at Unity and Unreal projects, the place they begin to differ is within the workers directory. You could combine these in one project by copying the entire Unreal worker directory into the workers directory for a Unity project.

Then you would need to configure which workers are used in the default launch json file. If you open one of these for an existing project, you will see how it has different sections for specifying the types of workers that are launched. In that file you would need to add sections for the UnrealClient worker you just added to your project with the right permissions type specified. You would also need to delete the section for the UnityClient worker so that SpatialOS doesn’t get confused.

Finally, you would need to go into the UnityWorker directory itself and modify the build.json files so that it no longer builds a UnityClient. This way, when you build your workers and deploy them to the cloud, SpatialOS won’t get confused between the UnrealClient and UnityClient.


#4

Hello @Kevin,

Sure! So would the client act as a custom client, but the workers would be in each unity/ue4 client?

Thank you!


#5

Hi @Xalo,

It sounds like there might be a terminology mix up. Both the clients and the game engines running physics on the server are what we call “workers”. The thing that distinguishes them is what tasks they do, and where they are. In a basic Unity game, the UnityWorker workers are in the server computing physics and doing other normal server-side stuff, while the UnityClient workers are what players are using to play the game on their computers. However, what I’m trying to say above is that it isn’t absolutely necessary that both the server workers and client workers use the same game engine. All that any worker is doing is just simulating some part of the game world that the network tells it about, while updating the network with changes it makes. So using the process I stated above, you could swap out the UnityClient for an UnrealClient and still have a working game. The other steps I listed are just other small configuration changes that need to be made so that SpatialOS knows what’s going on with what workers are running where.

If you’re curious as to how this looks within the Unity and Unreal project editors, that will change a bit between the two game engines. For Unity, we use a different scene for each different worker. If you are only using Unity for the physics workers, you would only need the UnityWorker scene and not the UnityClient scene. In Unreal, the two types of workers are not separated in this way. Instead it’s those build json files I was mentioning earlier that define what types of worker binaries are created when you run a build, which is why you’d want to modify that to only create a UnrealClient, and not waste time and space creating an UnrealWorker as well.


#6

Hello @Kevin,

Yeah I probably did mix it up. That makes sense! Will do!

Thank you!